StorageAdapter contract — minimum surface a backing store must provide to be a persistedInput sink.

Sync-only by design (#119): hydration must run before the first commit. The engine's only mutation API is graph.commit, which advances time by exactly one per call; there is no fractional time and no concurrent-mutation API. Hydration therefore must produce a fully-loaded initial value before the first commit runs, or that commit would be observing a half-loaded snapshot. Async stores (chrome.storage, IndexedDB) wrap a sync hot cache; the hot cache implements this interface.

interface StorageAdapter {
    delete(key: string): void;
    get(key: string): null | string;
    set(key: string, value: string): void;
}

Methods

Methods

  • Parameters

    • key: string

    Returns void

  • Parameters

    • key: string

    Returns null | string

  • Persist value under key. Must throw on write failure (quota exhaustion, Safari private-mode, disk-full, …) rather than swallow it. persistedInput's write path only dispatches a { kind: 'quota' } PersistenceError when this throws, so an adapter that silently drops failures makes persistence failures unobservable — violating the §9 observability contract (#130). A successful set returns normally.

    Parameters

    • key: string
    • value: string

    Returns void