InMemoryPersistenceStorageEngine class final
Keeps everything in maps; a transaction that ends without setTransactionSuccessful is rolled back. Mutations outside a transaction throw a StateError unless disableTransactionCheck.
While isDurable is true it also checks what only stored data can get wrong (unknown write and tracked query ids, removed keys that are not stored, one id per query): reference-engine checks, not requirements on engines, so the contract does not test them; once degraded or closed it skips them, as a real degraded engine reads as empty.
- Implemented types
Constructors
-
InMemoryPersistenceStorageEngine([List<
UserWriteRecord> initialWrites = const <UserWriteRecord>[]]) -
Creates an engine holding
initialWrites.
Properties
- disableTransactionCheck ↔ bool
-
Lets tests mutate outside a transaction.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether close was called and reopen was not called since.
no setter
- 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 setteroverride - logger ↔ DatabaseLogger?
-
Receives the warnings of pruneCache (null: dropped).
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
beginTransaction(
) → void -
Starts a transaction; nesting is an error.
override
-
close(
) → void -
Releases the store.
override
-
degrade(
) → void - Simulates a run-time storage failure: the engine becomes degraded for good.
-
deleteTrackedQuery(
int trackedQueryId) → void -
Deletes tracked query
trackedQueryIdand its keys.override -
endTransaction(
) → void -
Ends the transaction, committing it if setTransactionSuccessful was called.
override
-
loadTrackedQueries(
) → List< TrackedQuery> -
The tracked queries ordered by id.
override
-
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.override -
loadUserWrites(
) → List< UserWriteRecord> -
The stored writes ordered by write id.
override
-
mergeIntoServerCache(
Path path, Node node) → void -
Writes each child of
nodebelowpath, leaving other children alone.override -
mergeIntoServerCacheWrite(
Path path, CompoundWrite children) → void -
Writes each write of
childrenbelowpath.override -
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.override -
pruneCache(
Path root, PruneForest pruneForest) → void -
Deletes the cached data below
rootthatpruneForestprunes and does not keep.override -
removeAllUserWrites(
) → void -
Removes every write.
override
-
removeUserWrite(
WriteId writeId) → void -
Removes write
writeId; an unknown id is a no-op (Android deletes no row).override -
reopen(
) → void - Opens a closed engine again with the data it held, as reopening a file does.
-
resetPreviouslyActiveTrackedQueries(
int lastUse) → void -
Marks every active tracked query inactive with
lastUse(at start-up).override -
saveTrackedQuery(
TrackedQuery trackedQuery) → void -
Stores
trackedQuery(insert or replace by id).override -
saveTrackedQueryKeys(
int trackedQueryId, Set< ChildKey> keys) → void -
Replaces the keys of
trackedQueryId.override -
saveUserMerge(
Path path, CompoundWrite children, WriteId writeId) → void -
Stores a merge.
override
-
saveUserOverwrite(
Path path, Node node, WriteId writeId) → void -
Stores an overwrite.
override
-
serverCache(
Path path) → Node -
The cached node at
path(empty when nothing is cached).override -
serverCacheEstimatedSizeInBytes(
) → int -
The estimated size of the server cache in bytes.
override
-
setTransactionSuccessful(
) → void -
Marks the current transaction to be committed.
override
-
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.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited