SequoiaDB
 All Classes Namespaces Files Functions Variables Enumerations Properties Pages
Public Member Functions | Properties | List of all members
SequoiaDB.ReplicaGroup Class Reference

Database operation interfaces of replica group. More...

Public Member Functions

bool Stop ()
 Stop the current node.
 
bool Start ()
 Start the current node.
 
int GetNodeNum (SDBConst.NodeStatus status)
 Get the count of node with given status.
 
BsonDocument GetDetail ()
 Get the detail information of current group.
 
Node CreateNode (string hostName, int port, string dbpath, Dictionary< string, string > map)
 Create the replica node.
 
Node CreateNode (string hostName, int port, string dbpath, BsonDocument configure)
 Create the replica node.
 
void RemoveNode (string hostName, int port, BsonDocument configure)
 Remove the specified replica node.
 
Node GetMaster ()
 Get the master node of current group.
 
Node GetSlave ()
 Get the slave node, when have no slave node, return master node.
 
Node GetSlave (params int[] positions)
 Get the slave node in the specified positions, when have no slave node in the specified positions, return master node.
 
Node GetSlave (IList< int > positions)
 Get the slave node in the specified positions, when have no slave node in the specified positions, return master node.
 
bool IsNodeExist (string nodeName)
 Whether the specified node exists in current group or not.
 
bool IsNodeExist (string hostName, int port)
 Whether the specified node exists in current group or not.
 
Node GetNode (string nodeName)
 Get the node by node name.
 
Node GetNode (string hostName, int port)
 Get the node by host name and port.
 
void AttachNode (string hostName, int port, BsonDocument options)
 Attach a node to the group.
 
void DetachNode (string hostName, int port, BsonDocument options)
 Detach a node from the group.
 

Properties

Sequoiadb SequoiaDB [get]
 Return the sequoiadb handle of current group.
 
string GroupName [get]
 Return the name of current group.
 
int GroupID [get]
 Return the group ID of current group.
 
bool IsCatalog [get]
 Verify the role of current group.
 

Detailed Description

Database operation interfaces of replica group.

Member Function Documentation

void SequoiaDB.ReplicaGroup.AttachNode ( string  hostName,
int  port,
BsonDocument  options 
)
inline

Attach a node to the group.

Parameters
hostNameThe host name of node.
portThe port for the node.
optionsconfiguration for this operation, can not be null or empty, can be the follow options:
  • KeepData : Whether to keep the original data of the new node. This option has no default value. User should specify its value explicitly.
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
Node SequoiaDB.ReplicaGroup.CreateNode ( string  hostName,
int  port,
string  dbpath,
Dictionary< string, string >  map 
)
inline

Create the replica node.

Parameters
hostNameThe host name of node
portThe port of node
dbpathThe database path of node
mapThe other configure information of node
Returns
The Node object
Exceptions
SequoiaDB.BaseException
System.Exception
Deprecated:
we override this api by passing a "BsonDocument" instead of a "Dictionary"
Node SequoiaDB.ReplicaGroup.CreateNode ( string  hostName,
int  port,
string  dbpath,
BsonDocument  configure 
)
inline

Create the replica node.

Parameters
hostNameThe host name of node
portThe port of node
dbpathThe database path of node
configureThe other configure information of node
Returns
The Node object
Exceptions
SequoiaDB.BaseException
System.Exception
void SequoiaDB.ReplicaGroup.DetachNode ( string  hostName,
int  port,
BsonDocument  options 
)
inline

Detach a node from the group.

Parameters
hostNameThe host name of node.
portThe port for the node.
optionsconfiguration for this operation, can not be null or empty, can be the follow options:
  • 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.
Returns
void
Exceptions
SequoiaDB.BaseException
System.Exception
BsonDocument SequoiaDB.ReplicaGroup.GetDetail ( )
inline

Get the detail information of current group.

Returns
The detail information in BsonDocument object
Exceptions
SequoiaDB.BaseException
System.Exception
Node SequoiaDB.ReplicaGroup.GetMaster ( )
inline

Get the master node of current group.

Returns
The fitted node or null
Exceptions
SequoiaDB.BaseException
System.Exception
Node SequoiaDB.ReplicaGroup.GetNode ( string  nodeName)
inline

Get the node by node name.

Parameters
nodeNameThe node name
Returns
The fitted node or null
Exceptions
SequoiaDB.BaseException
System.Exception
Node SequoiaDB.ReplicaGroup.GetNode ( string  hostName,
int  port 
)
inline

Get the node by host name and port.

Parameters
hostNameThe host name
portThe port
Returns
The fitted node or null
Exceptions
SequoiaDB.BaseException
System.Exception
int SequoiaDB.ReplicaGroup.GetNodeNum ( SDBConst.NodeStatus  status)
inline

Get the count of node with given status.

Parameters
statusThe specified status as below:
SDB_NODE_ALL
SDB_NODE_ACTIVE
SDB_NODE_INACTIVE
SDB_NODE_UNKNOWN
Returns
The count of node
Exceptions
SequoiaDB.BaseException
System.Exception
Deprecated:
Since v2.8, the status of node are invalid, never use this api again.
Node SequoiaDB.ReplicaGroup.GetSlave ( )
inline

Get the slave node, when have no slave node, return master node.

Returns
The fitted node.
Exceptions
SequoiaDB.BaseException
System.Exception
Node SequoiaDB.ReplicaGroup.GetSlave ( params int[]  positions)
inline

Get the slave node in the specified positions, when have no slave node in the specified positions, return master node.

Parameters
positionsThe positions of nodes. The position of a node is depended on the index of the node defined in catalog. But the beginning position of a node is start from 1 instead of 0, so it can be 1-7.
Returns
The fitted node.
Exceptions
SequoiaDB.BaseException
System.Exception
Node SequoiaDB.ReplicaGroup.GetSlave ( IList< int >  positions)
inline

Get the slave node in the specified positions, when have no slave node in the specified positions, return master node.

Parameters
positionsThe positions of nodes. The position of a node is depended on the index of the node defined in catalog. But the beginning position of a node is start from 1 instead of 0, so it can be 1-7.
Returns
The fitted node.
Exceptions
SequoiaDB.BaseException
System.Exception
bool SequoiaDB.ReplicaGroup.IsNodeExist ( string  nodeName)
inline

Whether the specified node exists in current group or not.

Parameters
nodeNameThe name of the node. e.g. "192.168.20.165:20000"
Returns
true or false.
bool SequoiaDB.ReplicaGroup.IsNodeExist ( string  hostName,
int  port 
)
inline

Whether the specified node exists in current group or not.

Parameters
hostNameThe hostname of the node.
portThe port of the node.
Returns
true or false.
void SequoiaDB.ReplicaGroup.RemoveNode ( string  hostName,
int  port,
BsonDocument  configure 
)
inline

Remove the specified replica node.

Parameters
hostNameThe host name of node
portThe port of node
configureThe configurations for the replica node
Exceptions
SequoiaDB.BaseException
System.Exception
bool SequoiaDB.ReplicaGroup.Start ( )
inline

Start the current node.

Returns
True if succeed or False if fail
Exceptions
SequoiaDB.BaseException
System.Exception
bool SequoiaDB.ReplicaGroup.Stop ( )
inline

Stop the current node.

Returns
True if succeed or False if fail
Exceptions
SequoiaDB.BaseException
System.Exception

Property Documentation

SequoiaDB.ReplicaGroup.GroupID
get

Return the group ID of current group.

Returns
The group ID
SequoiaDB.ReplicaGroup.GroupName
get

Return the name of current group.

Returns
The group name
SequoiaDB.ReplicaGroup.IsCatalog
get

Verify the role of current group.

Returns
True if is catalog group or False if not
SequoiaDB.ReplicaGroup.SequoiaDB
get

Return the sequoiadb handle of current group.

Returns
The Sequoiadb object

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