Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjstone committed Nov 7, 2024
1 parent ffde993 commit 80590bd
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion nexus/types/src/deployment/blueprint_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,48 @@ impl ClickhouseClusterConfigDiffTables {
/// The "before" inventory collection or blueprint does not have a relevant
/// keeper configuration.
pub fn added_to_blueprint(after: &ClickhouseClusterConfig) -> Self {
todo!()
let rows: Vec<_> = [
(GENERATION, after.generation.to_string()),
(
CLICKHOUSE_MAX_USED_SERVER_ID,
after.max_used_server_id.to_string(),
),
(
CLICKHOUSE_MAX_USED_KEEPER_ID,
after.max_used_keeper_id.to_string(),
),
(CLICKHOUSE_CLUSTER_NAME, after.cluster_name.clone()),
(CLICKHOUSE_CLUSTER_SECRET, after.cluster_secret.clone()),
(
CLICKHOUSE_HIGHEST_SEEN_KEEPER_LEADER_COMMITTED_LOG_INDEX,
after
.highest_seen_keeper_leader_committed_log_index
.to_string(),
),
]
.into_iter()
.map(|(key, val)| KvPair::new(BpDiffState::Added, key, val))
.collect();

let metadata =
KvListWithHeading::new(CLICKHOUSE_CLUSTER_CONFIG_HEADING, rows);

let keepers = BpSledSubtable::new(
BpClickhouseKeepersSubtableSchema {},
BpGeneration::Value(after.generation),
(after.generation, &after.keepers)
.rows(BpDiffState::Added)
.collect(),
);
let servers = Some(BpSledSubtable::new(
BpClickhouseServersSubtableSchema {},
BpGeneration::Value(after.generation),
(after.generation, &after.servers)
.rows(BpDiffState::Added)
.collect(),
));

ClickhouseClusterConfigDiffTables { metadata, keepers, servers }
}

/// We are diffing two `Blueprint`s, but The latest bluerprint does not have
Expand Down

0 comments on commit 80590bd

Please sign in to comment.