[ledger] Replace usage of New methods on ledger's Page.
LE-618
Change-Id: I5e0ebf27d80fe4b352ad4b5040e87c0b48efb6b5
diff --git a/examples/ledger/todo_list/lib/src/models/todo_list_model.dart b/examples/ledger/todo_list/lib/src/models/todo_list_model.dart
index a5f0ce1..a4bb05d 100644
--- a/examples/ledger/todo_list/lib/src/models/todo_list_model.dart
+++ b/examples/ledger/todo_list/lib/src/models/todo_list_model.dart
@@ -45,7 +45,7 @@
await _ledger.getRootPage(_page.ctrl.request());
final snapshot = ledger.PageSnapshotProxy();
- await _page.getSnapshotNew(
+ await _page.getSnapshot(
snapshot.ctrl.request(),
Uint8List(0),
_pageWatcherBinding.wrap(_PageWatcher(this)),
@@ -62,12 +62,12 @@
/// Marks the item of the given [id] as done.
void markItemDone(List<int> id) {
- _page.deleteNew(id);
+ _page.delete(id);
}
/// Adds a new todo item with the given [content].
void addItem(String content) {
- _page.putNew(_makeKey(), utf8.encode(content));
+ _page.put(_makeKey(), utf8.encode(content));
}
void _readItems(ledger.PageSnapshotProxy snapshot) {
diff --git a/public/dart/sledge/lib/src/storage/document_storage.dart b/public/dart/sledge/lib/src/storage/document_storage.dart
index 0cf1bce..e5a1e07 100644
--- a/public/dart/sledge/lib/src/storage/document_storage.dart
+++ b/public/dart/sledge/lib/src/storage/document_storage.dart
@@ -38,7 +38,7 @@
for (Uint8List deletedKey in change.deletedKeys) {
final Uint8List keyWithDocumentPrefix =
concatUint8Lists(documentPrefix, deletedKey);
- page.deleteNew(
+ page.delete(
keyWithDocumentPrefix,
);
}
@@ -47,7 +47,7 @@
for (KeyValue kv in change.changedEntries) {
final Uint8List keyWithDocumentPrefix =
concatUint8Lists(documentPrefix, kv.key);
- page.putNew(
+ page.put(
keyWithDocumentPrefix,
kv.value,
);
@@ -56,7 +56,7 @@
void _deleteKeyValues(List<KeyValue> keyValues, ledger.Page page) {
for (KeyValue kv in keyValues) {
- page.deleteNew(
+ page.delete(
kv.key,
);
}
diff --git a/public/dart/sledge/lib/src/storage/schema_storage.dart b/public/dart/sledge/lib/src/storage/schema_storage.dart
index 1a7ea72..62da932 100644
--- a/public/dart/sledge/lib/src/storage/schema_storage.dart
+++ b/public/dart/sledge/lib/src/storage/schema_storage.dart
@@ -28,7 +28,7 @@
final Uint8List value = getUint8ListFromString(jsonString);
// TODO: handle the case where |value| is larger than the maximum allowed
// size.
- page.putNew(
+ page.put(
key,
value,
);
diff --git a/public/dart/sledge/lib/src/subscription/subscription.dart b/public/dart/sledge/lib/src/subscription/subscription.dart
index 7f929bd..ed9c07c 100644
--- a/public/dart/sledge/lib/src/subscription/subscription.dart
+++ b/public/dart/sledge/lib/src/subscription/subscription.dart
@@ -24,7 +24,7 @@
this._applyChangeCallback)
: _snapshotProxy = ledgerObjectsFactory.newPageSnapshotProxy(),
_pageWatcherBinding = ledgerObjectsFactory.newPageWatcherBinding() {
- _pageProxy.getSnapshotNew(
+ _pageProxy.getSnapshot(
_snapshotProxy.ctrl.request(),
Uint8List(0),
_pageWatcherBinding.wrap(this),
diff --git a/public/dart/sledge/lib/src/transaction.dart b/public/dart/sledge/lib/src/transaction.dart
index 576eaf8..deeb1b6 100644
--- a/public/dart/sledge/lib/src/transaction.dart
+++ b/public/dart/sledge/lib/src/transaction.dart
@@ -42,10 +42,10 @@
Future<bool> saveModification(Modification modification) async {
// Start Ledger transaction.
_pageProxy
- ..startTransactionNew()
+ ..startTransaction()
// Obtain the snapshot.
// All the read operations in |modification| will read from that snapshot.
- ..getSnapshotNew(
+ ..getSnapshot(
_pageSnapshotProxy.ctrl.request(),
Uint8List(0),
null,
@@ -80,7 +80,7 @@
}
// Finish the transaction by commiting.
- _pageProxy.commitNew();
+ _pageProxy.commit();
// Notify the documents that the transaction has been completed.
_documents
@@ -196,6 +196,6 @@
_documents
..forEach((Document document) => document.rollbackChange())
..clear();
- _pageProxy.rollbackNew();
+ _pageProxy.rollback();
}
}
diff --git a/public/dart/sledge/test/fakes/fake_ledger_page.dart b/public/dart/sledge/test/fakes/fake_ledger_page.dart
index de0c32b..5eedc7d 100644
--- a/public/dart/sledge/test/fakes/fake_ledger_page.dart
+++ b/public/dart/sledge/test/fakes/fake_ledger_page.dart
@@ -38,35 +38,35 @@
StorageState get storageState => _storageState;
@override
- void putNew(Uint8List key, Uint8List value) {
+ void put(Uint8List key, Uint8List value) {
_modification.changedEntries.add(KeyValue(key, value));
}
@override
- void deleteNew(Uint8List key) {
+ void delete(Uint8List key) {
_modification.deletedKeys.add(key);
}
@override
- void startTransactionNew() {
+ void startTransaction() {
assert(_modification.changedEntries.isEmpty);
assert(_modification.deletedKeys.isEmpty);
}
@override
- void commitNew() {
+ void commit() {
_storageState.applyChange(_modification);
onChange(_modification);
_modification.clear();
}
@override
- void rollbackNew() {
+ void rollback() {
_modification.clear();
}
@override
- void getSnapshotNew(
+ void getSnapshot(
Object snapshotRequest, Uint8List keyPrefix, dynamic watcher) {
if (watcher != null) {
_watcher = watcher;