reticulum-js
    Preparing search index...

    Class Persistor

    Coordinates selective persistence of learned peers, ratchet rings and path entries across restarts.

    Index
    _flushTimer: Timeout | null
    adapter: StorageAdapter | null
    debounceMs: number
    knownDestinations: Map<string, any[]>
    knownRatchets: Map<string, Uint8Array<ArrayBufferLike>[]>
    persistedDestinations: Set<string>

    Hex destination hashes slated for persistence — communicated-with OR explicitly favorited.

    routingTable: { routes: Map<string, any> } | null
    • Writes every persisted destination's identity, ratchet ring and path entry to the adapter now, cancelling any pending debounced flush. No-op when disabled.

      Returns Promise<void>

    • Hydrates the in-memory maps from the adapter and rebuilds the persisted set. Call once at startup. Corrupt records are skipped with a warning.

      Returns Promise<void>

    • Marks a destination as communicated-with and schedules a debounced flush. Called by the transport layer at real send/receive points.

      Parameters

      • destinationHash: string | Uint8Array<ArrayBufferLike>

      Returns void

    • Explicitly persists a destination (e.g. a favorited contact), regardless of whether we have communicated with it.

      If the destination has already been learned from a heard announce, its current identity/ratchet/path state is written immediately. To persist a peer that has not been learned yet — or to refresh from a specific announce — pass announce; it accepts a transport announce event's detail object directly (see StorableAnnounce).

      Flushes immediately so the favorite survives an ungraceful crash.

      Parameters

      • destinationHash: string | Uint8Array<ArrayBufferLike>
      • Optionaloptions: { announce?: StorableAnnounce } = {}

      Returns Promise<void>