Skip to content

@statesync/tauri


@statesync/tauri / StorageBackend

Interface: StorageBackend<T>

Defined in: persistence.ts:23

Abstract storage backend interface for persisting snapshot envelopes.

This interface mirrors the contract from @statesync/persistence and is re-declared here so that @statesync/tauri does not require @statesync/persistence as a runtime dependency.

Type Parameters

Type ParameterDescription
TThe application-specific snapshot data type.

Methods

clear()?

ts
optional clear(): Promise<void>;

Defined in: persistence.ts:46

Remove any persisted snapshot from the backing store.

Implementations may omit this method if clearing is not supported.

Returns

Promise<void>

A promise that resolves when the data has been removed.


load()

ts
load(): Promise<SnapshotEnvelope<T> | null>;

Defined in: persistence.ts:37

Load the most recently saved snapshot envelope from the backing store.

Returns

Promise<SnapshotEnvelope<T> | null>

The stored snapshot, or null if no snapshot has been saved yet.


save()

ts
save(snapshot): Promise<void>;

Defined in: persistence.ts:30

Persist a snapshot envelope to the backing store.

Parameters

ParameterTypeDescription
snapshotSnapshotEnvelope<T>The versioned snapshot to save.

Returns

Promise<void>

A promise that resolves when the write is complete.

Released under the MIT License.