Bedrock.SystemKeys (bedrock v0.6.0)
View SourceCentralized definition of all system keys used for cluster configuration and transaction system layout persistence.
This module provides a single source of truth for system key names, preventing magic strings from being scattered throughout the codebase.
Key Categories
- Cluster Configuration: Static cluster settings (coordinators, policies, parameters)
- Transaction Layout: Dynamic transaction system state (sequencer, proxies, resolvers, logs, storage)
- Legacy Compatibility: Monolithic keys for backward compatibility and coordinator handoff
Summary
Functions
Returns all cluster configuration keys as a list. Useful for batch operations or validation.
Returns all legacy compatibility keys as a list. Useful for migration and cleanup operations.
List of coordinator nodes in the cluster
Current cluster epoch number
Cluster parameter: desired number of commit proxies
Cluster parameter: desired number of coordinators
Cluster parameter: desired number of logs
Cluster parameter: desired number of read version proxies
Cluster parameter: desired replication factor
Cluster parameter: empty transaction timeout in milliseconds
Cluster parameter: ping rate in Hz
Cluster parameter: retransmission rate in Hz
Cluster parameter: transaction window in milliseconds
Cluster policy: allow volunteer nodes to join
Monolithic cluster configuration (for coordinator epoch handoff)
Legacy epoch key (use cluster_epoch instead)
Legacy last recovery timestamp (use recovery_last_completed instead)
Transaction system layout ID
Configuration for a specific log by ID
All log configurations (for range queries)
Map of all services in the transaction system
Materializers for a key range (ceiling search by end_key)
Prefix for materializer_keys (for range queries)
Parses a system key and extracts its type and parameter.
Current recovery attempt number
Timestamp of last successful recovery
Current recovery state
Shard metadata by tag
Shard key mapping (ceiling search by end_key) -> tag
Prefix for shard_keys (for range queries)
Prefix for shards (for range queries)
Checks if a key is a system key (starts with the system prefix).
Returns the system key prefix.
Functions
@spec all_cluster_keys() :: [Bedrock.key()]
Returns all cluster configuration keys as a list. Useful for batch operations or validation.
@spec all_legacy_keys() :: [Bedrock.key()]
Returns all legacy compatibility keys as a list. Useful for migration and cleanup operations.
@spec cluster_coordinators() :: Bedrock.key()
List of coordinator nodes in the cluster
@spec cluster_epoch() :: Bedrock.key()
Current cluster epoch number
@spec cluster_parameters_desired_commit_proxies() :: Bedrock.key()
Cluster parameter: desired number of commit proxies
@spec cluster_parameters_desired_coordinators() :: Bedrock.key()
Cluster parameter: desired number of coordinators
@spec cluster_parameters_desired_logs() :: Bedrock.key()
Cluster parameter: desired number of logs
@spec cluster_parameters_desired_read_version_proxies() :: Bedrock.key()
Cluster parameter: desired number of read version proxies
@spec cluster_parameters_desired_replication() :: Bedrock.key()
Cluster parameter: desired replication factor
@spec cluster_parameters_empty_transaction_timeout_ms() :: Bedrock.key()
Cluster parameter: empty transaction timeout in milliseconds
@spec cluster_parameters_ping_rate_in_hz() :: Bedrock.key()
Cluster parameter: ping rate in Hz
@spec cluster_parameters_retransmission_rate_in_hz() :: Bedrock.key()
Cluster parameter: retransmission rate in Hz
@spec cluster_parameters_transaction_window_in_ms() :: Bedrock.key()
Cluster parameter: transaction window in milliseconds
@spec cluster_policies_volunteer_nodes() :: Bedrock.key()
Cluster policy: allow volunteer nodes to join
@spec config_monolithic() :: Bedrock.key()
Monolithic cluster configuration (for coordinator epoch handoff)
@spec epoch_legacy() :: Bedrock.key()
Legacy epoch key (use cluster_epoch instead)
@spec last_recovery_legacy() :: Bedrock.key()
Legacy last recovery timestamp (use recovery_last_completed instead)
@spec layout_id() :: Bedrock.key()
Transaction system layout ID
@spec layout_log(Bedrock.service_id()) :: Bedrock.key()
Configuration for a specific log by ID
@spec layout_logs_prefix() :: Bedrock.key()
All log configurations (for range queries)
@spec layout_services() :: Bedrock.key()
Map of all services in the transaction system
@spec materializer_key(end_key :: Bedrock.key()) :: Bedrock.key()
Materializers for a key range (ceiling search by end_key)
@spec materializer_keys_prefix() :: Bedrock.key()
Prefix for materializer_keys (for range queries)
@spec parse_key(Bedrock.key()) :: {:layout_log, String.t()} | {:shard_key, String.t()} | {:shard, String.t()} | {:materializer_key, String.t()} | :unknown | :error
Parses a system key and extracts its type and parameter.
Returns:
{:layout_log, log_id}for log keys{:shard_key, end_key}for shard key mappings{:shard, tag}for shard metadata keys{:materializer_key, end_key}for materializer keys:unknownfor unrecognized system keys:errorfor non-system keys
@spec recovery_attempt() :: Bedrock.key()
Current recovery attempt number
@spec recovery_last_completed() :: Bedrock.key()
Timestamp of last successful recovery
@spec recovery_state() :: Bedrock.key()
Current recovery state
@spec shard(tag :: non_neg_integer()) :: Bedrock.key()
Shard metadata by tag
@spec shard_key(end_key :: Bedrock.key()) :: Bedrock.key()
Shard key mapping (ceiling search by end_key) -> tag
@spec shard_keys_prefix() :: Bedrock.key()
Prefix for shard_keys (for range queries)
@spec shards_prefix() :: Bedrock.key()
Prefix for shards (for range queries)
@spec system_key?(Bedrock.key()) :: boolean()
@spec system_key?(term()) :: boolean()
Checks if a key is a system key (starts with the system prefix).
@spec system_prefix() :: Bedrock.key()
Returns the system key prefix.