Spaces:
Runtime error
Runtime error
File size: 4,545 Bytes
9756872 | 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 | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerHeartbeatFailedEvent = exports.ServerHeartbeatSucceededEvent = exports.ServerHeartbeatStartedEvent = exports.TopologyClosedEvent = exports.TopologyOpeningEvent = exports.TopologyDescriptionChangedEvent = exports.ServerClosedEvent = exports.ServerOpeningEvent = exports.ServerDescriptionChangedEvent = void 0;
const constants_1 = require("../constants");
/**
* Emitted when server description changes, but does NOT include changes to the RTT.
* @public
* @category Event
*/
class ServerDescriptionChangedEvent {
/** @internal */
constructor(topologyId, address, previousDescription, newDescription) {
this.name = constants_1.SERVER_DESCRIPTION_CHANGED;
this.topologyId = topologyId;
this.address = address;
this.previousDescription = previousDescription;
this.newDescription = newDescription;
}
}
exports.ServerDescriptionChangedEvent = ServerDescriptionChangedEvent;
/**
* Emitted when server is initialized.
* @public
* @category Event
*/
class ServerOpeningEvent {
/** @internal */
constructor(topologyId, address) {
/** @internal */
this.name = constants_1.SERVER_OPENING;
this.topologyId = topologyId;
this.address = address;
}
}
exports.ServerOpeningEvent = ServerOpeningEvent;
/**
* Emitted when server is closed.
* @public
* @category Event
*/
class ServerClosedEvent {
/** @internal */
constructor(topologyId, address) {
/** @internal */
this.name = constants_1.SERVER_CLOSED;
this.topologyId = topologyId;
this.address = address;
}
}
exports.ServerClosedEvent = ServerClosedEvent;
/**
* Emitted when topology description changes.
* @public
* @category Event
*/
class TopologyDescriptionChangedEvent {
/** @internal */
constructor(topologyId, previousDescription, newDescription) {
/** @internal */
this.name = constants_1.TOPOLOGY_DESCRIPTION_CHANGED;
this.topologyId = topologyId;
this.previousDescription = previousDescription;
this.newDescription = newDescription;
}
}
exports.TopologyDescriptionChangedEvent = TopologyDescriptionChangedEvent;
/**
* Emitted when topology is initialized.
* @public
* @category Event
*/
class TopologyOpeningEvent {
/** @internal */
constructor(topologyId) {
/** @internal */
this.name = constants_1.TOPOLOGY_OPENING;
this.topologyId = topologyId;
}
}
exports.TopologyOpeningEvent = TopologyOpeningEvent;
/**
* Emitted when topology is closed.
* @public
* @category Event
*/
class TopologyClosedEvent {
/** @internal */
constructor(topologyId) {
/** @internal */
this.name = constants_1.TOPOLOGY_CLOSED;
this.topologyId = topologyId;
}
}
exports.TopologyClosedEvent = TopologyClosedEvent;
/**
* 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
*/
class ServerHeartbeatStartedEvent {
/** @internal */
constructor(connectionId, awaited) {
/** @internal */
this.name = constants_1.SERVER_HEARTBEAT_STARTED;
this.connectionId = connectionId;
this.awaited = awaited;
}
}
exports.ServerHeartbeatStartedEvent = ServerHeartbeatStartedEvent;
/**
* Emitted when the server monitor’s hello succeeds.
* @public
* @category Event
*/
class ServerHeartbeatSucceededEvent {
/** @internal */
constructor(connectionId, duration, reply, awaited) {
/** @internal */
this.name = constants_1.SERVER_HEARTBEAT_SUCCEEDED;
this.connectionId = connectionId;
this.duration = duration;
this.reply = reply ?? {};
this.awaited = awaited;
}
}
exports.ServerHeartbeatSucceededEvent = ServerHeartbeatSucceededEvent;
/**
* Emitted when the server monitor’s hello fails, either with an “ok: 0” or a socket exception.
* @public
* @category Event
*/
class ServerHeartbeatFailedEvent {
/** @internal */
constructor(connectionId, duration, failure, awaited) {
/** @internal */
this.name = constants_1.SERVER_HEARTBEAT_FAILED;
this.connectionId = connectionId;
this.duration = duration;
this.failure = failure;
this.awaited = awaited;
}
}
exports.ServerHeartbeatFailedEvent = ServerHeartbeatFailedEvent;
//# sourceMappingURL=events.js.map |