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

Method newToken

lib/metadata/index.js:389–400  ·  view source on GitHub ↗

* Constructs a Token from the input buffer(s) or string input. If a string is passed in * it is assumed this matches the token representation reported by cassandra. * @param {Array |Buffer|String} components * @returns {Token} constructed token from the input buffer.

(components)

Source from the content-addressed store, hash-verified

387 * @returns {Token} constructed token from the input buffer.
388 */
389 newToken(components) {
390 if (!this.tokenizer) {
391 throw new Error('Partitioner not established. This should only happen if metadata was disabled or you have not connected yet.');
392 }
393 if (Array.isArray(components)) {
394 return this.tokenizer.hash(Buffer.concat(components));
395 }
396 else if (typeof components === "string") {
397 return this.tokenizer.parse(components);
398 }
399 return this.tokenizer.hash(components);
400 }
401
402 /**
403 * Constructs a TokenRange from the given start and end tokens.

Callers

nothing calls this directly

Calls 2

hashMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected