@sudoplatform/sudo-secure-communications
    Preparing search index...

    Interface StorageProvider

    interface StorageProvider {
        matrixStore: IStore;
        closeDB(): Promise<void>;
        createItem(store: string, key: string, value: any): Promise<void>;
        deleteItem(store: string, key: string): Promise<void>;
        destroyDB(): Promise<void>;
        getItem<T>(store: string, key: string): Promise<T | undefined>;
        getItems<T>(
            store: string,
            key: string,
            limit?: number,
            offset?: number,
        ): Promise<T[]>;
        openDB(): Promise<void>;
        updateItem(store: string, key: string, value: any): Promise<void>;
    }
    Index

    Properties

    matrixStore: IStore

    matrixStore should be compatible with matrix-js-sdk:IStore and should be used as store for initializing the matrix client

    Methods

    • Close the database.

      Returns Promise<void>

    • Create an item in the database.

      Parameters

      • store: string

        The store to create the item in.

      • key: string

        The key of the item to create.

      • value: any

        The value of the item to create.

      Returns Promise<void>

    • Delete an item from the database.

      Parameters

      • store: string

        The store to delete the item from.

      • key: string

        The key of the item to delete.

      Returns Promise<void>

    • Destroy the database.

      Returns Promise<void>

    • Get an item from the database.

      Should be used when the value is expected to be a single item.

      Type Parameters

      • T

      Parameters

      • store: string

        The store to get the item from.

      • key: string

        The key of the item to get.

      Returns Promise<T | undefined>

      The item from the database.

    • Get items from the database.

      Should be used when the value is expected to be an array.

      Type Parameters

      • T

      Parameters

      • store: string

        The store to get the items from.

      • key: string

        The key of the item to get.

      • Optionallimit: number

        (optional) Number of items to get.

      • Optionaloffset: number

        (optional) Start index of the items to get.

      Returns Promise<T[]>

      The items from the database.

    • Open the database.

      Returns Promise<void>

    • Update an item in the database.

      Parameters

      • store: string

        The store to update the item in.

      • key: string

        The key of the item to update.

      • value: any

        The value of the item to update.

      Returns Promise<void>