Whether this store is still holdable, or has been given to a ladder.
Adds a record to the end of the buffer: bytes, or text such as a reading written out.
Drains the buffer onto a transport, publishing each record to topic,
oldest first, and resolves with how many went out.
Each record leaves the buffer only once the transport has taken it, so a send that fails rejects with the transport's error and leaves that record and every one after it buffered, in order, for the next drain. The transport is driven, not consumed.
How many records the buffer holds.
Reads the oldest record without removing it, or null when empty.
Reads the oldest record as text without removing it, or null when empty.
Throws if the record is not UTF-8 text.
Removes and returns the oldest record, or null when empty.
Removes and returns the oldest record as text, or null when empty.
Throws if the record is not UTF-8 text.
StaticfileOpens a buffer backed by a directory, so it survives a restart.
A record a power cut interrupted mid-write is never seen, and one written before the cut is found again when the directory is reopened.
the directory to hold records in; it is created if missing.
Optionalcapacity: number | null
the most records to hold, or omitted for no bound. A full store refuses the next append, which keeps a long outage from filling the disk.
StaticmemoryCreates a buffer held in memory.
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.
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.