pamoja for TypeScript - v0.1.17
    Preparing search index...

    Class Store

    A store-and-forward buffer.

    Handing a store to a ladder consumes it, because the ladder owns it from then on. A consumed store is emptied rather than left aliasing what now belongs to the ladder, so using one twice throws.

    Index
    • get isAvailable(): boolean

      Whether this store is still holdable, or has been given to a ladder.

      Returns boolean

    • Adds a record to the end of the buffer.

      Parameters

      • record: Buffer

      Returns Promise<void>

    • How many records the buffer holds.

      Returns Promise<number>

    • Reads the oldest record without removing it, or null when empty.

      Returns Promise<Buffer<ArrayBufferLike> | null>

    • Removes and returns the oldest record, or null when empty.

      Returns Promise<Buffer<ArrayBufferLike> | null>

    • Opens a buffer backed by a directory, so it survives a restart.

      Parameters

      • dir: string

        the directory to hold records in; it is created if missing.

      Returns Store

    • Creates a buffer held in memory.

      Parameters

      • Optionalcapacity: number | null

        the most records to hold, or omitted for no bound. A full store refuses the next append rather than dropping anything, so a record is never lost without the caller being told.

      Returns Store