Class StorageManager

Storage interface for saving and loading Entitys from a StorageInterface.

The storage manager keeps track of the latest snapshots that have been loaded from storage so that it can delete old snapshots and update storage even in the presence of multiple concurrent readers / writers to the same data store.

Constructors

Properties

loadedChunks: Map<`leaf:${string}`, ChunkInfo[]> = ...

The chunks that we most-recently loaded from storage.

loadedFrontiers: Map<`leaf:${string}`, Frontiers> = ...

The heads that we most-recently loaded from storage.

The backing storage interface for this storage manager.

Methods

  • Load an entity from storage.

    If there is no data for the entity in storage this will leave the entity un-modified.

    If there is data in storage, it will be loaded and merged into this entity.

    Parameters

    • entity: Entity

      The entity to load data into.

    Returns Promise<boolean>

    Returns true if the entity was found in storage and false if it was not.

  • Persist an entity to storage.

    Parameters

    • entity: Entity

      The entity to save.

    Returns Promise<void>