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

Method _tryCreateGroup

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

* Tries to create an additional group and returns a new id * @returns {Number} Returns a new id or null if it's not possible to create a new group * @private

()

Source from the content-addressed store, hash-verified

149 * @private
150 */
151 _tryCreateGroup() {
152 if (this.groups.length === this.maxGroups) {
153 //we can have an additional group
154 return null;
155 }
156 //Add a new group at the last position
157 this.groupIndex = this.groups.length;
158 //Using 128 * groupIndex as initial value
159 this.currentGroup = generateGroup(this.groupIndex << shiftToGroup);
160 this.groups.push(this.currentGroup);
161 this.inUse++;
162 return this.currentGroup.pop();
163 }
164
165 _tryIssueRelease() {
166 if (this.releaseTimeout || this.groups.length <= releasableSize) {

Callers 1

popMethod · 0.95

Calls 3

generateGroupFunction · 0.85
popMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected