import { Document, Long, ObjectId } from '../bson'; import type { MongoError } from '../error'; import { HostAddress } from '../utils'; import type { ClusterTime } from './common'; import { ServerType } from './common'; /** @public */ export interface TopologyVersion { processId: ObjectId; counter: Long; } /** @public */ export declare type TagSet = { [key: string]: string; }; /** @internal */ export interface ServerDescriptionOptions { /** An Error used for better reporting debugging */ error?: MongoError; /** The round trip time to ping this server (in ms) */ roundTripTime?: number; /** The topologyVersion */ topologyVersion?: TopologyVersion; /** If the client is in load balancing mode. */ loadBalanced?: boolean; } /** * The client's view of a single server, based on the most recent hello outcome. * * Internal type, not meant to be directly instantiated * @public */ export declare class ServerDescription { private _hostAddress; address: string; type: ServerType; hosts: string[]; passives: string[]; arbiters: string[]; tags: TagSet; error?: MongoError; topologyVersion?: TopologyVersion; minWireVersion: number; maxWireVersion: number; roundTripTime: number; lastUpdateTime: number; lastWriteDate: number; me?: string; primary?: string; setName?: string; setVersion?: number; electionId?: ObjectId; logicalSessionTimeoutMinutes?: number; $clusterTime?: ClusterTime; /** * Create a ServerDescription * @internal * * @param address - The address of the server * @param hello - An optional hello response for this server */ constructor(address: HostAddress | string, hello?: Document, options?: ServerDescriptionOptions); get hostAddress(): HostAddress; get allHosts(): string[]; /** Is this server available for reads*/ get isReadable(): boolean; /** Is this server data bearing */ get isDataBearing(): boolean; /** Is this server available for writes */ get isWritable(): boolean; get host(): string; get port(): number; /** * Determines if another `ServerDescription` is equal to this one per the rules defined * in the {@link https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#serverdescription|SDAM spec} */ equals(other: ServerDescription): boolean; } export declare function parseServerType(hello?: Document, options?: ServerDescriptionOptions): ServerType; /** * Compares two topology versions. * * @returns A negative number if `lhs` is older than `rhs`; positive if `lhs` is newer than `rhs`; 0 if they are equivalent. */ export declare function compareTopologyVersion(lhs?: TopologyVersion, rhs?: TopologyVersion): number; //# sourceMappingURL=server_description.d.ts.map