teos.teosd

class TeosDaemon(config, sk, logger)[source]

Bases: object

The TeosDaemon organizes the code to initialize all the components of teos, start the service, stop and teardown.

Parameters
  • config (dict) – the configuration object.

  • sk (PrivateKey) – the PrivateKey of the tower.

  • logger (Logger) – the logger instance.

stop_command_event

The event that will be set to initiate a graceful shutdown.

Type

threading.Event

stop_event

The event that services running on different processes will monitor in order to be informed that they should shutdown.

Type

multiprocessing.Event

block_processor

The block processor instance.

Type

teos.block_processor.BlockProcessor

db_manager

The db manager for appointments.

Type

teos.appointments_dbm.AppointmentsDBM

watcher

The watcher instance.

Type

teos.watcher.Watcher

watcher_thread

After bootstrap_components, the thread that runs the Watcher monitoring (set to None beforehand).

Type

multithreading.Thread

responder_thread

After bootstrap_components, the thread that runs the Responder monitoring (set to None beforehand).

Type

multithreading.Thread

chain_monitor

The ChainMonitor instance.

Type

teos.chain_monitor.ChainMonitor

self.api_proc

Once the rpc process is created, the instance of either Popen or Process that is serving the public API (set to None beforehand).

Type

subprocess.Popen or multiprocessing.Process

self.rpc_process

The instance of the internal RPC server; only set if running.

Type

multiprocessing.Process

self.internal_api

The InternalAPI instance.

Type

teos.internal_api.InternalAPI

bootstrap_components()[source]

Performs the initial setup of the components. It loads the appointments and tracker for the watcher and the responder (if any), and awakes the components. It also populates the block queues with any missing data, in case the tower has been offline for some time. Finally, it starts the chain monitor.

handle_signals(signum, frame)[source]

Handles signals by initiating a graceful shutdown.

start()[source]

This method implements the whole lifetime cycle of the the TEOS tower. This method does not return.

start_services()[source]

Readies the tower by setting up signal handling, and starting all the services.

teardown()[source]

Shuts down all services and closes the DB, then exits. This method does not return.

get_config(command_line_conf, data_dir)[source]

Combines the command line config with the config loaded from the file and the default config in order to construct the final config object.

Parameters

command_line_conf (dict) – a collection of the command line parameters.

Returns

A dictionary containing all the system’s configuration parameters.

Return type

dict

main(config)[source]