@statesync/persistence / StorageBackendWithMetadata
Interface: StorageBackendWithMetadata<T>
Defined in: persistence/src/types.ts:204
Extended storage backend that persists metadata alongside snapshots.
Backends implementing this interface support schema versioning, TTL expiration, integrity hashing, and storage usage reporting.
The persistence applier automatically detects this interface via duck typing and uses the metadata-aware methods when available.
Extends
Type Parameters
| Type Parameter | Description |
|---|---|
T | The shape of the application state. |
Methods
clear()?
optional clear(): Promise<void>;Defined in: persistence/src/types.ts:190
Remove all persisted data from this backend's storage key.
This method is optional -- not all backends support clearing.
Returns
Promise<void>
A promise that resolves when the data has been removed.
Inherited from
getUsage()?
optional getUsage(): Promise<StorageUsage>;Defined in: persistence/src/types.ts:227
Estimate current storage usage for this backend.
This method is optional -- not all backends can report usage.
Returns
Promise<StorageUsage>
Storage usage information including bytes used and quota (if available).
load()
load(): Promise<SnapshotEnvelope<T> | null>;Defined in: persistence/src/types.ts:181
Load the most recent snapshot from persistent storage.
Returns
Promise<SnapshotEnvelope<T> | null>
The stored snapshot, or null if no snapshot has been persisted yet.
Inherited from
loadWithMetadata()
loadWithMetadata(): Promise<PersistedSnapshot<T> | null>;Defined in: persistence/src/types.ts:218
Load the most recent snapshot along with its metadata.
Returns
Promise<PersistedSnapshot<T> | null>
The stored snapshot and metadata bundle, or null if nothing is persisted.
save()
save(snapshot): Promise<void>;Defined in: persistence/src/types.ts:174
Save a snapshot to persistent storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
snapshot | SnapshotEnvelope<T> | The snapshot envelope to persist. |
Returns
Promise<void>
A promise that resolves when the write is complete.
Inherited from
saveWithMetadata()
saveWithMetadata(data): Promise<void>;Defined in: persistence/src/types.ts:211
Save a snapshot together with its metadata to persistent storage.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | PersistedSnapshot<T> | The snapshot and metadata bundle to persist. |
Returns
Promise<void>
A promise that resolves when the write is complete.
