Creates the store; the directory is opened on the first call.
The inbox directory, usually inbox in the adapter's state directory.
Stores a new entry; durable when this resolves.
The entry.
A promise that resolves when written.
Waits for pending writes and refuses later calls; closing twice is harmless.
A promise that resolves when every pending write ended.
Returns the entries of a run in seq order (ephemeral entries last, in arrival order).
The run.
The entries.
Returns the entry of eventId.
The envelope id.
The entry, or undefined.
Returns the entries in one of states in seq order (ephemeral entries last, in arrival
order).
The states asked for.
The entries.
Counts a redelivery; see InboxStore.redelivered. Durable when this resolves.
The envelope id.
The token of the redelivery, if any.
Its iat.
Its jti.
The entry after the update.
Remembers jti until untilMs (an earlier end never shortens a later one); durable when
this resolves.
The token ID.
When the token cannot pass anymore (exp plus the leeway).
A promise that resolves when written.
Replaces the token unconditionally; durable when this resolves.
The envelope id.
The granted token.
Its iat.
Its jti.
A promise that resolves when written.
Sets the state of an entry; durable when this resolves.
The envelope id.
The new state.
A promise that resolves when written.
The durable InboxStore: one JSON file per entry in a directory of mode
0700, each file of mode0600, written to a temporary file, synced and renamed into place, so an entry is either the old or the new one after a crash. Thejtistore lives in the same directory.A file holds the event without
invocation_token, the newest token, itsiatandjti, the state, the delivery count and the arrival order; nothing else. The token is stored because the directory is the adapter's durable acceptance (docs/DECISIONS.md D-M2-29-9); it is never logged. One store object owns a directory: it reads the files once and keeps them in memory, and every write is durable when its promise resolves.The directory is created on first use; an existing directory or file that group or others can access, or a symbolic link in its place, is refused.
Example