/// import * as grpc from '@grpc/grpc-js'; import { inspect } from 'util'; import type { Authenticator } from '../authenticators'; import type { ImplementedBackend } from '../backends'; import type { WaitUntilReadyOptions } from '../diagnosticstypes'; import type { CouchbaseLogger } from '../logger'; import type { ObservableRequestHandler } from '../observabilityhandler'; import { Couchbase2Buckets } from './buckets'; import { Couchbase2Collections } from './collections'; import { Couchbase2Kv } from './kv'; import { Couchbase2Query } from './query'; import { Couchbase2QueryIndexes } from './queryindexes'; import { Couchbase2Op, RequestContext } from './requestcontext'; import { Couchbase2Search } from './search'; import { Couchbase2SearchIndexes } from './searchindexes'; import { OpenStreams } from './streaming'; /** * The health check behind `waitUntilReady`. It changes nothing, so it may * be sent any number of times. * * @internal */ export declare const WAIT_UNTIL_READY: Couchbase2Op; /** * What a couchbase2 cluster is built from. * * @internal */ export interface Couchbase2BackendOptions { /** * The `couchbase2://` connection string. */ connStr: string; /** * The cluster's authenticator. */ auth: Authenticator | undefined; /** * The cluster's trust store, which wins over the connection string's. */ trustStorePath?: string; /** * Where the connection's warnings and each retry are logged. */ logger: CouchbaseLogger; /** * The timeout of a query that does not set its own, in milliseconds; the * cluster's default when unset. */ queryTimeout?: number; /** * The timeout of a search that does not set its own, in milliseconds; * the cluster's default when unset. */ searchTimeout?: number; /** * The cluster options that were set and that a couchbase2 connection does * not use, by name. */ ignoredConnectOptions?: string[]; /** * The cluster's `logRedaction` option, which wins over the connection * string's. */ logRedaction?: boolean; } /** * A couchbase2 cluster's connection: the channel to the gateway, the * metadata every call carries, the streams open on it, and whether it has * been closed. * * Nothing is sent at construction. The channel connects on the first call * and reconnects for as long as it is open, so readiness is only ever * checked by {@link waitUntilReady}. * * @internal */ export declare class Couchbase2Backend implements ImplementedBackend { /** * The gateway's address, `host:port`. */ readonly target: string; /** * The metadata every call carries. */ readonly metadata: grpc.Metadata; /** * The streams open on the channel, canceled when it closes. */ readonly streams: OpenStreams; /** * The timeout of a query that does not set its own, in milliseconds. */ readonly queryTimeout: number; /** * The timeout of a search that does not set its own, in milliseconds. */ readonly searchTimeout: number; /** * Key-value operations. */ readonly kv: Couchbase2Kv; /** * SQL++ queries. */ readonly query: Couchbase2Query; /** * Searches. */ readonly search: Couchbase2Search; /** * Bucket management. */ readonly buckets: Couchbase2Buckets; /** * Scope and collection management. */ readonly collections: Couchbase2Collections; /** * Query index management. */ readonly queryIndexes: Couchbase2QueryIndexes; /** * Search index management. */ readonly searchIndexes: Couchbase2SearchIndexes; private readonly _channel; private readonly _address; private readonly _logger; private readonly _health; private readonly _authKind; private readonly _unrecognized; private _lastActivity; private _closed; /** * Reads the connection string and opens the channel. A connection string * or a TLS setting that cannot be used throws `InvalidArgumentError`. * Options that are read and not used are logged once, at warn, and how * the channel connects is logged at info. */ constructor(options: Couchbase2BackendOptions); /** * Whether {@link Couchbase2Backend.close} has been called. */ get closed(): boolean; /** * A new request's context, which cancels the request if the cluster * closes while it waits to retry. Each attempt is traced under `obs` * when it is given. */ context(op: Couchbase2Op, timeoutMs: number, obs?: ObservableRequestHandler | null): RequestContext; /** * Logs a failure value the SDK has no mapping for, once per value for the * life of the cluster. */ private _warnUnrecognized; /** * Waits until the gateway answers its health check with `SERVING`, * retrying for as long as it is unreachable or answers anything else. The * gateway's health covers the whole cluster, so `options` has no services * or state to narrow it to. */ waitUntilReady(timeout: number, _options?: WaitUntilReadyOptions): Promise; /** * The gateway's address alone. The rest holds the channel, which does not * serialize, and the metadata, which carries the credentials. */ toJSON(): Record; /** * As `toJSON`. */ [inspect.custom](): Record; /** * Sends the new password or JWT on every call made from now on. The * channel is not reconnected: a client certificate is presented only when * it connects, so a certificate cannot be replaced, and an authenticator * of another kind is refused. */ updateCredentials(auth: Authenticator): void; /** * Cancels every open stream, then closes the channel. A request waiting * to retry ends with `RequestCanceledError`. Closing again does nothing. */ close(): Promise; }