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

Class Metadata

lib/metadata/index.js:74–934  ·  view source on GitHub ↗

* Represents cluster and schema information. * The metadata class acts as a internal state of the driver.

Source from the content-addressed store, hash-verified

72 * The metadata class acts as a internal state of the driver.
73 */
74class Metadata {
75
76 /**
77 * Creates a new instance of {@link Metadata}.
78 * @param {ClientOptions} options
79 * @param {ControlConnection} controlConnection Control connection used to retrieve information.
80 */
81 constructor(options, controlConnection) {
82 if (!options) {
83 throw new errors.ArgumentError('Options are not defined');
84 }
85
86 Object.defineProperty(this, 'options', { value: options, enumerable: false, writable: false });
87 Object.defineProperty(this, 'controlConnection', { value: controlConnection, enumerable: false, writable: false });
88 this.keyspaces = {};
89 this.initialized = false;
90 this._isDbaas = false;
91 this._schemaParser = schemaParserFactory.getByVersion(options, controlConnection, this.getUdt.bind(this));
92 this.log = utils.log;
93 this._preparedQueries = new PreparedQueries(options.maxPrepared, (...args) => this.log(...args));
94 }
95
96 /**
97 * Sets the cassandra version
98 * @internal
99 * @ignore
100 * @param {Array.<Number>} version
101 */
102 setCassandraVersion(version) {
103 this._schemaParser = schemaParserFactory.getByVersion(
104 this.options, this.controlConnection, this.getUdt.bind(this), version, this._schemaParser);
105 }
106
107 /**
108 * Determines whether the cluster is provided as a service.
109 * @returns {boolean} true when the cluster is provided as a service (DataStax Astra), <code>false<code> when it's a
110 * different deployment (on-prem).
111 */
112 isDbaas() {
113 return this._isDbaas;
114 }
115
116 /**
117 * Sets the product type as DBaaS.
118 * @internal
119 * @ignore
120 */
121 setProductTypeAsDbaas() {
122 this._isDbaas = true;
123 }
124
125 /**
126 * @ignore
127 * @param {String} partitionerName
128 */
129 setPartitioner(partitionerName) {
130 if (/RandomPartitioner$/.test(partitionerName)) {
131 return this.tokenizer = new t.RandomTokenizer();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected