Class: Store

Store

new Store(configuration)

Store constructor
Parameters:
Name Type Description
configuration Configuration Configuration object.
Source:

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
Source:

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
Source:

Methods

close()

Closes the connection.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:
Returns:
executionFuture The ExecutionFuture object.
Type
ExecutionFuture

indexIterator(tableName, indexName, optionsopt, 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 }
Properties
Name Type Description
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.
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

indexKeyIterator(tableName, indexName, optionsopt, callbackopt)

Returns the keys for matching rows associated with an index key. The iterator 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 }
Properties
Name Type Description
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.
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

indexKeyStream(tableName, indexName, optionsopt, callbackopt)

Return a Readable Stream with the keys 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 }
Properties
Name Type Description
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.
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

indexStream(tableName, indexName, optionsopt, 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 }
Properties
Name Type Description
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.
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

multiDelete(tableName, primaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
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.
Source:

multiGet(tableName, partialPrimaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
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.
Source:

multiGetKeys(tableName, primaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
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.
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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

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.
Source:

tableIterator(tableName, primaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

tableKeyIterator(tableName, primaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

tableKeyStream(tableName, primaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

tableStream(tableName, primaryKey, optionsopt, 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 }
Properties
Name Type Description
fieldRange FieldRange The FieldRange to be used to restrict the range of the operation.
includedTables Array The list of tables to be included in an operation that returns multiple rows or keys.
readOptions ReadOptions Non-default options for the operation or null to get default behavior.
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.
Source:

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.
Source:

Events

close

Called when the Store is closed
Source:

error

Called when an error occurred
Source:

open

Called when the Store is opened
Source: