Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | 404x 404x 3323924x 3323924x 3323924x 3323924x 3323924x 404x 3217820x 3217820x 3217820x 404x 3217332x 3217332x 3217332x 404x 5226234x 5226234x 5226234x 5226234x 404x 1893808x 1893808x 404x 1893652x 1893652x 404x 3381961x 3381961x 3381961x 404x 3213883x 3213883x 3213883x 3213883x 3213883x 404x 162483x 162483x 162483x 162483x 162483x | import type { Document } from '../bson';
import {
SERVER_CLOSED,
SERVER_DESCRIPTION_CHANGED,
SERVER_HEARTBEAT_FAILED,
SERVER_HEARTBEAT_STARTED,
SERVER_HEARTBEAT_SUCCEEDED,
SERVER_OPENING,
TOPOLOGY_CLOSED,
TOPOLOGY_DESCRIPTION_CHANGED,
TOPOLOGY_OPENING
} from '../constants';
import type { ServerDescription } from './server_description';
import type { TopologyDescription } from './topology_description';
/**
* Emitted when server description changes, but does NOT include changes to the RTT.
* @public
* @category Event
*/
export class ServerDescriptionChangedEvent {
/** A unique identifier for the topology */
topologyId: number;
/** The address (host/port pair) of the server */
address: string;
/** The previous server description */
previousDescription: ServerDescription;
/** The new server description */
newDescription: ServerDescription;
name = SERVER_DESCRIPTION_CHANGED;
/** @internal */
constructor(
topologyId: number,
address: string,
previousDescription: ServerDescription,
newDescription: ServerDescription
) {
this.topologyId = topologyId;
this.address = address;
this.previousDescription = previousDescription;
this.newDescription = newDescription;
}
}
/**
* Emitted when server is initialized.
* @public
* @category Event
*/
export class ServerOpeningEvent {
/** A unique identifier for the topology */
topologyId: number;
/** The address (host/port pair) of the server */
address: string;
/** @internal */
name = SERVER_OPENING;
/** @internal */
constructor(topologyId: number, address: string) {
this.topologyId = topologyId;
this.address = address;
}
}
/**
* Emitted when server is closed.
* @public
* @category Event
*/
export class ServerClosedEvent {
/** A unique identifier for the topology */
topologyId: number;
/** The address (host/port pair) of the server */
address: string;
/** @internal */
name = SERVER_CLOSED;
/** @internal */
constructor(topologyId: number, address: string) {
this.topologyId = topologyId;
this.address = address;
}
}
/**
* Emitted when topology description changes.
* @public
* @category Event
*/
export class TopologyDescriptionChangedEvent {
/** A unique identifier for the topology */
topologyId: number;
/** The old topology description */
previousDescription: TopologyDescription;
/** The new topology description */
newDescription: TopologyDescription;
/** @internal */
name = TOPOLOGY_DESCRIPTION_CHANGED;
/** @internal */
constructor(
topologyId: number,
previousDescription: TopologyDescription,
newDescription: TopologyDescription
) {
this.topologyId = topologyId;
this.previousDescription = previousDescription;
this.newDescription = newDescription;
}
}
/**
* Emitted when topology is initialized.
* @public
* @category Event
*/
export class TopologyOpeningEvent {
/** A unique identifier for the topology */
topologyId: number;
/** @internal */
name = TOPOLOGY_OPENING;
/** @internal */
constructor(topologyId: number) {
this.topologyId = topologyId;
}
}
/**
* Emitted when topology is closed.
* @public
* @category Event
*/
export class TopologyClosedEvent {
/** A unique identifier for the topology */
topologyId: number;
/** @internal */
name = TOPOLOGY_CLOSED;
/** @internal */
constructor(topologyId: number) {
this.topologyId = topologyId;
}
}
/**
* Emitted when the server monitor’s hello command is started - immediately before
* the hello command is serialized into raw BSON and written to the socket.
*
* @public
* @category Event
*/
export class ServerHeartbeatStartedEvent {
/** The connection id for the command */
connectionId: string;
/** Is true when using the streaming protocol */
awaited: boolean;
/** @internal */
name = SERVER_HEARTBEAT_STARTED;
/** @internal */
constructor(connectionId: string, awaited: boolean) {
this.connectionId = connectionId;
this.awaited = awaited;
}
}
/**
* Emitted when the server monitor’s hello succeeds.
* @public
* @category Event
*/
export class ServerHeartbeatSucceededEvent {
/** The connection id for the command */
connectionId: string;
/** The execution time of the event in ms */
duration: number;
/** The command reply */
reply: Document;
/** Is true when using the streaming protocol */
awaited: boolean;
/** @internal */
name = SERVER_HEARTBEAT_SUCCEEDED;
/** @internal */
constructor(connectionId: string, duration: number, reply: Document | null, awaited: boolean) {
this.connectionId = connectionId;
this.duration = duration;
this.reply = reply ?? {};
this.awaited = awaited;
}
}
/**
* Emitted when the server monitor’s hello fails, either with an “ok: 0” or a socket exception.
* @public
* @category Event
*/
export class ServerHeartbeatFailedEvent {
/** The connection id for the command */
connectionId: string;
/** The execution time of the event in ms */
duration: number;
/** The command failure */
failure: Error;
/** Is true when using the streaming protocol */
awaited: boolean;
/** @internal */
name = SERVER_HEARTBEAT_FAILED;
/** @internal */
constructor(connectionId: string, duration: number, failure: Error, awaited: boolean) {
this.connectionId = connectionId;
this.duration = duration;
this.failure = failure;
this.awaited = awaited;
}
}
|