Automerge Repo - v2.3.0-alpha.0
    Preparing search index...

    Interface StorageAdapterInterface

    A storage adapter represents some way of storing binary data for a Repo

    StorageAdapters provide a key/value storage interface. The keys are arrays of strings (StorageKey) and the values are binary blobs.

    interface StorageAdapterInterface {
        load(key: StorageKey): Promise<undefined | Uint8Array<ArrayBufferLike>>;
        loadRange(keyPrefix: StorageKey): Promise<Chunk[]>;
        remove(key: StorageKey): Promise<void>;
        removeRange(keyPrefix: StorageKey): Promise<void>;
        save(key: StorageKey, data: Uint8Array): Promise<void>;
    }

    Implemented by

    Index

    Methods

    • Load all values with keys that start with keyPrefix.

      Parameters

      Returns Promise<Chunk[]>

      The keyprefix will match any key that starts with the given array. For example:

      • [documentId, "incremental"] will match all incremental saves
      • [documentId] will match all data for a given document.

      Be careful! [documentId] would also match something like [documentId, "syncState"]! We aren't using this yet but keep it in mind.)