The interface that defines how to store and fetch data associated with a message.

interface DataStore {
    clear(): Promise<void>;
    close(): Promise<void>;
    delete(tenant, recordId, dataCid): Promise<void>;
    get(tenant, recordId, dataCid): Promise<undefined | DataStoreGetResult>;
    open(): Promise<void>;
    put(tenant, recordId, dataCid, dataStream): Promise<DataStorePutResult>;
}

Implemented by

Methods

  • Clears the entire store. Mainly used for testing to cleaning up in test environments.

    Returns Promise<void>

  • Deletes the specified data. No-op if the data does not exist.

    Parameters

    • tenant: string
    • recordId: string

      The logical ID of the record that references the data.

    • dataCid: string

      The IPFS CID of the data.

    Returns Promise<void>

  • Fetches the specified data.

    Parameters

    • tenant: string
    • recordId: string

      The logical ID of the record that references the data.

    • dataCid: string

      The IPFS CID of the data.

    Returns Promise<undefined | DataStoreGetResult>

    the data size and data stream if found, otherwise undefined.

  • Stores the given data.

    Parameters

    • tenant: string
    • recordId: string

      The logical ID of the record that references the data.

    • dataCid: string

      The IPFS CID of the data.

    • dataStream: Readable

    Returns Promise<DataStorePutResult>