Skip to content

@yantrix/automata v0.6.0 • Docs


Yantrix API / @yantrix/automata / StorageSyncLoop

Class: StorageSyncLoop<ModelType> ​

Independent asynchronous loop that projects committed Data Model snapshots to Storages. Rapid commits are coalesced while an earlier write is in flight.

Type Parameters ​

• ModelType extends object

Methods ​

hydrate() ​

ts
hydrate(initialModel): Promise<TModelHydrationResult<ModelType>>

Hydrates the loop's registered Storage bindings and returns the Data Model for the caller to commit.

Parameters ​

• initialModel: ModelType = ...

Returns ​

Promise<TModelHydrationResult<ModelType>>


requestSync() ​

ts
requestSync(model): this

Schedules a snapshot without waiting for external I/O.

Parameters ​

• model: ModelType = ...

Returns ​

this