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

Function concatRoutingKey

lib/encoder.js:2133–2152  ·  view source on GitHub ↗

* @param {Array. } parts * @param {Number} totalLength * @returns {Buffer} * @private

(parts, totalLength)

Source from the content-addressed store, hash-verified

2131 * @private
2132 */
2133function concatRoutingKey(parts, totalLength) {
2134 if (totalLength === 0) {
2135 return null;
2136 }
2137 if (parts.length === 1) {
2138 return parts[0];
2139 }
2140 const routingKey = utils.allocBufferUnsafe(totalLength);
2141 let offset = 0;
2142 for (let i = 0; i < parts.length; i++) {
2143 const item = parts[i];
2144 routingKey.writeUInt16BE(item.length, offset);
2145 offset += 2;
2146 item.copy(routingKey, offset);
2147 offset += item.length;
2148 routingKey[offset] = 0;
2149 offset++;
2150 }
2151 return routingKey;
2152}
2153
2154function invertObject(obj) {
2155 const rv = {};

Callers 1

defineInstanceMembersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected