AniLink - v3.0.0
    Preparing search index...

    Function snapshotTransportState

    • Builds a deep-frozen, point-in-time copy of one state owner's transport state, circuit-breaker scopes, retry-budget window, and rate-limit pacing deadlines, for monitoring and introspection.

      The snapshot is strictly read-only in both directions: it never aliases the live mutable state (consumers get frozen copies), and building it never mutates the state it observes. Reading does not create a circuit-state entry for an unseen host, does not roll an elapsed retry-budget window forward (a spent window is reported as spent), and does not clear a stale pacing deadline. Polling getTransportState on a schedule is safe alongside live traffic.

      Parameters

      • owner: object

        The stable per-client state owner threaded through the provider wiring (exposed on the stateOwners field of ProviderClients).

      • OptionalresponseCache: { stats(): ResponseCacheStats }

        The client's configured response cache, when one is enabled, contributing the frozen responseCache counters to the snapshot.

      Returns TransportStateSnapshot

      A deep-frozen TransportStateSnapshot of the owner's recorded state, stamped with the build time in capturedAt.

      const state = aniLink.getTransportState();
      for (const breaker of state.anilist.circuit) {
      console.log(breaker.host, breaker.openedAt === null ? "closed" : "open");
      }