Interface DBStorage

Store data in the database.

Usually this don't need to be implemented or even cared: hardcoded default values should be enough.

When implementing, note that any function may be called concurrently. Locks may be needed. Paths can be used directly as filesystem paths, where the main database name and the keys in the path to the subdatabase form the components in the path. E.g. a subdatabase main.10.circle would be of path main/10/circle

interface DBStorage {
    read(name): MaybePromise<{
        [key: string | number]: unknown;
    }>;
    write(name, data): MaybePromise<void>;
}

Methods

Methods

  • Read from the path

    Parameters

    • name: string

    Returns MaybePromise<{
        [key: string | number]: unknown;
    }>

    the data in the database of the path

  • Write to the path

    Parameters

    • name: string
    • data: {
          [key: string | number]: unknown;
      }
      • [key: string | number]: unknown

    Returns MaybePromise<void>

Generated using TypeDoc