new Store(configuration)
Store constructor
Parameters:
| Name | Type | Description |
|---|---|---|
configuration |
Configuration | configuration object |
Methods
-
close()
-
Closes the connection.
-
deleteRow(tableName, primaryKey, writeOptions, callback)
-
Deletes a row from a table.
Parameters:
Name Type Description tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. matchVersionBuffer the version to match. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
execute(statement, callback)
-
Executes a table statement. Currently, table statements can be used to create or modify tables and indices.
Parameters:
Name Type Description statementString the statement to be performed. callbackfunction a function that is called when the process finish. -
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 statementString the statement to be performed. callbackfunction a function that is called when the process finish. -
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.
-
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 statementNumber the statement to be performed. callbackfunction a function that is called when the process finish. -
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.
-
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.
-
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.
-
get(tableName, primaryKey, readOptions, callback)
-
Gets the Row associated with the primary key.
Parameters:
Name Type Description tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. readOptionsReadOptions non-default options for the operation or null to get default behavior. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name indexNameString the index name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name indexNameString the index name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name indexNameString the index name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name indexNameString the index name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray 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. readOptionsReadOptions non-default options for the operation or null to get default behavior. callbackfunction a function that is called when the process finish. -
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 callbackfunction calls this function when the process finishes, will return an error object if the opening process fail. -
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 tableNameString the table name rowObject the primary key for a table. It must be a complete primary key, with all fields set. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name rowObject the primary key for a table. It must be a complete primary key, with all fields set. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name rowObject the primary key for a table. It must be a complete primary key, with all fields set. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name rowObject the primary key for a table. It must be a complete primary key, with all fields set. matchVersionBuffer the version to match. writeOptionsWriteOptions non-default arguments controlling the Durability of the operation, or null to get default behaviour. callbackfunction a function that is called when the process finish. -
refreshTables()
-
Refreshes cached information about the tables. This method is required before using any tables that had been modified.
-
shutdownProxy()
-
Attempt to shutdown the proxy related to the configuration of this Store
-
tableIterator(tableName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)
-
Returns an iterator over the rows associated with a partial primary key.
Parameters:
Name Type Description tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
tableKeyIterator(tableName, primaryKey, fieldRange, includedTables, readOptions, direction, callback)
-
Returns an iterator over the keys associated with a partial primary key.
Parameters:
Name Type Description tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish. -
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 tableNameString the table name primaryKeyObject the primary key for a table. It must be a complete primary key, with all fields set. fieldRangeFieldRange The FieldRange to be used to restrict the range of the operation. includedTablesArray The list of tables to be included in an operation that returns multiple rows or keys. readOptionsReadOptions non-default options for the operation or null to get default behavior. directionDirection The Direction for this operation. If the primary key contains a complete shard key both Direction.FORWARD and Direction.REVERSE are allowed. callbackfunction a function that is called when the process finish.