Bedrock.Service.Worker (bedrock v0.5.2)
View SourceA worker is a GenServer that is started and stopped by a service director. It is expected to provide a set of facts about itself when requested along with other services (as befits the type of worker.)
Summary
Types
@type fact_name() :: :supported_info | :kind | :id | :health | :otp_name | :pid
@type fact_value() :: [fact_name()] | :log | :materializer | Bedrock.service_id() | health() | otp_name() | pid()
@type health() :: {:ok, pid()} | :stopped | {:error, :timeout | :unavailable}
@type id() :: Bedrock.service_id()
@type otp_name() :: atom()
@type timeout_in_ms() :: Bedrock.timeout_in_ms()
Functions
@spec info( worker_ref :: ref(), requested_facts :: [fact_name() | atom()], opts :: [{:timeout_in_ms, timeout_in_ms()}] ) :: {:ok, facts :: %{required(fact_name()) => fact_value()}} | {:error, :unavailable}
@spec lock_for_recovery( worker_ref :: ref(), recovery_epoch :: Bedrock.epoch(), opts :: [{:timeout_in_ms, timeout_in_ms()}] ) :: {:ok, worker_pid :: pid(), recovery_info :: [kind: :log | :materializer, version: Bedrock.version()]} | {:error, :newer_epoch_exists} | {:error, :timeout}
@spec random_id() :: binary()