MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / pop

Method pop

lib/stream-id-stack.js:98–116  ·  view source on GitHub ↗

* Dequeues an id. * Similar to Array#pop(). * @returns {Number} Returns an id or null

()

Source from the content-addressed store, hash-verified

96 * @returns {Number} Returns an id or null
97 */
98 pop() {
99 let id = this.currentGroup.pop();
100 if (typeof id !== 'undefined') {
101 this.inUse++;
102 return id;
103 }
104 //try to use the following groups
105 while (this.groupIndex < this.groups.length - 1) {
106 //move to the following group
107 this.currentGroup = this.groups[++this.groupIndex];
108 //try dequeue
109 id = this.currentGroup.pop();
110 if (typeof id !== 'undefined') {
111 this.inUse++;
112 return id;
113 }
114 }
115 return this._tryCreateGroup();
116 }
117
118 /**
119 * Enqueue an id for future use.

Callers 8

_getStreamIdMethod · 0.80
_tryCreateGroupMethod · 0.80
_releaseGroupsMethod · 0.80
test-helper.jsFile · 0.80
popFunction · 0.80
testQueriesFunction · 0.80
testQueriesFunction · 0.80

Calls 1

_tryCreateGroupMethod · 0.95

Tested by

no test coverage detected