Public Member Functions | |
| def | __init__ |
| def | __del__ |
| def | __repr__ |
| def | get_nodenum |
| def | get_detail |
| def | get_master |
| def | get_slave |
| def | get_nodebyendpoint |
| def | get_nodebyname |
| def | create_node |
| def | remove_node |
| def | start |
| def | stop |
| def | is_catalog |
| def | attach_node |
| def | detach_node |
Replica group of SequoiaDB
All operation need deal with the error code returned first, if it has.
Every error code is not SDB_OK(or 0), it means something error has appeared,
and user should deal with it according the meaning of error code printed.
@version: execute to get version
>>> import pysequoiadb
>>> print pysequoiadb.get_version()
@notice : The dict of built-in Python is hashed and non-ordered. so the
element in dict may not the order we make it. we make a dict and
print it like this:
...
>>> a = {"avg_age":24, "major":"computer science"}
>>> a
>>> {'major': 'computer science', 'avg_age': 24}
...
the elements order it is not we make it!!
therefore, we use bson.SON to make the order-sensitive dict if the
order is important such as operations in "$sort", "$group",
"split_by_condition", "aggregate","create_collection"...
In every scene which the order is important, please make it using
bson.SON and list. It is a subclass of built-in dict
and order-sensitive
| def pysequoiadb.replicagroup.replicagroup.__init__ | ( | self, | |
| client | |||
| ) |
constructor of replica group Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.__del__ | ( | self | ) |
release replica group object Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.attach_node | ( | self, | |
| hostname, | |||
| servicename, | |||
| dbpath, | |||
config = None |
|||
| ) |
Attach node in a given replica group. Parameters: Name Type Info: hostname str The host name for the node. servicename str The servicename for the node. config dict The configurations for the node. Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.create_node | ( | self, | |
| hostname, | |||
| servicename, | |||
| dbpath, | |||
config = None |
|||
| ) |
Create node in a given replica group. Parameters: Name Type Info: hostname str The host name for the node. servicename str The servicename for the node. dbpath str The database path for the node. config dict The configurations for the node. Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.detach_node | ( | self, | |
| hostname, | |||
| servicename, | |||
config = None |
|||
| ) |
Detach node in a given replica group. Parameters: Name Type Info: hostname str The host name for the node. servicename str The servicename for the node. config dict The configurations for the node. Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.get_detail | ( | self | ) |
Get the detail of the replica group. Return values: a dict object of query Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.get_master | ( | self | ) |
Get the master node of the current replica group. Return values: a replicanode object of query Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.get_nodebyendpoint | ( | self, | |
| hostname, | |||
| servicename | |||
| ) |
Get specified node from current replica group. Parameters: Name Type Info: hostname str The host name of the node. servicename str The service name of the node. Return values: a replicanode object of query Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.get_nodebyname | ( | self, | |
| nodename | |||
| ) |
Get specified node from current replica group. Parameters: Name Type Info: nodename str The host name of the node. Return values: a replicanode object of query Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.get_nodenum | ( | self, | |
| nodestatus | |||
| ) |
Get the count of node with given status in current replica group. Parameters: Name Type Info: nodestatus int The specified status, see Info as below. Return values: the count of node Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError Info: flags : 0 or 1. 0 : count of all node 1 : count of actived node 2 : count of inactived node 3 : count of unknown node
| def pysequoiadb.replicagroup.replicagroup.get_slave | ( | self | ) |
Get one of slave node of the current replica group, if no slave exists then get master. Return values: a replicanode object of query Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.is_catalog | ( | self | ) |
Test whether current replica group is catalog replica group. Return values: bool Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.remove_node | ( | self, | |
| hostname, | |||
| servicename, | |||
config = None |
|||
| ) |
Remove node in a given replica group. Parameters: Name Type Info: hostname str The host name for the node. servicename str The servicename for the node. config dict The configurations for the node. Exceptions: pysequoiadb.error.SDBTypeError pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.start | ( | self | ) |
Start up current replica group. Exceptions: pysequoiadb.error.SDBBaseError
| def pysequoiadb.replicagroup.replicagroup.stop | ( | self | ) |
Stop current replica group. Exceptions: pysequoiadb.error.SDBBaseError
1.8.2