MCPcopy
hub / github.com/mongodb/node-mongodb-native / constructor

Method constructor

src/sessions.ts:1050–1064  ·  view source on GitHub ↗

@internal

(cloned?: ServerSession | null)

Source from the content-addressed store, hash-verified

1048
1049 /** @internal */
1050 constructor(cloned?: ServerSession | null) {
1051 if (cloned != null) {
1052 const idBytes = ByteUtils.allocateUnsafe(16);
1053 idBytes.set(cloned.id.id.buffer);
1054 this.id = { id: new Binary(idBytes, cloned.id.id.sub_type) };
1055 this.lastUse = cloned.lastUse;
1056 this.txnNumber = cloned.txnNumber;
1057 this.isDirty = cloned.isDirty;
1058 return;
1059 }
1060 this.id = { id: new Binary(uuidV4(), Binary.SUBTYPE_UUID) };
1061 this.lastUse = processTimeMS();
1062 this.txnNumber = 0;
1063 this.isDirty = false;
1064 }
1065
1066 /**
1067 * Determines if the server session has timed out.

Callers

nothing calls this directly

Calls 3

uuidV4Function · 0.90
processTimeMSFunction · 0.90
setMethod · 0.80

Tested by

no test coverage detected