A synchronous store of user writes, the server cache tree, tracked queries and their keys.
Mutations happen between beginTransaction and endTransaction; they are committed only if setTransactionSuccessful was called in between. Reads may happen at any time.
Programming errors (a mutation outside a transaction, a nested beginTransaction) throw a StateError. Storage errors at run time (disk full, I/O error, corruption, a lost lease) never throw: the engine rolls back, becomes degraded (isDurable turns false for good), and from then on stores nothing and reads as empty, while the sync tree's memory state stays authoritative for the session.
A condition that only stored data can cause (an unknown write id or tracked query id, keys removed that are not stored, data that a prune neither prunes nor keeps) is never an error an engine must report: a degraded engine reads as empty, and a store may hold data an earlier version wrote. The reference engine checks some of these while isDurable is true; each such check is marked "a reference-engine check, not a requirement on engines".
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDurable → bool
-
Whether data written now survives a restart: true after a successful open, false once the
engine is degraded or fenced (or closed). Never turns true again in the same session; the
public
persistenceEnabledreads it.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
beginTransaction(
) → void - Starts a transaction; nesting is an error.
-
close(
) → void - Releases the store.
-
deleteTrackedQuery(
int trackedQueryId) → void -
Deletes tracked query
trackedQueryIdand its keys. -
endTransaction(
) → void - Ends the transaction, committing it if setTransactionSuccessful was called.
-
loadTrackedQueries(
) → List< TrackedQuery> - The tracked queries ordered by id.
-
loadTrackedQueryKeys(
Set< int> trackedQueryIds) → Set<ChildKey> -
The union of the keys of
trackedQueryIds(one id: a set of one); an unknown id adds no keys. -
loadUserWrites(
) → List< UserWriteRecord> - The stored writes ordered by write id.
-
mergeIntoServerCache(
Path path, Node node) → void -
Writes each child of
nodebelowpath, leaving other children alone. -
mergeIntoServerCacheWrite(
Path path, CompoundWrite children) → void -
Writes each write of
childrenbelowpath. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overwriteServerCache(
Path path, Node node) → void -
Replaces the cache at
pathwithnode. -
pruneCache(
Path root, PruneForest pruneForest) → void -
Deletes the cached data below
rootthatpruneForestprunes and does not keep. -
removeAllUserWrites(
) → void - Removes every write.
-
removeUserWrite(
WriteId writeId) → void -
Removes write
writeId; an unknown id is a no-op (Android deletes no row). -
resetPreviouslyActiveTrackedQueries(
int lastUse) → void -
Marks every active tracked query inactive with
lastUse(at start-up). -
saveTrackedQuery(
TrackedQuery trackedQuery) → void -
Stores
trackedQuery(insert or replace by id). -
saveTrackedQueryKeys(
int trackedQueryId, Set< ChildKey> keys) → void -
Replaces the keys of
trackedQueryId. -
saveUserMerge(
Path path, CompoundWrite children, WriteId writeId) → void - Stores a merge.
-
saveUserOverwrite(
Path path, Node node, WriteId writeId) → void - Stores an overwrite.
-
serverCache(
Path path) → Node -
The cached node at
path(empty when nothing is cached). -
serverCacheEstimatedSizeInBytes(
) → int - The estimated size of the server cache in bytes.
-
setTransactionSuccessful(
) → void - Marks the current transaction to be committed.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateTrackedQueryKeys(
int trackedQueryId, Set< ChildKey> added, Set<ChildKey> removed) → void -
Adds and removes keys of
trackedQueryId; removing a key that is not stored is a no-op.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited