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>

  • 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.

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

      ctor arguments; last should be options object.

    Returns Promise<DataStore>