Bedrock.ControlPlane.Coordinator.Commands (bedrock v0.5.3)
View SourceStructured command types for Raft consensus operations.
All coordinator operations that require consensus should use these structured commands instead of raw data.
Summary
Functions
Create a command to deregister services via consensus.
Create a command to end the previous epoch via consensus. This triggers the initial consensus round needed for director startup.
Create a command to MERGE node resources (services and capabilities) via consensus. MERGE semantics: adds/updates specified resources, preserves existing unspecified resources. Use for incremental service registration (e.g., individual worker advertisement).
Create a command to register services via consensus.
Create a command to SET node resources (services and capabilities) via consensus. SET semantics: completely replaces all resources for the specified node. Use for initial node registration or complete resource declarations.
Types
@type command() :: end_epoch_command() | set_node_resources_command() | merge_node_resources_command() | register_services_command() | deregister_services_command()
@type deregister_services_command() :: {:deregister_services, %{service_ids: [String.t()]}}
@type end_epoch_command() :: {:end_epoch, Bedrock.epoch() | nil}
@type merge_node_resources_command() :: {:merge_node_resources, %{ node: node(), services: [service_info()], capabilities: [Bedrock.Cluster.capability()] }}
@type register_services_command() :: {:register_services, %{services: [service_info()]}}
@type set_node_resources_command() :: {:set_node_resources, %{ node: node(), services: [service_info()], capabilities: [Bedrock.Cluster.capability()] }}
Functions
@spec deregister_services([String.t()]) :: deregister_services_command()
Create a command to deregister services via consensus.
@spec end_epoch(Bedrock.epoch() | nil) :: end_epoch_command()
Create a command to end the previous epoch via consensus. This triggers the initial consensus round needed for director startup.
@spec merge_node_resources(node(), [service_info()], [Bedrock.Cluster.capability()]) :: merge_node_resources_command()
Create a command to MERGE node resources (services and capabilities) via consensus. MERGE semantics: adds/updates specified resources, preserves existing unspecified resources. Use for incremental service registration (e.g., individual worker advertisement).
@spec register_services([service_info()]) :: register_services_command()
Create a command to register services via consensus.
@spec set_node_resources(node(), [service_info()], [Bedrock.Cluster.capability()]) :: set_node_resources_command()
Create a command to SET node resources (services and capabilities) via consensus. SET semantics: completely replaces all resources for the specified node. Use for initial node registration or complete resource declarations.