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
) – thePrivateKey
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.
-
db_manager
¶ The db manager for appointments.
-
watcher
¶ The watcher instance.
- Type
-
watcher_thread
¶ After
bootstrap_components
, the thread that runs the Watcher monitoring (set toNone
beforehand).- Type
multithreading.Thread
-
responder_thread
¶ After
bootstrap_components
, the thread that runs the Responder monitoring (set toNone
beforehand).- Type
multithreading.Thread
-
chain_monitor
¶ The
ChainMonitor
instance.
-
self.
api_proc
¶ Once the rpc process is created, the instance of either
Popen
orProcess
that is serving the public API (set toNone
beforehand).- Type
subprocess.Popen
ormultiprocessing.Process
-
self.
rpc_process
¶ The instance of the internal RPC server; only set if running.
- Type
multiprocessing.Process
-
self.
internal_api
¶ The InternalAPI instance.
-
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.
-
start
()[source]¶ This method implements the whole lifetime cycle of the the TEOS tower. 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