reticulum-js
    Preparing search index...

    In-memory blob store. Implements the same surface as the Rust BlobStore so a filesystem adapter can drop in for production use.

    Index
    _blobs: Map<string, Uint8Array<ArrayBufferLike>>
    _lastEviction: number
    _meta: Map<string, BlobMeta>
    storageLimitBytes: number
    usedBytes: number
    • Evicts every blob whose received timestamp predates cutoff.

      Parameters

      • cutoff: number

        Unix seconds.

      Returns number

      count evicted.

    • Evicts the oldest blobs (by received) until neededBytes fit under the capacity limit.

      Parameters

      • neededBytes: number

      Returns void

    • Deletes a blob by message id.

      Parameters

      • messageId: Uint8Array<ArrayBufferLike>

      Returns boolean

      true if a blob was removed.

    • Exports the full store as serializable records (msgpack-friendly). Used by the @reticulum/node FS adapter to persist blobs across restarts.

      Returns {
          blob: Uint8Array;
          channelHash: Uint8Array;
          messageId: Uint8Array;
          received: number;
      }[]

    • Reads a blob by message id.

      Parameters

      • messageId: Uint8Array<ArrayBufferLike>

      Returns Uint8Array<ArrayBufferLike> | null

    • Replaces the store contents with the given records (direct population, bypassing eviction — used on load). Clears any existing data first.

      Parameters

      • records: {
            blob: Uint8Array;
            channelHash: Uint8Array;
            messageId: Uint8Array;
            received: number;
        }[]

      Returns void

    • The full store manifest as [channelHash, messageId] pairs — served by /rfed/offer (Rust handle_offer) so a peer can compute its gap.

      Returns [Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>][]

    • All message ids stored under the given channel hash.

      Parameters

      • channelHash: Uint8Array<ArrayBufferLike>

      Returns Uint8Array<ArrayBufferLike>[]

    • Returns the { channelHash, messageId } metadata for a stored blob, or null if unknown. Used by /rfed/get to emit the §3 blob stream with the correct channel attribution.

      Parameters

      • messageId: Uint8Array<ArrayBufferLike>

      Returns { channelHash: Uint8Array; messageId: Uint8Array } | null

    • Prunes blobs older than maxAgeSec (SPEC §5: 30-day TTL). A runner calls this periodically (hourly) via RFedNode.tickMaintenance; the store also self-prunes opportunistically on each ingest.

      Parameters

      • maxAgeSec: number

      Returns number

      count evicted.

    • Stores a blob under a fresh random 16-byte message id.

      Parameters

      • destinationHash: Uint8Array<ArrayBufferLike>

        16-byte channel hash.

      • blob: Uint8Array<ArrayBufferLike>

        Raw inner blob (stamp already stripped).

      Returns Uint8Array<ArrayBufferLike>

      the assigned 16-byte message id.

    • Stores a blob under a caller-supplied message id. Idempotent when the same (messageId, destinationHash) pair is stored again (used by peer sync to preserve upstream ids); collides otherwise.

      Parameters

      • destinationHash: Uint8Array<ArrayBufferLike>
      • messageId: Uint8Array<ArrayBufferLike>
      • blob: Uint8Array<ArrayBufferLike>

      Returns Uint8Array<ArrayBufferLike>

      the message id.

      if messageId is already stored under a different channel.