Class: Store

Store

new Store(configuration)

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

Methods

close()

Closes the connection.
Source:

deleteRow(tableName, primaryKey, writeOptions, callback)

Deletes a row from a table.
Parameters:
Name Type 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 non-default arguments controlling the Durability of the operation, or null to get default behaviour.
callback function a function that is called when the process finish.
Source:

deleteRowIfVersion(tableName, primaryKey, matchVersion, writeOptions, callback)

Deletes a row from a table but only if its version matches the one specified in matchVersion.
Parameters:
Name Type 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 Buffer the version to match.
writeOptions WriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour.
callback function a function that is called when the process finish.
Source:

execute(statement, callback)

Executes a table statement. Currently, table statements can be used to create or modify tables and indices.
Parameters:
Name Type Description
statement String the statement to be performed.
callback function a function that is called when the process finish.
Source:

executeAsync(statement, callback)

Executes a table statement in the server asynchronously. Currently, table statements can be used to create or modify tables and indices. The operation is asynchronous in server side and may not be finished when the method call the callback function. A execution identifier is returned and can be used to get information about the status of the operation. If the statement is for an administrative command, and the store is currently executing an administrative command that is the logical equivalent the action specified by the statement, the method will return a execution identifier that serves as a handle to that operation, rather than starting a new invocation of the command.
Parameters:
Name Type Description
statement String the statement to be performed.
callback function a function that is called when the process finish.
Source:

executeCallback()

Callback until the command represented by a execution identifier completes. Returns information about the execution of the statement. This call will result in communication with the kvstore server.
Source:

executeCancel(statement, callback)

Attempts to cancel execution of a statement, execution identifier of the statement must be provided. Return false if the statement couldn't be cancelled, possibly because it has already finished. If the statement hasn't succeeded already, and can be stopped, the operation will transition to the FAILED state.
Parameters:
Name Type Description
statement Number the statement to be performed.
callback function a function that is called when the process finish.
Source:

executeOperations()

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

executeStatus()

Returns information about the execution of the statement. If the statement is still executing, this call will result in communication with the kvstore server to obtain up to date status, and the status returned will reflect interim information.
Source:

executeTimeout()

Callback until the command represented by a execution identifier completes or the timeout period is exceeded. This call will result in communication with the kvstore server.
Source:

get(tableName, primaryKey, readOptions, callback)

Gets the Row associated with the primary key.
Parameters:
Name Type 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 non-default options for the operation or null to get default behavior.
callback function a function that is called when the process finish.
Source:

indexIterator(tableName, indexName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

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 paramter. Index operations may not specify the return of child table rows.
Parameters:
Name Type Description
tableName String the table name
indexName String the index name
primaryKey Object the primary key for a table. It must be a complete primary key, with all fields set.
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 function a function that is called when the process finish.
Source:

indexKeyIterator(tableName, indexName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

Return 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 paramter. Index operations may not specify the return of child table keys.
Parameters:
Name Type Description
tableName String the table name
indexName String the index name
primaryKey Object the primary key for a table. It must be a complete primary key, with all fields set.
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 function a function that is called when the process finish.
Source:

indexKeyStream(tableName, indexName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

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 paramter. Index operations may not specify the return of child table keys.
Parameters:
Name Type Description
tableName String the table name
indexName String the index name
primaryKey Object the primary key for a table. It must be a complete primary key, with all fields set.
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 function a function that is called when the process finish.
Source:

indexStream(tableName, indexName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

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 paramter. Index operations may not specify the return of child table rows.
Parameters:
Name Type Description
tableName String the table name
indexName String the index name
primaryKey Object the primary key for a table. It must be a complete primary key, with all fields set.
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 function a function that is called when the process finish.
Source:

multiDelete(tableName, primaryKey, fieldRange, includedTables, writeOptions, callback)

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 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.
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 behaviour.
callback function a function that is called when the process finish.
Source:

multiGet(tableName, primaryKey, fieldRange, includedTables, readOptions, callback)

Returns the rows associated with a partial primary key in an atomic manner. Rows are returned in primary key order. The key used must ontain all of the fields defined for the table's shard key.
Parameters:
Name Type 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.
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 function a function that is called when the process finish.
Source:

multiGetKeys(tableName, primaryKey, fieldRange, includedTables, readOptions, callback)

Return 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 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.
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 function a function that is called when the process finish.
Source:

open(callback)

This methods opens a connection to a kvstore server, it tries to start a thrift proxy if this is not specified 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 Description
callback function calls this function when the process finishes, will return an error object if the opening process fail.
Source:

put(tableName, row, writeOptions, callback)

Puts a row into a table. The row must contain a complete primary key and all required fields.
Parameters:
Name Type 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 non-default arguments controlling the Durability of the operation, or null to get default behaviour.
callback function a function that is called when the process finish.
Source:

putIfAbsent(tableName, row, writeOptions, callback)

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 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 non-default arguments controlling the Durability of the operation, or null to get default behaviour.
callback function a function that is called when the process finish.
Source:

putIfPresent(tableName, row, writeOptions, callback)

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 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 non-default arguments controlling the Durability of the operation, or null to get default behaviour.
callback function a function that is called when the process finish.
Source:

putIfVersion(tableName, row, matchVersion, writeOptions, callback)

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 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 non-default arguments controlling the Durability of the operation, or null to get default behaviour.
callback function a function that is called when the process finish.
Source:

refreshTables()

Refreshes cached information about the tables. This method is required before using any tables that had been modified.
Source:

shutdownProxy()

Attempt to shutdown the proxy related to the configuration of this Store
Source:

tableIterator(tableName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

Returns an iterator over the rows associated with a partial primary key.
Parameters:
Name Type 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.
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 function a function that is called when the process finish.
Source:

tableKeyIterator(tableName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

Returns an iterator over the keys associated with a partial primary key.
Parameters:
Name Type 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.
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 function a function that is called when the process finish.
Source:

tableKeyStream(tableName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

Returns a Readable Stream over the keys associated with a partial primary key.
Parameters:
Name Type 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.
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 function a function that is called when the process finish.
Source:

tableStream(tableName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)

Returns a Readable Stream over the rows associated with a partial primary key.
Parameters:
Name Type 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.
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 function a function that is called when the process finish.
Source: