SequoiaDB
|
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. | |
Database operation interfaces of replica group.
|
inline |
Attach a node to the group.
[in] | pHostName | The host name of node. |
[in] | pSvcName | The service name of node. |
[in] | options | The 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create node in a given replica group.
[in] | pHostName | The hostname for the node |
[in] | pServiceName | The servicename for the node |
[in] | pDatabasePath | The database path for the node |
[in] | configure | The configurations for the node |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Create node in a given replica group.
[in] | pHostName | The hostname for the node |
[in] | pServiceName | The servicename for the node |
[in] | pDatabasePath | The database path for the node |
[in] | options | The configurations for the node |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Detach a node from the group.
[in] | pHostName | The host name of node. |
[in] | pSvcName | The service name of node. |
[in] | options | The 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. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the detail of the replica group.
[out] | result | Return the all the info of current replica group. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the master node of the current replica group.
[out] | node | The master node.If not exit,return null. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the name of current replica group.
The | name of current replica group or null if fail |
|
inline |
Get specified node from current replica group.
[in] | pNodeName | The name of the node, with the format of "hostname:port". |
[out] | node | The specified node. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get specified node from current replica group.
[in] | pHostName | The host name of the node. |
[in] | pServiceName | The service name of the node. |
[out] | node | The specified node. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get the count of node with given status in current replica group.
[in] | status | The specified status as below SDB_NODE_ALL SDB_NODE_ACTIVE SDB_NODE_INACTIVE SDB_NODE_UNKNOWN |
[out] | num | The count of node. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Get one of slave node of the current replica group, if no slave exists then get master.
[in] | positions | The positions of nodes |
[out] | node | The slave node |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Test whether current replica group is catalog replica group.
TRUE | The replica group is catalog |
FALSE | The replica group is not catalog |
|
inline |
Force the replica group to reelect primary node.
[in] | options | The options of reelection. Please reference here for more detail. |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
remove node in a given replica group.
[in] | pHostName | The hostname for the node |
[in] | pServiceName | The servicename for the node |
[in] | configure | The configurations for the node |
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Start up current replica group.
SDB_OK | Operation Success |
Others | Operation Fail |
|
inline |
Stop current replica group.
SDB_OK | Operation Success |
Others | Operation Fail |
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.