FilePersistor class

A worker abstraction that creates a background worker isolate to process file persistence/hydration.

Inheritance

Constructors

FilePersistor({FilePersistorSettings? settings, void onPersist(List<Document> batch)?, void onClear(Collection collection)?, void onClearAll()?, void onHydrate(HydrationData data)?, Duration persistenceThrottle = const Duration(milliseconds: 100)})

Properties

hashCode int
The hash code for this object.
no setterinherited
onClear → void Function(Collection collection)?
finalinherited
onClearAll → void Function()?
finalinherited
onHydrate → void Function(HydrationData data)?
finalinherited
onPersist → void Function(List<Document> batch)?
finalinherited
persistenceThrottle Duration
The throttle for batching persisted documents. All documents updated within the throttle duration are batched together into a single persist operation.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
settings PersistorSettings
finalinherited

Methods

clear(Collection collection) Future<void>
Clear function used to clear all documents in a collection.
override
clearAll() Future<void>
Clears all documents and removes all persisted data.
override
hydrate([List<StoreReference>? refs]) Future<HydrationData>
Hydration function called to read data from persistence. If no entities are specified, then it hydrations all persisted data. if entities are specified, it hydrates only the data from the paths under those entities.
override
init() Future<void>
Public APIs to be implemented by any Persistor extension like FilePersistor.
override
initDirectory() Future<Directory>
Initializes the directory in which files are persisted. This needs to be done on the main isolate as opposed to the worker since it requires access to plugins that are not easily available in the worker isolate context.
initEncrypter() Future<Encrypter?>
Initializes the encrypter used for encrypting files. This needs to be done on the main isolate as opposed to the worker since it requires access to plugins that are not easily available in the worker isolate context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
persist(List<Document> docs) Future<void>
Persist function called with the bath of documents that have changed (including been deleted) within the last throttle window specified by the Persistor.persistenceThrottle duration.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited