DeribitEx.TimeSyncSupervisor (deribit_ex v0.2.0)
View SourceSupervisor for the TimeSyncService.
This supervisor is responsible for starting and supervising TimeSyncService processes. It ensures that the services restart properly if they crash.
Usage
# Start the supervisor
{:ok, supervisor_pid} = DeribitEx.TimeSyncSupervisor.start_link([])
# Start a time sync service for a client
{:ok, service_pid} = DeribitEx.TimeSyncSupervisor.start_service(client_pid)
# Get the service name for a client
service_name = DeribitEx.TimeSyncSupervisor.service_name(client_pid)
Summary
Types
Options for starting a TimeSyncService.
Functions
Returns a specification to start this module under a supervisor.
Gets the TimeSyncService for a specific client connection.
Starts the TimeSyncSupervisor.
Starts a new TimeSyncService for a given client connection.
Types
@type service_options() :: DeribitEx.TimeSyncService.start_options()
Options for starting a TimeSyncService.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Gets the TimeSyncService for a specific client connection.
Parameters
client_pid
- The PID of the Client connection
Returns
- The name of the TimeSyncService for the given client
@spec start_link(term()) :: Supervisor.on_start()
Starts the TimeSyncSupervisor.
Parameters
init_arg
- Initialization arguments for the supervisor
Returns
{:ok, pid}
- The PID of the started supervisor{:error, reason}
- If the supervisor could not be started
@spec start_service(pid(), service_options()) :: DynamicSupervisor.on_start_child()
Starts a new TimeSyncService for a given client connection.
Parameters
client_pid
- The PID of the Client connectionopts
- Options for the time sync service (passed to TimeSyncService.start_link/2)
Returns
{:ok, pid}
- The PID of the started service{:error, reason}
- If the service could not be started