new Store(configuration)
Store constructor
Parameters:
Name | Type | Description |
---|---|---|
configuration |
Configuration | Configuration object. |
Members
parse :parse|exports
Helper function to parse strings and convert them into Javascript objects,
use it instead of common JSON.parse when you use long integers (64 bits).
This function converts these long integers into Int64 objects.
Type:
- parse | exports
stringify :parse|exports
Helper function to convert Javascript objects into strings,
use it instead of common JSON.strings when you use Int64 objects.
This function converts these Int64 objects into correct long integer strings.
Type:
- parse | exports
Methods
close()
Closes the connection.
delete(tableName, primaryKey, writeOptionsopt, callbackopt)
Deletes a row from a table.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behaviour. |
callback |
deleteCallback |
<optional> |
A function that is called when the process ends. |
deleteIfVersion(tableName, primaryKey, matchVersion, writeOptionsopt, callbackopt)
Deletes a row from a table but only if its version matches the one
specified in matchVersion.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
matchVersion |
Version | The version to match. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behavior. |
callback |
deleteCallback |
<optional> |
A function that is called when the process ends. |
execute(statement, callbackopt)
Executes a table statement. Currently, table statements
can be used to create or modify tables and indices.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
statement |
String | The statement to be performed. | |
callback |
executeCallback |
<optional> |
A function that is called when the process ends. |
executeFuture(statement, callbackopt)
Executes a table DDL statement in the server without waiting for a response.
Currently, table statements can be used to create or modify tables and
indices.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
statement |
String | The statement to be performed. | |
callback |
executeFutureCallback |
<optional> |
A function that is called when the process ends. |
executeUpdates(operations, writeOptionsopt, callbackopt)
This method provides an efficient and transactional mechanism for
executing a sequence of operations associated with tables that share
the same shard key portion of their primary keys.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
operations |
Array | The operations to be performed. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behaviour. For this method, returnChoice is not allowed within writeOptions object and it must be null, instead, every operation should handle their own returnChoice option. |
callback |
executeUpdatesCallback |
<optional> |
A function that is called when the process ends. |
get(tableName, primaryKey, readOptionsopt, callbackopt)
Gets the Row associated with the primary key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
readOptions |
ReadOptions |
<optional> |
Non-default options for the operation or null to get default behavior. |
callback |
getCallback |
<optional> |
A function that is called when the process ends. |
getExecutionFuture(executionId) → {ExecutionFuture}
Creates an ExecutionFuture object from a ExecutionId object.
Parameters:
Name | Type | Description |
---|---|---|
executionId |
ExecutionId | The ExecutionId from which the execution future is going to be constructed. |
Returns:
executionFuture The ExecutionFuture object.
- Type
- ExecutionFuture
indexIterator(tableName, indexName, optionsopt, callback, callbackopt)
Returns an iterator over the rows associated with an index key. This
method requires an additional database read on the server side to get row
information for matching rows. Ancestor table rows for matching index rows
may be returned as well if specified in the getOptions parameter. Index
operations may not specify the return of child table rows.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
indexName |
String | The index name. | |
options |
Object |
<optional> |
An object that includes the following parameters: { indexKey: null, fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.indexKey |
Object | The index key for the operation. It may be partial or complete. If the key has no fields set the entire index is matched. | |
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
iteratorCallback |
<optional> |
A function that is called when the process ends. |
indexKeyIterator(tableName, indexName, optionsopt, callback, callbackopt)
Returns the KeyPair for matching rows associated with an index key. The
iterator returned only references information directly available from the
index -- the row's primary key and the matching index key for the entry.
No extra fetch operations are performed. Ancestor table keys for
matching index keys may be returned as well if specified in the getOptions
parameter. Index operations may not specify the return of child table keys.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
indexName |
String | The index name. | |
options |
Object |
<optional> |
An object that includes the following parameters: { indexKey: null, fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.indexKey |
Object | The index key for the operation. It may be partial or complete. If the key has no fields set the entire index is matched. | |
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
iteratorCallback |
<optional> |
A function that is called when the process ends. |
indexKeyStream(tableName, indexName, optionsopt, callback, callbackopt)
Return a Readable Stream with the KeyPairs for matching rows associated with
an index key. The Stream returned only references information directly
available from the index. No extra fetch operations are performed.
Ancestor table keys for matching index keys may be returned as well if
specified in the getOptions parameter. Index operations may not specify the
return of child table keys.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
indexName |
String | The index name. | |
options |
Object |
<optional> |
An object that includes the following parameters: { indexKey: null, fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.indexKey |
Object | The index key for the operation. It may be partial or complete. If the key has no fields set the entire index is matched. | |
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
streamCallback |
<optional> |
A function that is called when the process ends. |
indexStream(tableName, indexName, optionsopt, callback, callbackopt)
Returns a Readable Stream over the rows associated with an index key. This
method requires an additional database read on the server side to get row
information for matching rows. Ancestor table rows for matching index rows
may be returned as well if specified in the getOptions parameter. Index
operations may not specify the return of child table rows.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
indexName |
String | The index name. | |
options |
Object |
<optional> |
An object that includes the following parameters: { indexKey: null, fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.indexKey |
Object | The index key for the operation. It may be partial or complete. If the key has no fields set the entire index is matched. | |
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
streamCallback |
<optional> |
A function that is called when the process ends. |
multiDelete(tableName, primaryKey, optionsopt, callback, callbackopt)
Deletes multiple rows from a table in an atomic operation. The key used
may be partial but must contain all of the fields that are in the shard
key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, writeOptions: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.writeOptions |
WriteOptions | Non-default arguments controlling the Durability of the operation, or null to get default behavior. | |
callback |
multiDeleteCallback |
<optional> |
A function that is called when the process ends. |
multiGet(tableName, partialPrimaryKey, optionsopt, callback, callbackopt)
Returns the rows associated with a partial primary key in an atomic
manner. Rows are returned in primary key order. The key used must contain
all of the fields defined for the table's shard key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
partialPrimaryKey |
Object | The primary key for a table. It may be partial or complete. The key used must contain all of the fields defined for the table's shard key. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, readOptions: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
callback |
multiGetCallback |
<optional> |
A function that is called when the process ends. |
multiGetKeys(tableName, primaryKey, optionsopt, callback, callbackopt)
Returns the rows associated with a partial primary key in an atomic manner.
Keys are returned in primary key order. The key used must contain all of
the fields defined for the table's shard key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, readOptions: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. the primaryKey parameter is always included as a target. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
callback |
multiGetKeysCallback |
<optional> |
A function that is called when the process ends. |
open(callbackopt)
This method opens a connection to a kvstore server. It tries to start a
Thrift proxy if startProxy is set to true on configuration options. This
process also calls the 'open' event in the listener protocol or 'error' if
an error occurs during opening.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
openCallback |
<optional> |
Calls this function when the process finishes, will return an error object if the opening process fails. |
parseKeyPair(args)
Helper function to parse the results of a key-only iteration as a
row with metadata or a plain key pair.
Parameters:
Name | Type | Description |
---|---|---|
args |
put(tableName, row, writeOptionsopt, callbackopt)
Puts a row into a table. The row must contain a complete primary key and
all required fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
row |
Object | the primary key for a table. It must be a complete primary key, with all fields set. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behaviour. |
callback |
putCallback |
<optional> |
A function that is called when the process ends. |
putIfAbsent(tableName, row, writeOptionsopt, callbackopt)
Puts a row into a table, but only if the row does not exist. The row must
contain a complete primary key and all required fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
row |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behavior. |
callback |
putCallback |
<optional> |
A function that is called when the process ends. |
putIfPresent(tableName, row, writeOptionsopt, callbackopt)
Puts a row into a table, but only if the row already exists. The row must
contain a complete primary key and all required fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
row |
Object | the primary key for a table. It must be a complete primary key, with all fields set. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behavior. |
callback |
putCallback |
<optional> |
A function that is called when the process ends. |
putIfVersion(tableName, row, matchVersion, writeOptionsopt, callbackopt)
Puts a row, but only if the version of the existing row matches the
matchVersion argument. Used when updating a value to ensure that it has
not changed since it was last read. The row must contain a complete
primary key and all required fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
row |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
matchVersion |
Buffer | The version to match. | |
writeOptions |
WriteOptions |
<optional> |
Non-default arguments controlling the Durability of the operation, or null to get default behavior. |
callback |
putCallback |
<optional> |
A function that is called when the process ends. |
refreshTables(callbackopt)
Refreshes cached information about the tables. This method is
required before using any tables that had been modified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
A function that is called when the process ends. |
shutdownProxy(callbackopt)
Attempts to shutdown the proxy related to the configuration of this store.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
shutdownProxyCallback |
<optional> |
A function that is called when the process ends. |
status(moduleInfo, callbackopt)
Return a String with the status of the Proxy/Java.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
moduleInfo |
ModuleInfo | This parameter indicates which module the version is asked. | |
callback |
versionCallback |
<optional> |
A function that is called when the process ends. |
tableIterator(tableName, primaryKey, optionsopt, callback, callbackopt)
Returns an iterator over the rows associated with a partial primary key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
iteratorCallback |
<optional> |
A function that is called when the process ends. |
tableKeyIterator(tableName, primaryKey, optionsopt, callback, callbackopt)
Returns an iterator over the keys associated with a partial primary key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
iteratorCallback |
<optional> |
A function that is called when the process ends. |
tableKeyStream(tableName, primaryKey, optionsopt, callback, callbackopt)
Returns a Readable Stream over the keys associated with a partial primary
key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
streamCallback |
<optional> |
A function that is called when the process ends. |
tableStream(tableName, primaryKey, optionsopt, callback, callbackopt)
Returns a Readable Stream over the rows associated with a partial primary
key.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tableName |
String | The table name. | |
primaryKey |
Object | The primary key for a table. It must be a complete primary key, with all fields set. | |
options |
Object |
<optional> |
An object that includes the following parameters: { fieldRange: null, includedTables: null, readOptions: null, direction: null } |
callback |
|||
options.fieldRange |
FieldRange | The FieldRange to be used to restrict the range of the operation. | |
options.includedTables |
Array | The list of tables to be included in an operation that returns multiple rows or keys. | |
options.readOptions |
ReadOptions | Non-default options for the operation or null to get default behavior. | |
options.direction |
Direction | The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. | |
callback |
streamCallback |
<optional> |
A function that is called when the process ends. |
version(moduleInfo, callbackopt)
Return a String with the version of the Proxy/Java
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
moduleInfo |
ModuleInfo | This parameter indicates which module the version is asked. | |
callback |
versionCallback |
<optional> |
A function that is called when the process ends. |
Events
close
Called when the Store is closed
error
Called when an error occurred
open
Called when the Store is opened