Bedrock.ControlPlane.Director.Nodes (bedrock v0.5.2)

View Source

Manages node lifecycle and service discovery integration for the director.

This module handles the registration and tracking of services as nodes join and leave the cluster. It serves as the bridge between the coordinator's service discovery and the director's internal service representation.

Service Discovery Integration

Services discovered through the coordinator are registered directly in coordinator format without conversion. This unified approach maintains consistent service identity throughout the system while eliminating format translation overhead.

The coordinator format {kind, {otp_name, node}} flows directly from service registration through recovery phases, ensuring that service identity and location information remains consistent across all system components. Status information is tracked separately when needed, allowing the core service identity to remain simple and cacheable.

Node rejoin operations batch service registrations to minimize state transitions while maintaining atomic updates to the director's service directory.

Summary

Types

worker_creation_error()

@type worker_creation_error() ::
  {:node_lacks_capability, node(), :log | :materializer}
  | {:worker_creation_failed, any()}
  | {:worker_info_failed, any()}

Functions

add_running_service(t, node, service_info)

add_running_services(t, node, service_infos)

determine_dead_nodes(t, at)

maybe_add_node(t, node)

node_added_worker(t, node, info, at)

node_down(t, node)

ping_all_coordinators(t)

request_to_rejoin(t, node, capabilities, running_services, at)

request_worker_creation(t, node, worker_id, kind)

@spec request_worker_creation(
  Bedrock.ControlPlane.Director.State.t(),
  node(),
  Bedrock.Service.Worker.id(),
  :log | :materializer
) ::
  {:ok, Bedrock.ControlPlane.Director.running_service_info()}
  | {:error, worker_creation_error()}

update_capabilities(t, node, capabilities)

update_last_seen_at(t, node, at)

update_minimum_read_version(t, node, minimum_read_version)

@spec update_minimum_read_version(
  Bedrock.ControlPlane.Director.State.t(),
  node(),
  minimum_read_version :: Bedrock.version() | nil
) :: Bedrock.ControlPlane.Director.State.t()