-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major performance refactor with a few breaking changes
- Change how tables and primary keys are fetched to minimize reads - Allow for more efficient bulk writing using Sqlite batches - Rework abstractions to expose the Sqlite batch API - Rename classes to better reflect their goals - Correctly identify and forbid semicolon separated statements
- Loading branch information
Showing
7 changed files
with
506 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:sqflite_common/sqlite_api.dart'; | ||
import 'package:sql_crdt/sql_crdt.dart'; | ||
import 'package:sqlite_crdt/src/sqlite_api.dart'; | ||
|
||
/// Wrapper around Sqlite batches that automatically applies CRDT metadata to | ||
/// inserted records. | ||
/// | ||
/// Note that timestamps are fixed at the moment of instantiation, so creating | ||
/// long-lived batches is discouraged. | ||
class BatchExecutor extends CrdtExecutor { | ||
final Batch _batch; | ||
|
||
BatchExecutor(this._batch, Hlc hlc) : super(BatchApi(_batch), hlc); | ||
|
||
/// Commit this batch atomically. See Sqlite documentation for details. | ||
Future<List<Object?>> commit() => _batch.commit(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.