bothy-sdk
    Preparing search index...

    Class FileOutboxStore

    The durable outbox store: one JSON file of mode 0600, usually <state_dir>/outbox.json.

    Its directory is created with mode 0700 when missing. Every change writes a temporary file of mode 0600 next to it, flushes it to disk, renames it over the store and flushes the directory, so add returns only after the entry survives a crash. An existing file must be a regular file (no symbolic link) without group or other permissions. Operations run one after another; one process uses one store file.

    const outbox = new Outbox(api, { store: new FileOutboxStore("/var/lib/lotse/outbox.json") });
    await outbox.flush(); // at the start: what a previous process left pending goes out now

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Creates the store; the file is read on first use.

      Parameters

      • path: string

        The store file.

      Returns FileOutboxStore

    Properties

    path: string

    The store file.

    Methods

    • Stores entry durably and returns it with its entryId.

      Parameters

      Returns Promise<OutboxEntry>

      The stored entry.

      Error when the key is already stored or the file cannot be read or written.

    • Waits for the operations in flight and drops the cached state; a later call reads again.

      Returns Promise<void>

    • Changes the state of an entry durably; sent deletes it.

      Parameters

      • entryId: number

        The entry.

      • state: OutboxState

        The new state.

      • OptionalproblemCode: string

        The problem code of a failed entry.

      Returns Promise<void>

    • Returns the pending entries in order.

      Returns Promise<OutboxEntry[]>

      The entries.

      Error when the file cannot be read or is shared with others.