mode.types.services — mode-ng 0.4.0 documentation

# `mode.types.services`

Type classes for `mode.services`.

class mode.types.services.DiagT(service: ServiceT)

  Diag keeps track of a services diagnostic flags.

  flags: set[str]
  last_transition: MutableMapping[str, float]
  abstract set_flag(flag: str) → None
  abstract unset_flag(flag: str) → None

class mode.types.services.ServiceT(*, beacon: Optional[NodeT] = None, loop: Optional[AbstractEventLoop] = None)

  Abstract type for an asynchronous service that can be started/stopped.

  See also

  `mode.Service`.

  Diag: Type[DiagT]
  abstract async add_async_context(context: AsyncContextManager) → Any
  abstract add_context(context: ContextManager) → Any
  abstract add_dependency(service: ServiceT) → ServiceT
  abstract async add_runtime_dependency(service: ServiceT) → ServiceT
  async_exit_stack: AsyncExitStack
  property beacon: NodeT
  abstract async crash(reason: BaseException) → None
  abstract property crash_reason: Optional[BaseException]
  abstract property crashed: bool
  diag: DiagT
  exit_stack: ExitStack
  abstract property label: str
  abstract property loop: AbstractEventLoop
  abstract async maybe_start() → bool
  abstract async restart() → None
  restart_count: int = 0
  abstract service_reset() → None
  abstract set_shutdown() → None
  abstract property shortlabel: str
  abstract property should_stop: bool
  shutdown_timeout: float
  abstract async start() → None
  abstract property started: bool
  abstract property state: str
  abstract async stop() → None
  supervisor: Optional[SupervisorStrategyT] = None
  wait_for_shutdown: bool = False
  abstract async wait_until_stopped() → None