Class BaseStoreAbstract

Abstract base class for key-value stores.

Hierarchy (view full)

Constructors

Methods

  • Execute a batch of operations.

    Type Parameters

    Parameters

    • _operations: Op

      An array of operations to execute.

    Returns Promise<OperationResults<Op>>

    A promise that resolves to the results of the operations.

  • Delete an item.

    Parameters

    • namespace: string[]

      Hierarchical path for the item.

    • key: string

      Unique identifier within the namespace.

    Returns Promise<void>

  • Retrieve a single item.

    Parameters

    • namespace: string[]

      Hierarchical path for the item.

    • key: string

      Unique identifier within the namespace.

    Returns Promise<null | Item>

    A promise that resolves to the retrieved item or null if not found.

  • List and filter namespaces in the store.

    Parameters

    • options: {
          limit?: number;
          maxDepth?: number;
          offset?: number;
          prefix?: string[];
          suffix?: string[];
      }

      Options for listing namespaces.

      • Optional limit?: number

        Maximum number of namespaces to return (default 100).

      • Optional maxDepth?: number

        Return namespaces up to this depth in the hierarchy.

      • Optional offset?: number

        Number of namespaces to skip for pagination (default 0).

      • Optional prefix?: string[]

        Filter namespaces that start with this path.

      • Optional suffix?: string[]

        Filter namespaces that end with this path.

    Returns Promise<string[][]>

    A promise that resolves to a list of namespace arrays that match the criteria.

  • Store or update an item.

    Parameters

    • namespace: string[]

      Hierarchical path for the item.

    • key: string

      Unique identifier within the namespace.

    • value: Record<string, any>

      Object containing the item's data.

    Returns Promise<void>

  • Search for items within a namespace prefix.

    Parameters

    • namespacePrefix: string[]

      Hierarchical path prefix to search within.

    • Optional options: {
          filter?: Record<string, any>;
          limit?: number;
          offset?: number;
      }

      Search options.

      • Optional filter?: Record<string, any>

        Key-value pairs to filter results.

      • Optional limit?: number

        Maximum number of items to return (default: 10).

      • Optional offset?: number

        Number of items to skip before returning results (default: 0).

    Returns Promise<Item[]>

    A promise that resolves to a list of items matching the search criteria.

  • Start the store. No-op if not implemented.

    Returns void

  • Stop the store. No-op if not implemented.

    Returns void