class Metadata
Constructor
Metadata
(ClientOptions
options, ControlConnection
controlConnection)
Represents cluster and schema information. The metadata class acts as a internal state of the driver.
Methods
clearPrepared
()Clears the internal state related to the prepared statements. Following calls to the Client using the prepare flag will re-prepare the statements.
getAggregate
(String
keyspaceName, String
name, Array
<String
> or Array
<{code, info}> signature, [function
callback])
Gets a definition of CQL aggregate for a given name and signature.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
When trying to retrieve the same aggregate definition concurrently, it will query once and invoke all callbacks with the retrieved information.
Gets the definition of CQL aggregate for a given name.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
When trying to retrieve the same aggregates definition concurrently, it will query once and invoke all callbacks with the retrieved information.
getFunction
(String
keyspaceName, String
name, Array
<String
> or Array
<{code, info}> signature, [function
callback])
Gets a definition of CQL function for a given name and signature.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
When trying to retrieve the same function definition concurrently, it will query once and invoke all callbacks with the retrieved information.
Gets the definition of CQL functions for a given name.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
When trying to retrieve the same function definition concurrently, it will query once and invoke all callbacks with the retrieved information.
Gets the definition of a CQL materialized view for a given name.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
Note that, unlike the rest of the Metadata
methods, this method does not cache the result for following
calls, as the current version of the Cassandra native protocol does not support schema change events for
materialized views. Each call to this method will produce one or more queries to the cluster.
Gets the host list representing the replicas that contain the given partition key, token or token range.
It uses the pre-loaded keyspace metadata to retrieve the replicas for a token for a given keyspace. When the keyspace metadata has not been loaded, it returns null.
Gets the definition of a table.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
When trying to retrieve the same table definition concurrently, it will query once and invoke all callbacks with the retrieved information.
getTokenRanges
()Gets the token ranges that define data distribution in the ring.
Gets the token ranges that are replicated on the given host, for the given keyspace.
Gets the trace session generated by Cassandra when query tracing is enabled for the
query. The trace itself is stored in Cassandra in the sessions
and
events
table in the system_traces
keyspace and can be
retrieve manually using the trace identifier.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
Gets the definition of an user-defined type.
If a callback
is provided, the callback is invoked when the metadata retrieval completes.
Otherwise, it returns a Promise
.
When trying to retrieve the same UDT definition concurrently, it will query once and invoke all callbacks with the retrieved information.
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.
newTokenRange
(Token
start, Token
end)
Constructs a TokenRange from the given start and end tokens.
Gets the keyspace metadata information and updates the internal state of the driver.
If a callback
is provided, the callback is invoked when the keyspaces metadata refresh completes.
Otherwise, it returns a Promise
.
Gets the metadata information of all the keyspaces and updates the internal state of the driver.
If a callback
is provided, the callback is invoked when the keyspace metadata refresh completes.
Otherwise, it returns a Promise
.