new Metadata(options, controlConnection)
Parameters:
Name | Type | Description |
---|---|---|
options |
ClientOptions | |
controlConnection |
ControlConnection | Control connection used to retrieve information. |
Methods
clearPrepared()
getAggregate(keyspaceName, name, signature, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace | |
name |
String | Name of the aggregate | |
signature |
Array.<String> | Array.<{code, info}> | Array of types of the parameters. | |
callback |
function |
<optional> |
The callback with the err as a first parameter and the Aggregate as second parameter. |
getAggregates(keyspaceName, name, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace | |
name |
String | Name of the Function | |
callback |
function |
<optional> |
The callback with the err as a first parameter and the array of Aggregate as second parameter. |
getFunction(keyspaceName, name, signature, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace | |
name |
String | Name of the Function | |
signature |
Array.<String> | Array.<{code, info}> | Array of types of the parameters. | |
callback |
function |
<optional> |
The callback with the err as a first parameter and the SchemaFunction as second parameter. |
getFunctions(keyspaceName, name, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace. | |
name |
String | Name of the Function. | |
callback |
function |
<optional> |
The callback with the err as a first parameter and the array of SchemaFunction as second parameter. |
getMaterializedView(keyspaceName, name, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace | |
name |
String | Name of the materialized view | |
callback |
function |
<optional> |
The callback with the err as a first parameter and the MaterializedView as second parameter. |
getReplicas(keyspaceName, tokenBuffer) → {Array}
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.
Parameters:
Name | Type | Description |
---|---|---|
keyspaceName |
String | |
tokenBuffer |
Buffer |
Returns:
- Type
- Array
getTable(keyspaceName, name, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace. | |
name |
String | Name of the Table. | |
callback |
function |
<optional> |
The callback with the err as a first parameter and the TableMetadata as second parameter. |
getTrace(traceId, callbackopt)
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
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
traceId |
Uuid | Identifier of the trace session. | |
callback |
function |
<optional> |
The callback with the err as first parameter and the query trace as second parameter. |
getUdt(keyspaceName, name, callbackopt)
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
keyspaceName |
String | Name of the keyspace. | |
name |
String | Name of the UDT. | |
callback |
function |
<optional> |
The callback to invoke when retrieval completes. |
refreshKeyspace(name, callbackopt)
If a callback
is provided, the callback is invoked when the keyspaces metadata refresh completes.
Otherwise, it returns a Promise
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | Name of the keyspace. | |
callback |
function |
<optional> |
Optional callback. |
refreshKeyspaces(waitReconnectopt, callbackopt)
If a callback
is provided, the callback is invoked when the keyspace metadata refresh completes.
Otherwise, it returns a Promise
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
waitReconnect |
Boolean | function |
<optional> |
Determines if it should wait for reconnection in case the control connection is not connected at the moment. Default: true. |
callback |
function |
<optional> |
Optional callback. |