import * as grpc from '@grpc/grpc-js'; import type { CouchbaseLogger } from '../logger'; /** * The part of a channel the connectivity log reads. * * @internal */ export interface WatchedChannel { /** * As grpc-js's; the log always passes false. */ getConnectivityState(tryToConnect: boolean): grpc.connectivityState; /** * As grpc-js's; the log always passes an infinite deadline. */ watchConnectivityState(currentState: grpc.connectivityState, deadline: Date | number, callback: (error?: Error) => void): void; } /** * What the connectivity log needs besides the channel. * * @internal */ export interface ConnectivityLogOptions { /** * The gateway's address, `host:port`. */ target: string; /** * When the most recent request began, on the `now` clock; undefined * before the first. */ lastActivity: () => number | undefined; /** * A clock in milliseconds. */ now?: () => number; } /** * Logs the channel's connection to the gateway as it changes, until the * channel shuts down. A healthy connection logs once, at info, when it first * connects. Losing a connection in use logs at info, since the next request * reconnects. Failing to connect logs at warn once per outage, including the * first failed reconnect after a lost connection, and connecting again logs * at info with how long it was down. Everything else is debug. * * The channel has one connection, so its state is that connection's. When * the connection closes the channel goes idle and reconnects on the next * call. It also goes idle after {@link CLIENT_IDLE_TIMEOUT_MS} with no call, * which is not an outage, so a channel that goes idle sooner than that after * the last request has lost its connection. * * The watch holds no timer, so it never keeps the process alive, and closing * the channel ends it. Nothing here asks the channel to connect. * * @internal */ export declare function watchConnectivity(channel: WatchedChannel, logger: CouchbaseLogger, options: ConnectivityLogOptions): void;