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

Database operation interfaces of replica group. More...

#include <client.hpp>

Public Member Functions

 sdbReplicaGroup ()
 Default constructor.
 
 ~sdbReplicaGroup ()
 Destructor.
 
INT32 getNodeNum (sdbNodeStatus status, INT32 *num)
 Get the count of node with given status in current replica group.
 
INT32 getDetail (bson::BSONObj &result)
 Get the detail of the replica group.
 
INT32 getMaster (sdbNode &node)
 Get the master node of the current replica group.
 
INT32 getSlave (sdbNode &node, const vector< INT32 > &positions=_sdbStaticVec)
 Get one of slave node of the current replica group, if no slave exists then get master.
 
INT32 getNode (const CHAR *pNodeName, sdbNode &node)
 Get specified node from current replica group.
 
INT32 getNode (const CHAR *pHostName, const CHAR *pServiceName, sdbNode &node)
 Get specified node from current replica group.
 
INT32 createNode (const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pDatabasePath, std::map< std::string, std::string > &config)
 Create node in a given replica group.
 
INT32 createNode (const CHAR *pHostName, const CHAR *pServiceName, const CHAR *pDatabasePath, const bson::BSONObj &options=_sdbStaticObject)
 Create node in a given replica group.
 
INT32 removeNode (const CHAR *pHostName, const CHAR *pServiceName, const bson::BSONObj &configure=_sdbStaticObject)
 remove node in a given replica group.
 
INT32 stop ()
 Stop current replica group.
 
INT32 start ()
 Start up current replica group.
 
const CHAR * getName ()
 Get the name of current replica group.
 
BOOLEAN isCatalog ()
 Test whether current replica group is catalog replica group.
 
INT32 attachNode (const CHAR *pHostName, const CHAR *pSvcName, const bson::BSONObj &options)
 Attach a node to the group.
 
INT32 detachNode (const CHAR *pHostName, const CHAR *pSvcName, const bson::BSONObj &options)
 Detach a node from the group.
 
INT32 reelect (const bson::BSONObj &options=_sdbStaticObject)
 Force the replica group to reelect primary node.
 

Public Attributes

_sdbReplicaGroup * pReplicaGroup
 A pointer of virtual base class _sdbReplicaGroup.
 

Detailed Description

Database operation interfaces of replica group.

Member Function Documentation

INT32 sdbclient::sdbReplicaGroup::attachNode ( const CHAR *  pHostName,
const CHAR *  pSvcName,
const bson::BSONObj &  options 
)
inline

Attach a node to the group.

Parameters
[in]pHostNameThe host name of node.
[in]pSvcNameThe service name of node.
[in]optionsThe options of attach. The options are as below:
KeepData : Whether to keep the original data of the new node.
           This option has no default value. User should specify
           its value explicitly.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::createNode ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pDatabasePath,
std::map< std::string, std::string > &  config 
)
inline

Create node in a given replica group.

Parameters
[in]pHostNameThe hostname for the node
[in]pServiceNameThe servicename for the node
[in]pDatabasePathThe database path for the node
[in]configureThe configurations for the node
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
we have override this api by passing a "BSONObj" instead of a "map"
INT32 sdbclient::sdbReplicaGroup::createNode ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const CHAR *  pDatabasePath,
const bson::BSONObj &  options = _sdbStaticObject 
)
inline

Create node in a given replica group.

Parameters
[in]pHostNameThe hostname for the node
[in]pServiceNameThe servicename for the node
[in]pDatabasePathThe database path for the node
[in]optionsThe configurations for the node
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::detachNode ( const CHAR *  pHostName,
const CHAR *  pSvcName,
const bson::BSONObj &  options 
)
inline

Detach a node from the group.

Parameters
[in]pHostNameThe host name of node.
[in]pSvcNameThe service name of node.
[in]optionsThe options of detach. The options are as below:
KeepData: Whether to keep the original data of the detached node.
          This option has no default value. User should specify
          its value explicitly.
Enforced: Whether to detach the node forcibly, default to be false.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::getDetail ( bson::BSONObj &  result)
inline

Get the detail of the replica group.

Parameters
[out]resultReturn the all the info of current replica group.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::getMaster ( sdbNode node)
inline

Get the master node of the current replica group.

Parameters
[out]nodeThe master node.If not exit,return null.
Return values
SDB_OKOperation Success
OthersOperation Fail
const CHAR * sdbclient::sdbReplicaGroup::getName ( )
inline

Get the name of current replica group.

Return values
Thename of current replica group or null if fail
INT32 sdbclient::sdbReplicaGroup::getNode ( const CHAR *  pNodeName,
sdbNode node 
)
inline

Get specified node from current replica group.

Parameters
[in]pNodeNameThe name of the node, with the format of "hostname:port".
[out]nodeThe specified node.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::getNode ( const CHAR *  pHostName,
const CHAR *  pServiceName,
sdbNode node 
)
inline

Get specified node from current replica group.

Parameters
[in]pHostNameThe host name of the node.
[in]pServiceNameThe service name of the node.
[out]nodeThe specified node.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::getNodeNum ( sdbNodeStatus  status,
INT32 *  num 
)
inline

Get the count of node with given status in current replica group.

Parameters
[in]statusThe specified status as below
SDB_NODE_ALL
SDB_NODE_ACTIVE
SDB_NODE_INACTIVE
SDB_NODE_UNKNOWN
[out]numThe count of node.
Return values
SDB_OKOperation Success
OthersOperation Fail
Deprecated:
Since v2.6, the status of node are invalid, never use this api again.
INT32 sdbclient::sdbReplicaGroup::getSlave ( sdbNode node,
const vector< INT32 > &  positions = _sdbStaticVec 
)
inline

Get one of slave node of the current replica group, if no slave exists then get master.

Parameters
[in]positionsThe positions of nodes
[out]nodeThe slave node
Return values
SDB_OKOperation Success
OthersOperation Fail
BOOLEAN sdbclient::sdbReplicaGroup::isCatalog ( )
inline

Test whether current replica group is catalog replica group.

Return values
TRUEThe replica group is catalog
FALSEThe replica group is not catalog
INT32 sdbclient::sdbReplicaGroup::reelect ( const bson::BSONObj &  options = _sdbStaticObject)
inline

Force the replica group to reelect primary node.

Parameters
[in]optionsThe options of reelection. Please reference here for more detail.
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::removeNode ( const CHAR *  pHostName,
const CHAR *  pServiceName,
const bson::BSONObj &  configure = _sdbStaticObject 
)
inline

remove node in a given replica group.

Parameters
[in]pHostNameThe hostname for the node
[in]pServiceNameThe servicename for the node
[in]configureThe configurations for the node
Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 INT32 sdbclient::sdbReplicaGroup::start ( )
inline

Start up current replica group.

Return values
SDB_OKOperation Success
OthersOperation Fail
INT32 sdbclient::sdbReplicaGroup::stop ( )
inline

Stop current replica group.

Return values
SDB_OKOperation Success
OthersOperation Fail

Member Data Documentation

sdbclient::sdbReplicaGroup::pReplicaGroup

A pointer of virtual base class _sdbReplicaGroup.

Class sdbReplicaGroup is a shell for _sdbReplicaGroup. We use pCursor to call the methods in class _sdbReplicaGroup.


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