Data packet storage based on LevelDB or other abstract-level compatible key-value database.

Create an instance with makeInMemoryDataStore or makePersistentDataStore.

Hierarchy

  • TypedEventTarget<EventMap>
    • DataStore

Implements

Properties

[kMaybeHaveEventListener]: Record<string, boolean> = ...
mutex: Mutex = ...

Methods

  • Close the store.

    Returns Promise<void>

  • Delete all expired records.

    Returns Promise<void>

  • List Data packets, optionally filtered by name prefix.

    Parameters

    • Optionalprefix: Name

    Returns AsyncIterable<Data, any, any>

  • List Data names, optionally filtered by name prefix.

    Parameters

    • Optionalprefix: Name

    Returns AsyncIterable<Name, any, any>

  • Create DataStore from an abstract-level opener function.

    Parameters

    • open: DbOpener

      Function that opens an abstract-level compatible key-value database with the given options.

    Returns Promise<DataStore>

  • Create DataStore from an abstract-level subclass constructor.

    Type Parameters

    • const A extends unknown[]
    • const O extends {}

    Parameters

    • ctor: DbCtor<A, O>

      Subclass of abstract-level that accepts options as its last parameter.

    • Rest...args: [...A[], O]

      ctor arguments; last should be options object.

    Returns Promise<DataStore>