Cobalt package¶
Cobalt¶
-
class
cobalt.Cobalt(config)¶ Bases:
utils.service.ServiceMain service class responsible for setting up and managing all Cobalt components.
-
VERSION= '0.1'¶ Version of the current Cobalt app, used to ensure consistency inside the cluster.
-
_attach_handlers()¶ Utility method to ensure graceful stops when receiving termination signals.
-
static
_create_etcd(context)¶ Factory method for creating the etcd.Client to be used inside the app.
Parameters: context (dict) – The config for the client Returns: Client to be used by the APP Return type: etcd.Client
-
static
_create_machine_manager(etcd_client)¶ Factory method for creating the MachineManager to be used inside the app.
Parameters: etcd_client (etcd.Client) – The client responsible for communicating with the database Returns: The machine manager to be used by the APP Return type: MachineManager
-
static
_create_volume_manager(etcd_client)¶ Factory method for creating the VolumeManger to be used inside the app.
Parameters: etcd_client (etcd.Client) – The client responsible for communicating with the database Returns: The volume manager to be used by the APP Return type: VolumeManager
-
_ensure_versions_match()¶ Makes sure the versions match (the defined one and one remote).
If this is the first node it will write its version upstream
Returns: If the versions match or not Return type: bool
-
_handler(*_)¶ The handler that will execute when a signal is caught. Purpose: stopping the node.
-
_write_version()¶ Utility method to write current version upstream.
Returns: If the write operation was successful or not Return type: bool
-
filter_services()¶ It will only take the services present in the config given to Cobalt.
-
setup_services()¶ A method to prepare the possible services that Cobalt can have.
-
start()¶ Starts Cobalt only if the ETCD versions match with the defined one.
Returns: If the start operation succeded or not Return type: bool
-
stop()¶ A means to gracefully stop all services registered to Cobalt.
Returns: Returns true in any occasion Return type: bool
-