SequoiaDB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Public Attributes | List of all members
sdbclient::sdb Class Reference

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
 

Detailed Description

Database operation interfaces of admin.

Constructor & Destructor Documentation

sdbclient::sdb::sdb ( BOOLEAN  useSSL = FALSE)
inline

Default constructor.

Parameters
[in]useSSLSet whether use the SSL or not, default is FALSE.

Member Function Documentation

INT32 sdbclient::sdb::activateReplicaGroup ( const CHAR *  pName,
sdbReplicaGroup replicaGroup 
)
inline

Activate the specified replica group.

Parameters
[in]pNameThe name of the replica group
[out]replicaGroupThe return sdbReplicaGroup object
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::alterUsr ( const CHAR *  pUsrName,
const CHAR *  pAction,
const bson::BSONObj &  options 
)
inline

Alter the spacified user's information.

Parameters
[in]pUsrNameThe username needed to alter information.
[in]pActionThe alter action.
[in]optionsThe action corresponding options.
Return values
SDB_OKOperation Success
OthersOperation Fail
Note
Alter action and options list: "set attributes" : { AuditMask : ... }
INT32 sdbclient::sdb::analyze ( const bson::BSONObj &  options = _sdbStaticObject)
inline

Analyze collection or index to collect statistics information.

Parameters
[in]optionsThe 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,
                  ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::backup ( const bson::BSONObj &  options)
inline

Backup database.

Parameters
[in]optionsContains 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
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::backupOffline ( const bson::BSONObj &  options)
inline

Backup database.

Parameters
[in]optionsContains 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
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
Rename to "backup".
INT32 sdbclient::sdb::cancelTask ( SINT64  taskID,
BOOLEAN  isAsync 
)
inline

Cancel the specified task.

Parameters
[in]taskIDThe task id
[in]isAsyncThe operation "cancel task" is async or not, "true" for async, "false" for sync. Default sync
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::changeUsrPasswd ( const CHAR *  pUsrName,
const CHAR *  pOldPasswd,
const CHAR *  pNewPasswd 
)
inline

Change the spacified user's password.

Parameters
[in]pUsrNameThe username needed to change password.
[in]pOldPasswdThe old password.
[in]pNewPasswdThe new password.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::closeAllCursors ( )
inline

Send a "Interrpt" message to engine, as a result, all the cursors and lobs created by current connection will be closed.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::connect ( const CHAR *  pHostName,
UINT16  port 
)
inline

Connect to remote Database Server.

Parameters
[in]pHostNameThe Host Name or IP Address of Database Server.
[in]portThe Port of Database Server.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::connect ( const CHAR *  pHostName,
UINT16  port,
const CHAR *  pUsrName,
const CHAR *  pPasswd 
)
inline

Connect to remote Database Server.

Parameters
[in]pHostNameThe Host Name or IP Address of Database Server.
[in]portThe Port of Database Server.
[in]pUsrNameThe connection user name.
[in]pPasswdThe connection password.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::connect ( const CHAR *  pHostName,
const CHAR *  pServiceName 
)
inline

Connect to remote Database Server.

Parameters
[in]pHostNameThe Host Name or IP Address of Database Server.
[in]pServiceNameThe Service Name of Database Server.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::connect ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pUsrName,
const CHAR *  pPasswd 
)
inline

Connect to remote Database Server.

Parameters
[in]pHostNameThe Host Name or IP Address of Database Server.
[in]pServiceNameThe Service Name of Database Server.
[in]pUsrNameThe connection user name.
[in]pPasswdThe connection password.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::connect ( const CHAR **  pConnAddrs,
INT32  arrSize,
const CHAR *  pUsrName,
const CHAR *  pPasswd 
)
inline

Connect to database used a random valid address in the array.

Parameters
[in]pConnAddrsThe array of the coord's address
[in]arrSizeThe size of the array
[in]pUsrNameThe connection user name.
[in]pPasswdThe connection password.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::connect ( const CHAR **  pConnAddrs,
INT32  arrSize,
const CHAR *  pUsrName,
const CHAR *  pToken,
const CHAR *  pCipherFile 
)
inline

Connect to database used a random valid address in the array.

Parameters
[in]pConnAddrsThe array of the coord's address
[in]arrSizeThe size of the array
[in]pUsrNameThe connection user name.
[in]pTokenThe Password encryption token.
[in]pCipherFileThe Cipherfile location.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::createCollectionSpace ( const CHAR *  pCollectionSpaceName,
INT32  iPageSize,
sdbCollectionSpace cs 
)
inline

Create collection space with specified pagesize.

Parameters
[in]pCollectionSpaceNameThe name of collection space.
[in]iPageSizeThe Page Size as below
SDB_PAGESIZE_4K
SDB_PAGESIZE_8K
SDB_PAGESIZE_16K
SDB_PAGESIZE_32K
SDB_PAGESIZE_64K
SDB_PAGESIZE_DEFAULT
[out]csThe return collection space object of creation.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::createCollectionSpace ( const CHAR *  pCollectionSpaceName,
const bson::BSONObj &  options,
sdbCollectionSpace cs 
)
inline

Create collection space with specified pagesize.

Parameters
[in]pCollectionSpaceNameThe name of collection space.
[in]optionsThe 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]csThe return collection space object of creation.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::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 
)
inline

Create data source.

Parameters
[in]pDataSourceNameThe name of data source.
[in]addressesThe list of coord addresses for the target sequoiadb cluster, spearated by ','. eg: "sdbserver1:11810,sdbserver2:11820"
[in]userThe name of data source.
[in]passwordUser password of the data source
[in]typeData source type
[in]optionsOptional 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]dataSourceA data source object
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::createDomain ( const CHAR *  pDomainName,
const bson::BSONObj &  options,
sdbDomain domain 
)
inline

Create a domain.

Parameters
[in]pDomainNameThe name of the domain
[in]optionsThe 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]domainThe created sdbDomain object
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::createReplicaCataGroup ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pDatabasePath,
const bson::BSONObj &  configure 
)
inline

Create a catalog replica group.

Parameters
[in]pHostNameThe hostname for the catalog replica group
[in]pServiceNameThe servicename for the catalog replica group
[in]pDatabasePathThe path for the catalog replica group
[in]configureThe configurations for the catalog replica group
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::createReplicaGroup ( const CHAR *  pName,
sdbReplicaGroup group 
)
inline

Create the specified replica group.

Parameters
[in]pNameThe name of the replica group.
[out]groupThe return sdbReplicaGroup object.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::createSequence ( const CHAR *  pSequenceName,
const bson::BSONObj &  options,
_sdbSequence **  sequence 
)
inline

Create the sequence with specified options.

Parameters
[in]pSequenceNameThe name of sequence.
[in]optionsThe 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]sequenceThe return sequence object of creation.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::createSequence ( const CHAR *  pSequenceName,
const bson::BSONObj &  options,
sdbSequence sequence 
)
inline

Create the sequence with specified options.

Parameters
[in]pSequenceNameThe name of sequence.
[in]optionsThe 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]sequenceThe return sequence object of creation.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::createSequence ( const CHAR *  pSequenceName,
sdbSequence sequence 
)
inline

Create the sequence with default options.

Parameters
[in]pSequenceNameThe name of sequence.
[out]sequenceThe return sequence object of creation.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::createUsr ( const CHAR *  pUsrName,
const CHAR *  pPasswd,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Add an user in current database.

Parameters
[in]pUsrNameThe connection user name.
[in]pPasswdThe connection password.
[in]optionsThe 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.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::crtJSProcedure ( const CHAR *  code)
inline

create a store procedures.

Parameters
[in]codeThe code of store procedures
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::deleteConfig ( const bson::BSONObj &  configs = _sdbStaticObject,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Delete node config and take effect.

Parameters
[in]configsthe specific configuration parameters to delete. { diaglevel:1 } Delete diaglevel config and restore to default value.
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::dropCollectionSpace ( const CHAR *  pCollectionSpaceName,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Remove the specified collection space.

Parameters
[in]pCollectionSpaceNameThe name of collection space.
[in]optionsThe options for dropping collection or NULL for not specified any options. Please reference here for more detail.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::dropDataSource ( const CHAR *  pDataSourceName)
inline

Drop the specified data source.

Parameters
[in]pDataSourceNameThe name of data source.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::dropDomain ( const CHAR *  pDomainName)
inline

Drop a domain.

Parameters
[in]pDomainNameThe name of the domain
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::dropSequence ( const CHAR *  pSequenceName)
inline

Drop the specified sequence.

Parameters
[in]pSequenceNameThe name of sequence.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::evalJS ( const CHAR *  code,
SDB_SPD_RES_TYPE type,
sdbCursor cursor,
bson::BSONObj &  errmsg 
)
inline

Eval a js function.

INT32 evalJS( const CHAR *code, SDB_SPD_RES_TYPE &type, sdbCursor &cursor, bson::BSONObj &errmsg )

Parameters
[in]codeThe js code to eval.
[out]typeThe type of value. type is declared in spd.h.
[out]cursorThe cursor handle of current eval.
[out]errmsgThe errmsg from eval.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::exec ( const CHAR *  sql,
sdbCursor cursor 
)
inline

Executing SQL command.

Parameters
[in]sqlThe SQL command.
[out]cursorThe return cursor object of matching documents.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::execUpdate ( const CHAR *  sql,
bson::BSONObj *  pResult = NULL 
)
inline

Executing SQL command for updating.

Parameters
[in]sqlThe SQL command.
[out]pResultThe detail result info
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::flushConfigure ( const bson::BSONObj &  options)
inline

flush the options to configure file.

Parameters
[in]optionsThe 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.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::forceSession ( SINT64  sessionID,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Stop the specified session's current operation and terminate it.

Parameters
[in]sessionIDThe ID of the session.
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::forceStepUp ( const bson::BSONObj &  options = _sdbStaticObject)
inline

In a replica group that doesn't satisfy the requirement ofre-election, upgrade a slave node to a master node by force.

Parameters
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
const CHAR * sdbclient::sdb::getAddress ( )
inline

Get the address information of the current connection.

Returns
The address information.
INT32 sdbclient::sdb::getCollection ( const CHAR *  pCollectionFullName,
sdbCollection collection,
BOOLEAN  checkExist = TRUE 
)
inline

Get the specified collection.

Parameters
[in]pCollectionFullNameThe full name of collection.
[in]checkExistCheck if the collection exists, default is true.
[out]collectionThe return collection object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getCollectionSpace ( const CHAR *  pCollectionSpaceName,
sdbCollectionSpace cs,
BOOLEAN  checkExist = TRUE 
)
inline

Get the specified collection space.

Parameters
[in]pCollectionSpaceNameThe name of collection space.
[in]checkExistCheck if the collection space exists, default is true.
[out]csThe return collection space object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getDataSource ( const CHAR *  pDataSourceName,
sdbDataSource dataSource 
)
inline

Get data source.

Parameters
[in]pDataSourceNameThe name of data source.
[out]dataSourceThe return data source object.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
UINT64 sdbclient::sdb::getDbStartTime ( )
inline

Get sequoiadb start time.

Return values
Sequoiadbstart time
INT32 sdbclient::sdb::getDomain ( const CHAR *  pDomainName,
sdbDomain domain 
)
inline

Get a domain.

Parameters
[in]pDomainNameThe name of the domain
[out]domainThe sdbDomain object to get
Return values
SDB_OKOperation Success
OthersOperation Fail
UINT64 sdbclient::sdb::getLastAliveTime ( ) const
inline

Get the number of seconds from the standard time point (usually in the midnight of January 1, 1970) to the last alive time.

Return values
UINT64time difference, unit for seconds
INT32 sdbclient::sdb::getLastErrorObj ( bson::BSONObj &  errObj)
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.

Parameters
[out]errObjThe return error bson object. Please reference here for more detail.
Return values
SDB_OKOperation Success.
SDB_DMS_EOCThere is no error object.
OthersOperation Fail.
INT32 sdbclient::sdb::getLastResultObj ( bson::BSONObj &  result,
BOOLEAN  getOwned = FALSE 
) const
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.

Parameters
[out]resultThe return result bson object.
[in]getOwnedWhether the return result bson object should get owned memory or not.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::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 
)
inline

Get the informations of specified type.

Parameters
[in]listTypeThe 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]conditionThe matching rule, match all the documents if null.
[in]selectThe selective rule, return the whole document if null.
[in]orderByThe ordered rule, never sort if null.
[in]hintThe options provided for specific list type. Reserved.
[in]numToSkipSkip the first numToSkip documents.
[in]numToReturnOnly return numToReturn documents. -1 means return all matched results.
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getReplicaGroup ( const CHAR *  pName,
sdbReplicaGroup group 
)
inline

Get the specified replica group.

Parameters
[in]pNameThe name of replica group.
[out]groupThe sdbReplicaGroup object.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getReplicaGroup ( INT32  id,
sdbReplicaGroup group 
)
inline

Get the specified replica group.

Parameters
[in]idThe id of replica group.
[out]groupThe sdbReplicaGroup object.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getSequence ( const CHAR *  pSequenceName,
_sdbSequence **  sequence 
)
inline

Get the named sequence.

Parameters
[in]pSequenceNameThe name of sequence.
[out]sequenceThe return sequence object.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::getSequence ( const CHAR *  pSequenceName,
sdbSequence sequence 
)
inline

Get the named sequence.

Parameters
[in]pSequenceNameThe name of sequence.
[out]sequenceThe return sequence object.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::getSessionAttr ( bson::BSONObj &  result,
BOOLEAN  useCache = TRUE 
)
inline

Get the attributes of the current session.

Parameters
[out]resultThe return bson object.
[in]useCacheWhether to use cache in local, default to be TRUE.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::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 
)
inline

Get the snapshots of specified type.

Parameters
[in]snapTypeThe 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]numToSkipSkip the first numToSkip documents, default is 0
[in]numToReturnOnly return numToReturn documents, default is -1 for returning all results
[in]conditionThe matching rule, match all the documents if not provided.
[in]selectThe selective rule, return the whole document if not provided.
[in]orderByThe ordered rule, result set is unordered if not provided.
[in]hintThe options provided for specific snapshot type. format:{ '$Options': { <options> } }
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
void sdbclient::sdb::getVersion ( UINT8 &  version,
UINT8 &  subVersion,
UINT8 &  fixVersion 
)
inline

Get sequoiadb version.

Parameters
[out]versionVersion.
[out]subVersionSub version.
[out]fixVersionFix version.
Return values
void
INT32 sdbclient::sdb::interrupt ( )
inline

Send "INTERRUPT" message to engine, as a result, all the cursors and lobs created by current connection will be closed.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::interruptOperation ( )
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.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::invalidateCache ( const bson::BSONObj &  options = _sdbStaticObject)
inline

invalidate cache on specified nodes.

Parameters
[in]cHandleThe connection handle
[in]optionsThe 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"}.
...
Return values
SDB_OKOperation Success
OthersOperation Fail
BOOLEAN sdbclient::sdb::isClosed ( )
inline

Judge whether the connection has been closed.

Return values
TRUEor FALSE
INT32 sdbclient::sdb::isValid ( BOOLEAN *  result)
inline

Judge whether the connection is valid.

Parameters
[out]resultthe output result
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
Deprecated in version 2.x. Use "BOOLEAN isValid ()" instead.
BOOLEAN sdbclient::sdb::isValid ( )
inline

Judge whether the connection is valid.

Return values
TRUEfor the connection is valid while FALSE for not
INT32 sdbclient::sdb::listBackup ( sdbCursor cursor,
const bson::BSONObj &  options,
const bson::BSONObj &  condition = _sdbStaticObject,
const bson::BSONObj &  selector = _sdbStaticObject,
const bson::BSONObj &  orderBy = _sdbStaticObject 
)
inline

List the backups.

Parameters
[in]optionsContains 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]conditionThe matching rule, return all the documents if not provided
[in]selectorThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[out]cursorThe cusor handle of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listCollections ( sdbCursor cursor)
inline

list all collections in current database.

Parameters
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listCollectionSpaces ( sdbCursor cursor)
inline

List all collection space of current database(include temporary collection space).

Parameters
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listDataSources ( sdbCursor cursor,
const bson::BSONObj &  condition = _sdbStaticObject,
const bson::BSONObj &  selector = _sdbStaticObject,
const bson::BSONObj &  orderBy = _sdbStaticObject,
const bson::BSONObj &  hint = _sdbStaticObject 
)
inline

List data source.

Parameters
[in]conditionThe matching rule, return all the record if null
[in]selectorThe selective rule, return the whole record if null
[in]orderByThe ordered rule, never sort if null
[in]hintReserved, do not need to specify
[out]cursorThe sdbCursor object of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listDomains ( sdbCursor cursor,
const bson::BSONObj &  condition = _sdbStaticObject,
const bson::BSONObj &  selector = _sdbStaticObject,
const bson::BSONObj &  orderBy = _sdbStaticObject,
const bson::BSONObj &  hint = _sdbStaticObject 
)
inline

List the domains.

Parameters
[in]conditionThe matching rule, return all the documents if null
[in]selectorThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified 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]cursorThe sdbCursor object of result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listProcedures ( sdbCursor cursor,
const bson::BSONObj &  condition 
)
inline

list store procedures.

Parameters
[in]conditionThe condition of list
[out]cursorThe cursor of the result
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listReplicaGroups ( sdbCursor cursor)
inline

List all replica groups of current database.

Parameters
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::listTasks ( sdbCursor cursor,
const bson::BSONObj &  condition = _sdbStaticObject,
const bson::BSONObj &  selector = _sdbStaticObject,
const bson::BSONObj &  orderBy = _sdbStaticObject,
const bson::BSONObj &  hint = _sdbStaticObject 
)
inline

List the tasks.

Parameters
[in]conditionThe matching rule, return all the documents if null
[in]selectorThe selective rule, return the whole document if null
[in]orderByThe ordered rule, never sort if null
[in]hintSpecified 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]cursorThe connection handle
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::loadCS ( const CHAR *  csName,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Load the specific cs from the file.

Parameters
[in]csNameThe name of cs that will be loaded
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::memTrim ( const CHAR *  maskStr = "",
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Trim the node's memory.

Parameters
[in]maskStrThe memory mask. value 'OSS','POOL','TC', can use '|' to join them
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::reloadConfig ( const bson::BSONObj &  options = _sdbStaticObject)
inline

Force the node to reload config from file and take effect.

Parameters
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::removeBackup ( const bson::BSONObj &  options)
inline

Remove the backups.

Parameters
[in]optionsContains 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.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::removeReplicaGroup ( const CHAR *  pName)
inline

Remove the specified replica group.

Parameters
[in]pNameThe name of the replica group
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::removeUsr ( const CHAR *  pUsrName,
const CHAR *  pPasswd 
)
inline

Remove the spacified user from current database.

Parameters
[in]pUsrNameThe connection user name.
[in]pPasswdThe connection password.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::renameCollectionSpace ( const CHAR *  oldName,
const CHAR *  newName,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Rename collectionSpace.

Parameters
[in]oldNameThe old name of collectionSpace.
[in]newNameThe new name of collectionSpace.
[in]optionsReserved argument
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::renameSequence ( const CHAR *  pOldName,
const CHAR *  pNewName 
)
inline

Rename sequence.

Parameters
[in]pOldNameThe old name of sequence.
[in]pNewNameThe new name of sequence.
Return values
SDB_OKOperation Success.
OthersOperation Fail.
INT32 sdbclient::sdb::resetSnapshot ( const bson::BSONObj &  options = _sdbStaticObject)
inline

Reset the snapshot.

Parameters
[in]optionsThe 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,
                  ...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::rmProcedure ( const CHAR *  spName)
inline

remove a store procedure.

Parameters
[in]spNameThe name of store procedure
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::setPDLevel ( INT32  level,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Set the node's diagnostic level and take effect.

Parameters
[in]levelThe diagnostic level, value 0~5. value means:
0: SEVERE
1: ERROR
2: EVENT
3: WARNING
4: INFO
5: DEBUG
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::setSessionAttr ( const bson::BSONObj &  options = _sdbStaticObject)
inline

Set the attributes of the session.

Parameters
[in]optionsThe 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.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::syncDB ( const bson::BSONObj &  options = _sdbStaticObject)
inline

sync the current database

Parameters
[in]optionsThe 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,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::traceResume ( )
inline

Resume the breakpoint trace tool.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::traceStart ( UINT32  traceBufferSize,
const CHAR *  component = NULL,
const CHAR *  breakpoint = NULL,
const vector< UINT32 > &  tidVec = _sdbStaticUINT32Vec 
)
inline

Turn on the trace function of the database engine.

Parameters
[in]traceBufferSizeTrace file's size(MB), Value range:[1,1024].
[in]componentSpecific module.
[in]breakpointAdd a breakpoint in function to trace.
[in]tidVecThe target threads.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::traceStart ( UINT32  traceBufferSize,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Turn on the trace function of the database engine.

Parameters
[in]traceBufferSizeTrace file's size(MB), Value range:[1,1024].
[in]optionsThe 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" ] }
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::traceStatus ( sdbCursor cursor)
inline

Show the current status of the program trace.

Parameters
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::traceStop ( const CHAR *  dumpFileName)
inline

Close the tracing function of the database engine, and then export the information in to binary files.

Parameters
[in]dumpFileNameName of dump file. If the file path is relative path, will store file into the node's 'diagpath'.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::transactionBegin ( )
inline

Transaction begin.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::transactionCommit ( const bson::BSONObj &  hint = _sdbStaticObject)
inline

Transaction commit.

Parameters
[in]hintClient and Query Information. Default to be empty when not provided.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::transactionRollback ( )
inline

Transaction rollback.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::unloadCS ( const CHAR *  csName,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Unload the specific cs.

Parameters
[in]csNameThe name of cs that will be unloaded
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::updateConfig ( const bson::BSONObj &  configs = _sdbStaticObject,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Update node config and take effect.

Parameters
[in]configsthe specific configuration parameters to update. { diaglevel:3 } Modify diaglevel as 3.
[in]optionsThe control options:(Only take effect in coordinate nodes)
GroupID:INT32,
GroupName:String,
NodeID:INT32,
HostName:String,
svcname:String,
...
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::waitTasks ( const SINT64 *  taskIDs,
SINT32  num 
)
inline

Wait the tasks to finish.

Parameters
[in]taskIDsThe array of task id
[in]numThe number of task id
Return values
SDB_OKOperation Success
OthersOperation Fail

Member Data Documentation

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.


The documentation for this class was generated from the following file: