Skip to content
Français

reserveRecoveryStorage

import { reserveRecoveryStorage } from "@elie-laloum/outpost";

Record reserveBytes in the repository’s reservation ledger when observed usage, active reservations and the request fit within maxBytes, and return the reservation. Refusal, an incomplete inventory, invalid options or a malformed ledger reject with code configuration. The entry counts until release() and never expires; Outpost has no call to clear an abandoned one.

Complete example and detailed rules.

  • optionsRequired
    RecoveryStorageReservationOptions
    Repository, byte limit, bytes to reserve, ledger transport, scan limit and cancellation.
  • options.repositoryOptional
    string | undefined
    Git checkout whose writers share the ledger, default process.cwd(), resolved to its top-level directory. Without transporter, its .outpost holds the ledger and is measured; a missing directory rejects with code workspace.
  • options.transporterOptional
    Transport | undefined
    Transport that stores reservations/ledger; the sizes of all its other objects count as usage. Default: createLocalTransport under .outpost/storage, with usage measured from the files under .outpost/recovery, logs, locks, workspaces and storage.
  • options.maxBytesRequired
    number
    Limit for observed usage plus active reservations plus this request, in bytes; above it, admission rejects with code configuration. Must be a non-negative safe integer.
  • options.reserveBytesRequired
    number
    Bytes this reservation holds in the ledger until it is released. Must be a non-negative safe integer.
  • options.maxEntriesOptional
    number | undefined
    Maximum files and directories scanned under .outpost, or objects listed from an explicit transporter, default 100000. Exceeding it rejects admission with code configuration.
  • options.signalOptional
    AbortSignal | undefined
    Cancels admission with the abort reason until the entry is written. release() ignores it.

Promise<StorageReservation>

export declare function reserveRecoveryStorage(
  options: RecoveryStorageReservationOptions,
): Promise<StorageReservation>;