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 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.
 
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 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)
 
INT32 resetSnapshot (const bson::BSONObj &condition=_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)
 
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)
 
INT32 getCollection (const CHAR *pCollectionFullName, sdbCollection &collection)
 
INT32 getCollectionSpace (const CHAR *pCollectionSpaceName, _sdbCollectionSpace **cs)
 
INT32 getCollectionSpace (const CHAR *pCollectionSpaceName, sdbCollectionSpace &cs)
 Get the specified collection space.
 
INT32 createCollectionSpace (const CHAR *pCollectionSpaceName, INT32 iPageSize, _sdbCollectionSpace **cs)
 
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)
 Remove the specified collection space.
 
INT32 listCollectionSpaces (_sdbCursor **result)
 
INT32 listCollectionSpaces (sdbCursor &result)
 List all collection space of current database(include temporary collection space).
 
INT32 listCollections (_sdbCursor **result)
 
INT32 listCollections (sdbCursor &result)
 list all collections in current database.
 
INT32 listReplicaGroups (_sdbCursor **result)
 
INT32 listReplicaGroups (sdbCursor &result)
 List all replica groups of current database.
 
INT32 getReplicaGroup (const CHAR *pName, _sdbReplicaGroup **result)
 
INT32 getReplicaGroup (const CHAR *pName, sdbReplicaGroup &result)
 Get the specified replica group.
 
INT32 getReplicaGroup (INT32 id, _sdbReplicaGroup **result)
 
INT32 getReplicaGroup (INT32 id, sdbReplicaGroup &result)
 Get the specified replica group.
 
INT32 createReplicaGroup (const CHAR *pName, _sdbReplicaGroup **replicaGroup)
 
INT32 createReplicaGroup (const CHAR *pName, sdbReplicaGroup &replicaGroup)
 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)
 
INT32 activateReplicaGroup (const CHAR *pName, sdbReplicaGroup &replicaGroup)
 Activate the specified replica group.
 
INT32 execUpdate (const CHAR *sql)
 Executing SQL command for updating.
 
INT32 exec (const CHAR *sql, _sdbCursor **result)
 
INT32 exec (const CHAR *sql, sdbCursor &result)
 Executing SQL command.
 
INT32 transactionBegin ()
 Transaction commit.
 
INT32 transactionCommit ()
 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)
 
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)
 
INT32 evalJS (const CHAR *code, SDB_SPD_RES_TYPE &type, sdbCursor &cursor, bson::BSONObj &errmsg)
 
INT32 backupOffline (const bson::BSONObj &options)
 Backup the whole database or specifed replica group.
 
INT32 listBackup (_sdbCursor **cursor, const bson::BSONObj &options, const bson::BSONObj &condition=_sdbStaticObject, const bson::BSONObj &selector=_sdbStaticObject, const bson::BSONObj &orderBy=_sdbStaticObject)
 
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)
 
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)
 Get the attributes of the 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 isValid (BOOLEAN *result)
 Judge whether the connection is valid.
 
BOOLEAN isValid ()
 Judge whether the connection is valid.
 
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.
 
INT32 getDC (sdbDataCenter &dc)
 
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.
 

Public Attributes

_sdbpSDB
 

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::backupOffline ( const bson::BSONObj &  options)
inline

Backup the whole database or specifed replica group.

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::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::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::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
[out]csThe return collection space object of creation.
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 replicaGroup 
)
inline

Create 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::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" ).
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::dropCollectionSpace ( const CHAR *  pCollectionSpaceName)
inline

Remove the specified collection space.

Parameters
[in]pCollectionSpaceNameThe name of collection space.
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::evalJS ( const CHAR *  code,
SDB_SPD_RES_TYPE type,
_sdbCursor **  cursor,
bson::BSONObj &  errmsg 
)
inline

INT32 evalJS( const CHAR *code, SDB_SPD_RES_TYPE &type, _sdbCursor **cursor, bson::BSONObj &errmsg ) brief eval a func. \ type is declared in spd.h. see SDB_FMP_RES_TYPE.

Parameters
[in]codeThe code to eval
[out]typeThe type of value
[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 result 
)
inline

Executing SQL command.

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

Executing SQL command for updating.

Parameters
[in]sqlThe SQL command.
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::getCollection ( const CHAR *  pCollectionFullName,
sdbCollection collection 
)
inline

Get the specified collection.

Parameters
[in]pCollectionFullNameThe full name of collection.
[out]collectionThe return collection object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getCollectionSpace ( const CHAR *  pCollectionSpaceName,
sdbCollectionSpace cs 
)
inline

Get the specified collection space.

Parameters
[in]pCollectionSpaceNameThe name of collection space.
[out]csThe return collection space object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
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::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_USERS            : Get all the user 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 result 
)
inline

Get the specified replica group.

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

Get the specified replica group.

Parameters
[in]idThe id of replica group.
[out]resultThe sdbReplicaGroup object.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::getSessionAttr ( bson::BSONObj &  result)
inline

Get the attributes of the session.

Parameters
[out]resultThe return bson object
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
[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]hintReserved.
[in]numToSkipReserved.
[in]numToReturnReserved.
[out]cursorThe return cursor object of query.
Return values
SDB_OKOperation Success
OthersOperation Fail
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":["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.
[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 result)
inline

list all collections in current database.

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

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

Parameters
[out]resultThe return cursor object of query.
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 result)
inline

List all replica groups of current database.

Parameters
[out]resultThe 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::removeBackup ( const bson::BSONObj &  options)
inline

Remove the backups.

Parameters
[in]optionsContains configuration infomations for removing 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::resetSnapshot ( const bson::BSONObj &  condition = _sdbStaticObject)
inline

Reset the snapshot.

Parameters
[in]conditionThe control 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::setSessionAttr ( const bson::BSONObj &  options = _sdbStaticObject)
inline

Set the attributes of the session.

Parameters
[in]optionsThe configuration options for session.The options are as below:
PreferedInstance : Preferred instance for read request in the current session. Could be single value in "M", "m", "S", "s", "A", "a", 1-255, or BSON Array to include multiple values.
                   e.g. { "PreferedInstance" : [ 1, 7 ] }.
                   "M", "m": read and write instance( master instance ). If multiple numeric instances are given with "M", matched master instance will be chosen in higher priority. If multiple numeric instances are given with "M" or "m", master instance will be chosen if no numeric instance is matched.
                   "S", "s": read only instance( slave instance ). If multiple numeric instances are given with "S", matched slave instances will be chosen in higher priority. If multiple numeric instances are given with "S" or "s", slave instance will be chosen if no numeric instance is matched.
                   "A", "a": any instance.
                   1-255: the instance with specified instance ID.
                   If multiple alphabet instances are given, only first one will be used.
                   If matched instance is not found, will choose instance by random.
PreferedInstanceMode : The mode to choose query instance when multiple preferred instances are found in the current session.
                       e.g. { "PreferedInstanceMode : "random" }.
                       "random": choose the instance from matched instances by random.
                       "ordered": choose the instance from matched instances by the order of "PreferedInstance".
Timeout : The timeout (in ms) for operations in the current session. -1 means no timeout for operations.
          e.g. { "Timeout" : 10000 }.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::transactionBegin ( )
inline

Transaction commit.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::transactionCommit ( )
inline

Transaction commit.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdb::transactionRollback ( )
inline

Transaction rollback.

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: