_confd.ha
index
(built-in)

Low level module for connecting to ConfD HA subsystem.
 
This module is used to connect to the ConfD High Availability (HA)
subsystem. ConfD can replicate the configuration data on several nodes
in a cluster. The purpose of this API is to manage the HA
functionality. The details on usage of the HA API are described in the
chapter High availability in the User Guide.
 
This documentation should be read together with the confd_lib_ha(3) man page.

 
Functions
       
bemaster(...)
bemaster(sock, mynodeid) -> None
 
Instruct a HA node to be master and also give the node a name.
 
Keyword arguments:
sock -- a previously connected HA socket
mynodeid -- name of the node (Value or string)
benone(...)
benone(sock) -> None
 
Instruct a node to resume the initial state, i.e. neither master nor slave.
 
Keyword arguments:
sock -- a previously connected HA socket
berelay(...)
berelay(sock) -> None
 
Instruct an established HA slave node to be a relay for other slaves.
 
Keyword arguments:
sock -- a previously connected HA socket
beslave(...)
beslave(sock, mynodeid, masterid, masterip, waitreply) -> None
 
Instruct a NCS HA node to be slave with a named master. If waitreply is True
the function is synchronous and it will hang until the node has initialized
its CDB database. This may mean that the CDB database is copied in its
entirety from the master. If False, we do not wait for the reply, but it is
possible to use a notifications socket and get notified asynchronously via
a HA_INFO_BESLAVE_RESULT notification. In both cases, it is also possible
to use a notifications socket and get notified asynchronously when CDB at
the slave is initialized.
 
Keyword arguments:
sock -- a previously connected HA socket
mynodeid -- name of this slave node (Value or string)
masterid -- name of the master node (Value or string)
masterip -- ip address of the master node
waitreply -- synchronous or not (bool)
connect(...)
ha_connect(sock, token, ip, port, pstr) -> None
 
Connect a HA socket which can be used to control a NCS HA node. The token
is a secret string that must be shared by all participants in the cluster.
There can only be one HA socket towards NCS. A new call to
ha_connect() makes NCS close the previous connection and reset the token to
the new value.
 
Keyword arguments:
sock -- a Python socket instance
token -- secret string
ip -- the ip address if socket is AF_INET or AF_INET6 (optional)
port -- the port if socket is AF_INET or AF_INET6 (optional)
pstr -- a filename if socket is AF_UNIX (optional).
slave_dead(...)
slave_dead(sock, nodeid) -> None
 
This function must be used by the application to inform NCS HA subsystem
that another node which is possibly connected to NCS is dead.
 
Keyword arguments:
sock -- a previously connected HA socket
nodeid -- name of the node (Value or string)
status(...)
status(sock) -> None
 
Query a ConfD HA node for its status.
 
Returns a 2-tuple of the HA status of the node in the format
(State,[list_of_nodes]) where 'list_of_nodes' is the master/slave(s)
connected with node.
 
Keyword arguments:
sock -- a previously connected HA socket

 
Data
        STATE_MASTER = 3
STATE_NONE = 1
STATE_SLAVE = 2
STATE_SLAVE_RELAY = 4