SequoiaDB
|
Database operation interfaces of admin. More...
#include <client.hpp>
Public Member Functions | |
sdb (BOOLEAN useSSL=FALSE) | |
Default constructor. | |
~sdb () | |
Destructor. | |
INT32 | connect (const CHAR *pHostName, UINT16 port) |
Connect to remote Database Server. | |
INT32 | connect (const CHAR *pHostName, UINT16 port, const CHAR *pUsrName, const CHAR *pPasswd) |
Connect to remote Database Server. | |
INT32 | connect (const CHAR *pHostName, const CHAR *pServiceName) |
Connect to remote Database Server. | |
INT32 | connect (const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pUsrName, const CHAR *pPasswd) |
Connect to remote Database Server. | |
INT32 | connect (const CHAR **pConnAddrs, INT32 arrSize, const CHAR *pUsrName, const CHAR *pPasswd) |
Connect to database used a random valid address in the array. | |
INT32 | connect (const CHAR **pConnAddrs, INT32 arrSize, const CHAR *pUsrName, const CHAR *pToken, const CHAR *pCipherFile) |
Connect to database used a random valid address in the array. | |
UINT64 | getDbStartTime () |
Get sequoiadb start time. | |
const CHAR * | getAddress () |
Get the address information of the current connection. | |
void | getVersion (UINT8 &version, UINT8 &subVersion, UINT8 &fixVersion) |
Get sequoiadb version. | |
INT32 | createUsr (const CHAR *pUsrName, const CHAR *pPasswd, const bson::BSONObj &options=_sdbStaticObject) |
Add an user in current database. | |
INT32 | removeUsr (const CHAR *pUsrName, const CHAR *pPasswd) |
Remove the spacified user from current database. | |
INT32 | alterUsr (const CHAR *pUsrName, const CHAR *pAction, const bson::BSONObj &options) |
Alter the spacified user's information. | |
INT32 | changeUsrPasswd (const CHAR *pUsrName, const CHAR *pOldPasswd, const CHAR *pNewPasswd) |
Change the spacified user's password. | |
void | disconnect () |
Disconnect the remote Database Server. | |
INT32 | getSnapshot (sdbCursor &cursor, INT32 snapType, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1) |
Get the snapshots of specified type. | |
INT32 | resetSnapshot (const bson::BSONObj &options=_sdbStaticObject) |
Reset the snapshot. | |
INT32 | getList (sdbCursor &cursor, INT32 listType, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject, INT64 numToSkip=0, INT64 numToReturn=-1) |
Get the informations of specified type. | |
INT32 | getCollection (const CHAR *pCollectionFullName, sdbCollection &collection, BOOLEAN checkExist=TRUE) |
INT32 | getCollectionSpace (const CHAR *pCollectionSpaceName, sdbCollectionSpace &cs, BOOLEAN checkExist=TRUE) |
Get the specified collection space. | |
INT32 | createCollectionSpace (const CHAR *pCollectionSpaceName, INT32 iPageSize, sdbCollectionSpace &cs) |
Create collection space with specified pagesize. | |
INT32 | createCollectionSpace (const CHAR *pCollectionSpaceName, const bson::BSONObj &options, sdbCollectionSpace &cs) |
Create collection space with specified pagesize. | |
INT32 | dropCollectionSpace (const CHAR *pCollectionSpaceName, const bson::BSONObj &options=_sdbStaticObject) |
Remove the specified collection space. | |
INT32 | listCollectionSpaces (sdbCursor &cursor) |
List all collection space of current database(include temporary collection space). | |
INT32 | listCollections (sdbCursor &cursor) |
list all collections in current database. | |
INT32 | listReplicaGroups (sdbCursor &cursor) |
List all replica groups of current database. | |
INT32 | getReplicaGroup (const CHAR *pName, sdbReplicaGroup &group) |
Get the specified replica group. | |
INT32 | getReplicaGroup (INT32 id, sdbReplicaGroup &group) |
Get the specified replica group. | |
INT32 | createReplicaGroup (const CHAR *pName, sdbReplicaGroup &group) |
Create the specified replica group. | |
INT32 | removeReplicaGroup (const CHAR *pName) |
Remove the specified replica group. | |
INT32 | createReplicaCataGroup (const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pDatabasePath, const bson::BSONObj &configure) |
Create a catalog replica group. | |
INT32 | activateReplicaGroup (const CHAR *pName, sdbReplicaGroup &replicaGroup) |
Activate the specified replica group. | |
INT32 | execUpdate (const CHAR *sql, bson::BSONObj *pResult=NULL) |
Executing SQL command for updating. | |
INT32 | exec (const CHAR *sql, sdbCursor &cursor) |
Executing SQL command. | |
INT32 | transactionBegin () |
Transaction begin. | |
INT32 | transactionCommit (const bson::BSONObj &hint=_sdbStaticObject) |
Transaction commit. | |
INT32 | transactionRollback () |
Transaction rollback. | |
INT32 | flushConfigure (const bson::BSONObj &options) |
flush the options to configure file. | |
INT32 | crtJSProcedure (const CHAR *code) |
create a store procedures. | |
INT32 | rmProcedure (const CHAR *spName) |
remove a store procedure. | |
INT32 | listProcedures (sdbCursor &cursor, const bson::BSONObj &condition) |
list store procedures. | |
INT32 | evalJS (const CHAR *code, SDB_SPD_RES_TYPE &type, sdbCursor &cursor, bson::BSONObj &errmsg) |
Eval a js function. | |
INT32 | backupOffline (const bson::BSONObj &options) |
Backup database. | |
INT32 | backup (const bson::BSONObj &options) |
Backup database. | |
INT32 | listBackup (sdbCursor &cursor, const bson::BSONObj &options, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject) |
List the backups. | |
INT32 | removeBackup (const bson::BSONObj &options) |
Remove the backups. | |
INT32 | listTasks (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject) |
List the tasks. | |
INT32 | waitTasks (const SINT64 *taskIDs, SINT32 num) |
Wait the tasks to finish. | |
INT32 | cancelTask (SINT64 taskID, BOOLEAN isAsync) |
Cancel the specified task. | |
INT32 | setSessionAttr (const bson::BSONObj &options=_sdbStaticObject) |
Set the attributes of the session. | |
INT32 | getSessionAttr (bson::BSONObj &result, BOOLEAN useCache=TRUE) |
Get the attributes of the current session. | |
INT32 | closeAllCursors () |
Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed. | |
INT32 | interrupt () |
Send "INTERRUPT" message to engine, as a result, all the cursors and lobs created by current connection will be closed. | |
INT32 | interruptOperation () |
Send "INTERRUPT_SELF" message to engine to stop the current operation. When the current operation had finish, nothing happend, Otherwise, the current operation will be stop, and return error. | |
INT32 | isValid (BOOLEAN *result) |
Judge whether the connection is valid. | |
BOOLEAN | isValid () |
Judge whether the connection is valid. | |
BOOLEAN | isClosed () |
Judge whether the connection has been closed. | |
INT32 | createDomain (const CHAR *pDomainName, const bson::BSONObj &options, sdbDomain &domain) |
Create a domain. | |
INT32 | dropDomain (const CHAR *pDomainName) |
Drop a domain. | |
INT32 | getDomain (const CHAR *pDomainName, sdbDomain &domain) |
Get a domain. | |
INT32 | listDomains (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject) |
List the domains. | |
UINT64 | getLastAliveTime () const |
Get the number of seconds from the standard time point (usually in the midnight of January 1, 1970) to the last alive time. | |
INT32 | syncDB (const bson::BSONObj &options=_sdbStaticObject) |
sync the current database | |
INT32 | analyze (const bson::BSONObj &options=_sdbStaticObject) |
Analyze collection or index to collect statistics information. | |
INT32 | forceSession (SINT64 sessionID, const bson::BSONObj &options=_sdbStaticObject) |
Stop the specified session's current operation and terminate it. | |
INT32 | forceStepUp (const bson::BSONObj &options=_sdbStaticObject) |
In a replica group that doesn't satisfy the requirement ofre-election, upgrade a slave node to a master node by force. | |
INT32 | invalidateCache (const bson::BSONObj &options=_sdbStaticObject) |
invalidate cache on specified nodes. | |
INT32 | reloadConfig (const bson::BSONObj &options=_sdbStaticObject) |
Force the node to reload config from file and take effect. | |
INT32 | updateConfig (const bson::BSONObj &configs=_sdbStaticObject, const bson::BSONObj &options=_sdbStaticObject) |
Update node config and take effect. | |
INT32 | deleteConfig (const bson::BSONObj &configs=_sdbStaticObject, const bson::BSONObj &options=_sdbStaticObject) |
Delete node config and take effect. | |
INT32 | setPDLevel (INT32 level, const bson::BSONObj &options=_sdbStaticObject) |
Set the node's diagnostic level and take effect. | |
INT32 | memTrim (const CHAR *maskStr="", const bson::BSONObj &options=_sdbStaticObject) |
Trim the node's memory. | |
INT32 | loadCS (const CHAR *csName, const bson::BSONObj &options=_sdbStaticObject) |
Load the specific cs from the file. | |
INT32 | unloadCS (const CHAR *csName, const bson::BSONObj &options=_sdbStaticObject) |
Unload the specific cs. | |
INT32 | traceStart (UINT32 traceBufferSize, const CHAR *component=NULL, const CHAR *breakpoint=NULL, const vector< UINT32 > &tidVec=_sdbStaticUINT32Vec) |
Turn on the trace function of the database engine. | |
INT32 | traceStart (UINT32 traceBufferSize, const bson::BSONObj &options) |
Turn on the trace function of the database engine. | |
INT32 | traceStop (const CHAR *dumpFileName) |
Close the tracing function of the database engine, and then export the information in to binary files. | |
INT32 | traceResume () |
Resume the breakpoint trace tool. | |
INT32 | traceStatus (sdbCursor &cursor) |
Show the current status of the program trace. | |
INT32 | renameCollectionSpace (const CHAR *oldName, const CHAR *newName, const bson::BSONObj &options=_sdbStaticObject) |
Rename collectionSpace. | |
INT32 | getLastErrorObj (bson::BSONObj &errObj) |
Get the error object(only return by engine) of the last operation. The error object will not be clean up automatically until the next error object cover it. | |
void | cleanLastErrorObj () |
Clean the last error object(returned by engine) of current connection. | |
INT32 | getLastResultObj (bson::BSONObj &result, BOOLEAN getOwned=FALSE) const |
Get the result object(only return by engine) of the last operation. The result object will not be clean up automatically until the next result object cover it. | |
INT32 | createSequence (const CHAR *pSequenceName, const bson::BSONObj &options, _sdbSequence **sequence) |
Create the sequence with specified options. | |
INT32 | createSequence (const CHAR *pSequenceName, const bson::BSONObj &options, sdbSequence &sequence) |
Create the sequence with specified options. | |
INT32 | createSequence (const CHAR *pSequenceName, sdbSequence &sequence) |
Create the sequence with default options. | |
INT32 | getSequence (const CHAR *pSequenceName, _sdbSequence **sequence) |
Get the named sequence. | |
INT32 | getSequence (const CHAR *pSequenceName, sdbSequence &sequence) |
Get the named sequence. | |
INT32 | renameSequence (const CHAR *pOldName, const CHAR *pNewName) |
Rename sequence. | |
INT32 | dropSequence (const CHAR *pSequenceName) |
Drop the specified sequence. | |
INT32 | createDataSource (sdbDataSource &dataSource, const CHAR *pDataSourceName, const CHAR *addresses, const CHAR *user=NULL, const CHAR *password=NULL, const CHAR *type=NULL, const bson::BSONObj *options=NULL) |
Create data source. | |
INT32 | dropDataSource (const CHAR *pDataSourceName) |
Drop the specified data source. | |
INT32 | getDataSource (const CHAR *pDataSourceName, sdbDataSource &dataSource) |
Get data source. | |
INT32 | listDataSources (sdbCursor &cursor, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject, const bson::BSONObj &hint=_sdbStaticObject) |
List data source. | |
Public Attributes | |
_sdb * | pSDB |
Database operation interfaces of admin.
|
inline |
Default constructor.
[in] | useSSL | Set whether use the SSL or not, default is FALSE. |
|
inline |
Activate the specified replica group.
[in] | pName | The name of the replica group |
[out] | replicaGroup | The return sdbReplicaGroup object |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Alter the spacified user's information.
[in] | pUsrName | The username needed to alter information. |
[in] | pAction | The alter action. |
[in] | options | The action corresponding options. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Analyze collection or index to collect statistics information.
[in] | options | The control options: CollectionSpace : (String) Specify the collection space to be analyzed. Collection : (String) Specify the collection to be analyzed. Index : (String) Specify the index to be analyzed. Mode : (Int32) Specify the analyze mode (default is 1): Mode 1 will analyze with data samples. Mode 2 will analyze with full data. Mode 3 will generate default statistics. Mode 4 will reload statistics into memory cache. Mode 5 will clear statistics from memory cache. Other options : Some of other options are as below:(only take effect in coordinate nodes, please visit the official website to search "analyze" or "Location Elements" for more detail.) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Backup database.
[in] | options | Contains a series of backup configuration infomations. Backup the whole cluster if null. The "options" contains 5 options as below. All the elements in options are optional. eg: {"GroupName":["rgName1", "rgName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName", "Description":description, "EnsureInc":true, "OverWrite":true} GroupID : The id(s) of replica group(s) which to be backuped GroupName : The replica groups which to be backuped Path : The backup path, if not assign, use the backup path assigned in the configuration file, the path support to use wildcard(%g/%G:group name, %h/%H:host name, %s/%S:service name). e.g. {Path:"/opt/sequoiadb/backup/%g"} isSubDir : Whether the path specified by paramer "Path" is a subdirectory of the path specified in the configuration file, default to be false Name : The name for the backup Prefix : The prefix of name for the backup, default to be null. e.g. {Prefix:"%g_bk_"} EnableDateDir : Whether turn on the feature which will create subdirectory named to current date like "YYYY-MM-DD" automatically, default to be false Description : The description for the backup EnsureInc : Whether excute increment synchronization, default to be false OverWrite : Whether overwrite the old backup file, default to be false |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Backup database.
[in] | options | Contains a series of backup configuration infomations. Backup the whole cluster if null. The "options" contains 5 options as below. All the elements in options are optional. eg: {"GroupName":["rgName1", "rgName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName", "Description":description, "EnsureInc":true, "OverWrite":true} GroupID : The id(s) of replica group(s) which to be backuped GroupName : The replica groups which to be backuped Path : The backup path, if not assign, use the backup path assigned in the configuration file, the path support to use wildcard(%g/%G:group name, %h/%H:host name, %s/%S:service name). e.g. {Path:"/opt/sequoiadb/backup/%g"} isSubDir : Whether the path specified by paramer "Path" is a subdirectory of the path specified in the configuration file, default to be false Name : The name for the backup Prefix : The prefix of name for the backup, default to be null. e.g. {Prefix:"%g_bk_"} EnableDateDir : Whether turn on the feature which will create subdirectory named to current date like "YYYY-MM-DD" automatically, default to be false Description : The description for the backup EnsureInc : Whether excute increment synchronization, default to be false OverWrite : Whether overwrite the old backup file, default to be false |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Cancel the specified task.
[in] | taskID | The task id |
[in] | isAsync | The operation "cancel task" is async or not, "true" for async, "false" for sync. Default sync |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Change the spacified user's password.
[in] | pUsrName | The username needed to change password. |
[in] | pOldPasswd | The old password. |
[in] | pNewPasswd | The new password. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Connect to remote Database Server.
[in] | pHostName | The Host Name or IP Address of Database Server. |
[in] | port | The Port of Database Server. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Connect to remote Database Server.
[in] | pHostName | The Host Name or IP Address of Database Server. |
[in] | port | The Port of Database Server. |
[in] | pUsrName | The connection user name. |
[in] | pPasswd | The connection password. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Connect to remote Database Server.
[in] | pHostName | The Host Name or IP Address of Database Server. |
[in] | pServiceName | The Service Name of Database Server. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Connect to remote Database Server.
[in] | pHostName | The Host Name or IP Address of Database Server. |
[in] | pServiceName | The Service Name of Database Server. |
[in] | pUsrName | The connection user name. |
[in] | pPasswd | The connection password. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Connect to database used a random valid address in the array.
[in] | pConnAddrs | The array of the coord's address |
[in] | arrSize | The size of the array |
[in] | pUsrName | The connection user name. |
[in] | pPasswd | The connection password. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Connect to database used a random valid address in the array.
[in] | pConnAddrs | The array of the coord's address |
[in] | arrSize | The size of the array |
[in] | pUsrName | The connection user name. |
[in] | pToken | The Password encryption token. |
[in] | pCipherFile | The Cipherfile location. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create collection space with specified pagesize.
[in] | pCollectionSpaceName | The name of collection space. |
[in] | iPageSize | The Page Size as below SDB_PAGESIZE_4K SDB_PAGESIZE_8K SDB_PAGESIZE_16K SDB_PAGESIZE_32K SDB_PAGESIZE_64K SDB_PAGESIZE_DEFAULT |
[out] | cs | The return collection space object of creation. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create collection space with specified pagesize.
[in] | pCollectionSpaceName | The name of collection space. |
[in] | options | The options specified by user, e.g. {"PageSize": 4096, "Domain": "mydomain"}. PageSize : Assign the pagesize of the collection space Domain : Assign which domain does current collection space belong to LobPageSize : The Lob data page size, default value is 262144 and the unit is byte DataSource : Assign which data source does current collection space belong to Mapping : The name of the collection space mapped by the current collection space |
[out] | cs | The return collection space object of creation. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create data source.
[in] | pDataSourceName | The name of data source. |
[in] | addresses | The list of coord addresses for the target sequoiadb cluster, spearated by ','. eg: "sdbserver1:11810,sdbserver2:11820" |
[in] | user | The name of data source. |
[in] | password | User password of the data source |
[in] | type | Data source type |
[in] | options | Optional configuration option for create data source: AccessMode : Configure access permissions for the data source, default is "ALL". The values are as below: "READ" : Allow read-only operation. "WRITE" : Allow write-only operation. "ALL" or "READ|WRITE" : Allow all operations. "NONE" : Neither read nor write operation is allowed. ErrorFilterMask : Configure error filtering for data operations on data sources, default is "NONE". The values are as below: "READ" : Filter data read errors. "WRITE" : Filter data write errors. "ALL" or "READ|WRITE" : Filter both data read and write errors. "NONE" : Do not filter any errors. ErrorControlLevel : Configure the error control level when performing unsupported data operations (such as DDL) on the mapping collection or collection space, default is "low". The values are as below: "high" : Report an error and output an error message. "low" : Ignore unsupported data operations and do not execute on data source. TransPropagateMode: Configure the transaction propagation mode on data source, default is "never". The values are as below: "never" : Transaction operation is forbidden. Report an error and output an error message. "notsupport" : Transaction operation is not supported on data source. The operation will be converted to non-transactional and sent to data source. InheritSessionAttr: Configure whether the session between the coordination node and the data source inherits properties of the local session, default is true. The supported attributes include PreferedInstance, PreferedInstanceMode, PreferedStrict, PreferedPeriod and Timeout. |
[out] | dataSource | A data source object |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Create a domain.
[in] | pDomainName | The name of the domain |
[in] | options | The options for the domain. The options are as below: Groups: The list of replica groups' names which the domain is going to contain. eg: { "Groups": [ "group1", "group2", "group3" ] } If this argument is not included, the domain will contain all replica groups in the cluster. AutoSplit: If this option is set to be true, while creating collection(ShardingType is "hash") in this domain, the data of this collection will be split(hash split) into all the groups in this domain automatically. However, it won't automatically split data into those groups which were add into this domain later. eg: { "Groups": [ "group1", "group2", "group3" ], "AutoSplit: true" } |
[out] | domain | The created sdbDomain object |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create a catalog replica group.
[in] | pHostName | The hostname for the catalog replica group |
[in] | pServiceName | The servicename for the catalog replica group |
[in] | pDatabasePath | The path for the catalog replica group |
[in] | configure | The configurations for the catalog replica group |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create the specified replica group.
[in] | pName | The name of the replica group. |
[out] | group | The return sdbReplicaGroup object. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create the sequence with specified options.
[in] | pSequenceName | The name of sequence. |
[in] | options | The options specified by user, e.g. {"Increment": 2, "Cycled": true} StartValue : The start value of sequence MinValue : The minimum value of sequence MaxValue : The maxmun value of sequence Increment : The increment value of sequence CacheSize : The cache size of sequence AcquireSize : The acquire size of sequence Cycled : The cycled flag of sequence |
[out] | sequence | The return sequence object of creation. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Create the sequence with specified options.
[in] | pSequenceName | The name of sequence. |
[in] | options | The options specified by user, e.g. {"Increment": 2, "Cycled": true} StartValue : The start value of sequence MinValue : The minimum value of sequence MaxValue : The maxmun value of sequence Increment : The increment value of sequence CacheSize : The cache size of sequence AcquireSize : The acquire size of sequence Cycled : The cycled flag of sequence |
[out] | sequence | The return sequence object of creation. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Create the sequence with default options.
[in] | pSequenceName | The name of sequence. |
[out] | sequence | The return sequence object of creation. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Add an user in current database.
[in] | pUsrName | The connection user name. |
[in] | pPasswd | The connection password. |
[in] | options | The options for user, such as: { AuditMask:"DDL|DML" } AuditMask : User audit log mask, value list: ACCESS,CLUSTER,SYSTEM,DML,DDL,DCL,DQL,INSERT,DELETE, UPDATE,OTHER. You can combine multiple values with '|'. 'ALL' means that all mask items are turned on, and 'NONE' means that no mask items are turned on. If an item in the user audit log is not configured, the configuration of the corresponding mask item on the node is inherited. You can also use '!' to disable inheritance of this mask( e.g. "!DDL|DML" ). Role : User role, currently only builtin roles are supported, value list: admin, monitor. User of role admin has all privileges in the system, while user of role monitor is only allowed to get monitor data. If role is not given when creating a user, the default role is admin. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
create a store procedures.
[in] | code | The code of store procedures |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Delete node config and take effect.
[in] | configs | the specific configuration parameters to delete. { diaglevel:1 } Delete diaglevel config and restore to default value. |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Remove the specified collection space.
[in] | pCollectionSpaceName | The name of collection space. |
[in] | options | The options for dropping collection or NULL for not specified any options. Please reference here for more detail. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop the specified data source.
[in] | pDataSourceName | The name of data source. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Drop a domain.
[in] | pDomainName | The name of the domain |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Drop the specified sequence.
[in] | pSequenceName | The name of sequence. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Eval a js function.
INT32 evalJS( const CHAR *code, SDB_SPD_RES_TYPE &type, sdbCursor &cursor, bson::BSONObj &errmsg )
[in] | code | The js code to eval. |
[out] | type | The type of value. type is declared in spd.h. |
[out] | cursor | The cursor handle of current eval. |
[out] | errmsg | The errmsg from eval. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Executing SQL command.
[in] | sql | The SQL command. |
[out] | cursor | The return cursor object of matching documents. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Executing SQL command for updating.
[in] | sql | The SQL command. |
[out] | pResult | The detail result info |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
flush the options to configure file.
[in] | options | The configure infomation, pass {"Global":true} or {"Global":false} In cluster environment, passing {"Global":true} will flush data's and catalog's configuration file, while passing {"Global":false} will flush coord's configuration file. In stand-alone environment, both them have the same behaviour. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Stop the specified session's current operation and terminate it.
[in] | sessionID | The ID of the session. |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
In a replica group that doesn't satisfy the requirement ofre-election, upgrade a slave node to a master node by force.
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the address information of the current connection.
|
inline |
Get the specified collection.
[in] | pCollectionFullName | The full name of collection. |
[in] | checkExist | Check if the collection exists, default is true. |
[out] | collection | The return collection object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the specified collection space.
[in] | pCollectionSpaceName | The name of collection space. |
[in] | checkExist | Check if the collection space exists, default is true. |
[out] | cs | The return collection space object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get data source.
[in] | pDataSourceName | The name of data source. |
[out] | dataSource | The return data source object. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Get sequoiadb start time.
Sequoiadb | start time |
|
inline |
Get a domain.
[in] | pDomainName | The name of the domain |
[out] | domain | The sdbDomain object to get |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the number of seconds from the standard time point (usually in the midnight of January 1, 1970) to the last alive time.
UINT64 | time difference, unit for seconds |
|
inline |
Get the error object(only return by engine) of the last operation. The error object will not be clean up automatically until the next error object cover it.
[out] | errObj | The return error bson object. Please reference here for more detail. |
SDB_OK | Operation Success. |
SDB_DMS_EOC | There is no error object. |
Others | Operation Fail. |
|
inline |
Get the result object(only return by engine) of the last operation. The result object will not be clean up automatically until the next result object cover it.
[out] | result | The return result bson object. |
[in] | getOwned | Whether the return result bson object should get owned memory or not. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Get the informations of specified type.
[in] | listType | The list type as below SDB_LIST_CONTEXTS : Get all contexts list SDB_LIST_CONTEXTS_CURRENT : Get contexts list for the current session SDB_LIST_SESSIONS : Get all sessions list SDB_LIST_SESSIONS_CURRENT : Get the current session SDB_LIST_COLLECTIONS : Get all collections list SDB_LIST_COLLECTIONSPACES : Get all collecion spaces' list SDB_LIST_STORAGEUNITS : Get storage units list SDB_LIST_GROUPS : Get replicaGroup list ( only applicable in sharding env ) SDB_LIST_STOREPROCEDURES : Get all the stored procedure list SDB_LIST_DOMAINS : Get all the domains list SDB_LIST_TASKS : Get all the running split tasks ( only applicable in sharding env ) SDB_LIST_TRANSACTIONS : Get all the transactions information. SDB_LIST_TRANSACTIONS_CURRENT : Get the transactions information of current session. SDB_LIST_SVCTASKS : Get all the schedule task informations SDB_LIST_SEQUENCES : Get all the sequence informations SDB_LIST_USERS : Get all the user informations SDB_LIST_DATASOURCES : Get all the data source informations |
[in] | condition | The matching rule, match all the documents if null. |
[in] | select | The selective rule, return the whole document if null. |
[in] | orderBy | The ordered rule, never sort if null. |
[in] | hint | The options provided for specific list type. Reserved. |
[in] | numToSkip | Skip the first numToSkip documents. |
[in] | numToReturn | Only return numToReturn documents. -1 means return all matched results. |
[out] | cursor | The return cursor object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the specified replica group.
[in] | pName | The name of replica group. |
[out] | group | The sdbReplicaGroup object. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the specified replica group.
[in] | id | The id of replica group. |
[out] | group | The sdbReplicaGroup object. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the named sequence.
[in] | pSequenceName | The name of sequence. |
[out] | sequence | The return sequence object. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Get the named sequence.
[in] | pSequenceName | The name of sequence. |
[out] | sequence | The return sequence object. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Get the attributes of the current session.
[out] | result | The return bson object. |
[in] | useCache | Whether to use cache in local, default to be TRUE. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the snapshots of specified type.
[in] | snapType | The snapshot type as below SDB_SNAP_CONTEXTS : Get the snapshot of all the contexts SDB_SNAP_CONTEXTS_CURRENT : Get the snapshot of current context SDB_SNAP_SESSIONS : Get the snapshot of all the sessions SDB_SNAP_SESSIONS_CURRENT : Get the snapshot of current session SDB_SNAP_COLLECTIONS : Get the snapshot of all the collections SDB_SNAP_COLLECTIONSPACES : Get the snapshot of all the collection spaces SDB_SNAP_DATABASE : Get the snapshot of the database SDB_SNAP_SYSTEM : Get the snapshot of the system SDB_SNAP_CATALOG : Get the snapshot of the catalog SDB_SNAP_TRANSACTIONS : Get snapshot of transactions in current session SDB_SNAP_TRANSACTIONS_CURRENT : Get snapshot of all the transactions SDB_SNAP_ACCESSPLANS : Get the snapshot of cached access plans SDB_SNAP_HEALTH : Get snapshot of node health detection SDB_SNAP_CONFIGS : Get snapshot of node configurations SDB_SNAP_SVCTASKS : Get snapshot of service task SDB_SNAP_SEQUENCES : Get the snapshot of sequences SDB_SNAP_INDEXSTATS : Get the snapshot of index statistics |
[in] | numToSkip | Skip the first numToSkip documents, default is 0 |
[in] | numToReturn | Only return numToReturn documents, default is -1 for returning all results |
[in] | condition | The matching rule, match all the documents if not provided. |
[in] | select | The selective rule, return the whole document if not provided. |
[in] | orderBy | The ordered rule, result set is unordered if not provided. |
[in] | hint | The options provided for specific snapshot type. format:{ '$Options': { <options> } } |
[out] | cursor | The return cursor object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get sequoiadb version.
[out] | version | Version. |
[out] | subVersion | Sub version. |
[out] | fixVersion | Fix version. |
void |
|
inline |
Send "INTERRUPT" message to engine, as a result, all the cursors and lobs created by current connection will be closed.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Send "INTERRUPT_SELF" message to engine to stop the current operation. When the current operation had finish, nothing happend, Otherwise, the current operation will be stop, and return error.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
invalidate cache on specified nodes.
[in] | cHandle | The connection handle |
[in] | options | The control options:(Only take effect in coordinate nodes). Some of its optional parameters are as bellow: Global(Bool) : execute this command in global or not. While 'options' is null, it's equals to {Glocal: true}. GroupID(INT32 or INT32 Array) : specified one or several groups by their group IDs. e.g. {GroupID:[1001, 1002]}. GroupName(String or String Array) : specified one or several groups by their group names. e.g. {GroupID:"group1"}. ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Judge whether the connection has been closed.
TRUE | or FALSE |
|
inline |
Judge whether the connection is valid.
[out] | result | the output result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Judge whether the connection is valid.
TRUE | for the connection is valid while FALSE for not |
|
inline |
List the backups.
[in] | options | Contains configuration information for listing backups, list all the backups in the default backup path if null. The "options" contains several options as below. All the elements in options are optional. eg: {"GroupName":["rgame1", "rgName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName"} GroupID : Specified the group id of the backups, default to list all the backups of all the groups. GroupName : Specified the group name of the backups, default to list all the backups of all the groups. Path : Specified the path of the backups, default to use the backup path asigned in the configuration file. Name : Specified the name of backup, default to list all the backups. IsSubDir : Specified the "Path" is a subdirectory of the backup path assigned in the configuration file or not, default to be false. Prefix : Specified the prefix name of the backups, support for using wildcards("%g","%G","%h","%H","%s","%s"),such as: Prefix:"%g_bk_", default to not using wildcards. Detail : Display the detail of the backups or not, default to be false. |
[in] | condition | The matching rule, return all the documents if not provided |
[in] | selector | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[out] | cursor | The cusor handle of result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
list all collections in current database.
[out] | cursor | The return cursor object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
List all collection space of current database(include temporary collection space).
[out] | cursor | The return cursor object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
List data source.
[in] | condition | The matching rule, return all the record if null |
[in] | selector | The selective rule, return the whole record if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Reserved, do not need to specify |
[out] | cursor | The sdbCursor object of result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
List the domains.
[in] | condition | The matching rule, return all the documents if null |
[in] | selector | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[out] | cursor | The sdbCursor object of result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
list store procedures.
[in] | condition | The condition of list |
[out] | cursor | The cursor of the result |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
List all replica groups of current database.
[out] | cursor | The return cursor object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
List the tasks.
[in] | condition | The matching rule, return all the documents if null |
[in] | selector | The selective rule, return the whole document if null |
[in] | orderBy | The ordered rule, never sort if null |
[in] | hint | Specified the index used to scan data. e.g. {"":"ageIndex"} means using index "ageIndex" to scan data(index scan); {"":null} means table scan. when hint is not provided, database automatically match the optimal index to scan data |
[out] | cursor | The connection handle |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Load the specific cs from the file.
[in] | csName | The name of cs that will be loaded |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Trim the node's memory.
[in] | maskStr | The memory mask. value 'OSS','POOL','TC', can use '|' to join them |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Force the node to reload config from file and take effect.
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Remove the backups.
[in] | options | Contains configuration information for remove backups, remove all the backups in the default backup path if null. The "options" contains several options as below. All the elements in options are optional. eg: {"GroupName":["rgName1", "rgName2"], "Path":"/opt/sequoiadb/backup", "Name":"backupName"} GroupID : Specified the group id of the backups, default to list all the backups of all the groups. GroupName : Specified the group name of the backups, default to list all the backups of all the groups. Path : Specified the path of the backups, default to use the backup path asigned in the configuration file. Name : Specified the name of backup, default to list all the backups. IsSubDir : Specified the "Path" is a subdirectory of the backup path assigned in the configuration file or not, default to be false. Prefix : Specified the prefix name of the backups, support for using wildcards("%g","%G","%h","%H","%s","%s"),such as: Prefix:"%g_bk_", default to not using wildcards. Detail : Display the detail of the backups or not, default to be false. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Remove the specified replica group.
[in] | pName | The name of the replica group |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Remove the spacified user from current database.
[in] | pUsrName | The connection user name. |
[in] | pPasswd | The connection password. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Rename collectionSpace.
[in] | oldName | The old name of collectionSpace. |
[in] | newName | The new name of collectionSpace. |
[in] | options | Reserved argument |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Rename sequence.
[in] | pOldName | The old name of sequence. |
[in] | pNewName | The new name of sequence. |
SDB_OK | Operation Success. |
Others | Operation Fail. |
|
inline |
Reset the snapshot.
[in] | options | The control options: Type : (String) Specify the snapshot type to be reset.( defalut is "all" ) "sessions" "sessions current" "database" "health" "all" SessionID : (INT32) Specify the session ID to be reset. Other options : Some of other options are as below: (please visit the official website to search "Location Elements" for more detail.) GroupID :INT32, GroupName :String, NodeID :INT32, HostName :String, svcname :String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
remove a store procedure.
[in] | spName | The name of store procedure |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Set the node's diagnostic level and take effect.
[in] | level | The diagnostic level, value 0~5. value means: 0: SEVERE 1: ERROR 2: EVENT 3: WARNING 4: INFO 5: DEBUG |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Set the attributes of the session.
[in] | options | The options for setting session attributes. Can not be NULL. While it's a empty options, the local session attributes cache will be cleanup. Please reference here for more detail. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
sync the current database
[in] | options | The control options: Deep: (INT32) Flush with deep mode or not. 1 in default. 0 for non-deep mode,1 for deep mode,-1 means use the configuration with server Block: (Bool) Flush with block mode or not. false in default. CollectionSpace: (String) Specify the collectionspace to sync. If not set, will sync all the collectionspaces and logs, otherwise, will only sync the collectionspace specified. Some of other options are as below:(only take effect in coordinate nodes, please visit the official website to search "sync" or "Location Elements" for more detail.) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Resume the breakpoint trace tool.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Turn on the trace function of the database engine.
[in] | traceBufferSize | Trace file's size(MB), Value range:[1,1024]. |
[in] | component | Specific module. |
[in] | breakpoint | Add a breakpoint in function to trace. |
[in] | tidVec | The target threads. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Turn on the trace function of the database engine.
[in] | traceBufferSize | Trace file's size(MB), Value range:[1,1024]. |
[in] | options | The options for traceStart. The options are as below: components: The components the user wants to monitor. eg: { "components": [ "dms", "rtn" ] } breakPoints: The breakPoints the user wants to monitor. eg: { "breakPoints": [ "catGetOneObj", "_dmsStorageBase::sync" ] } tids: The tids the user wants to monitor. eg: { "tids": [ 23456, 23457 ] } functionNames: The functionNames the user wants to monitor. eg: { "functionNames": [ "_pmdEDUCB::resetInfo","isInterrupted" ] } threadTypes: The threadTypes the user wants to monitor. eg: { "threadTypes": [ "TCPListener", "CoordNetwork" ] } |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Show the current status of the program trace.
[out] | cursor | The return cursor object of query. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Close the tracing function of the database engine, and then export the information in to binary files.
[in] | dumpFileName | Name of dump file. If the file path is relative path, will store file into the node's 'diagpath'. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Transaction begin.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Transaction commit.
[in] | hint | Client and Query Information. Default to be empty when not provided. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Transaction rollback.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Unload the specific cs.
[in] | csName | The name of cs that will be unloaded |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Update node config and take effect.
[in] | configs | the specific configuration parameters to update. { diaglevel:3 } Modify diaglevel as 3. |
[in] | options | The control options:(Only take effect in coordinate nodes) GroupID:INT32, GroupName:String, NodeID:INT32, HostName:String, svcname:String, ... |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Wait the tasks to finish.
[in] | taskIDs | The array of task id |
[in] | num | The number of task id |
SDB_OK | Operation Success |
Others | Operation Fail |
sdbclient::sdb::pSDB |
A pointer of virtual base class _sdb
Class sdb is a shell for _sdb. We use pSDB to call the methods in class _sdb.