Skip to content

Commit 729a898

Browse files
committed
ccm: delete NodeConfig fully
NodeConfig-related functionalities were not yet used anywhere, and we are in hurry during the hackathon. Let's give others the ccm framework without NodeConfig and add NodeConfig later if it appears to be useful.
1 parent b5c2d0c commit 729a898

File tree

4 files changed

+3
-425
lines changed

4 files changed

+3
-425
lines changed

scylla/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ rand_chacha = "0.3.1"
8888
time = "0.3"
8989
anyhow = "1.0.95"
9090
tokio = { version = "1.34", features = ["test-util", "fs", "process"] }
91-
serde_yaml = {version = "0.9.34"}
9291
tempfile = "3.16"
9392

9493
[[bench]]

scylla/tests/ccm_integration/ccm/cluster.rs

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ use crate::ccm::{IP_ALLOCATOR, ROOT_CCM_DIR};
22

33
use super::ip_allocator::NetPrefix;
44
use super::logged_cmd::{LoggedCmd, RunOptions};
5-
use super::node_config::NodeConfig;
65
use anyhow::{Context, Error};
76
use scylla::client::session_builder::SessionBuilder;
87
use std::collections::HashMap;
98
use std::net::IpAddr;
109
use std::path::{Path, PathBuf};
1110
use std::process::Command;
12-
use std::str::FromStr;
1311
use std::sync::Arc;
1412
use tempfile::TempDir;
1513
use tokio::fs::metadata;
@@ -42,8 +40,6 @@ pub(crate) struct ClusterOptions {
4240
pub(crate) smp: u16,
4341
/// Amount of MB for Scylla to occupy has to be bigger than smp*512
4442
pub(crate) memory: u32,
45-
/// scylla.yaml or cassandra.yaml
46-
pub(crate) config: NodeConfig,
4743
/// Don't call `ccm remove` when cluster instance is dropped
4844
pub(crate) do_not_remove_on_drop: bool,
4945
}
@@ -58,7 +54,6 @@ impl Default for ClusterOptions {
5854
nodes: Vec::new(),
5955
smp: DEFAULT_SMP,
6056
memory: DEFAULT_MEMORY,
61-
config: NodeConfig::default(),
6257
do_not_remove_on_drop: false,
6358
}
6459
}
@@ -219,23 +214,16 @@ impl NodeStopOptions {
219214
pub(crate) struct Node {
220215
status: NodeStatus,
221216
opts: NodeOptions,
222-
config: NodeConfig,
223217
logged_cmd: Arc<LoggedCmd>,
224218
/// A `--config-dir` for ccm
225219
config_dir: PathBuf,
226220
}
227221

228222
#[allow(dead_code)]
229223
impl Node {
230-
fn new(
231-
opts: NodeOptions,
232-
config: NodeConfig,
233-
logged_cmd: Arc<LoggedCmd>,
234-
config_dir: PathBuf,
235-
) -> Self {
224+
fn new(opts: NodeOptions, logged_cmd: Arc<LoggedCmd>, config_dir: PathBuf) -> Self {
236225
Node {
237226
opts,
238-
config,
239227
logged_cmd,
240228
status: NodeStatus::Stopped,
241229
config_dir,
@@ -259,25 +247,11 @@ impl Node {
259247
}
260248

261249
pub(crate) fn broadcast_rpc_address(&self) -> IpAddr {
262-
match self.config.get("broadcast_rpc_address", NodeConfig::Null) {
263-
NodeConfig::Null => self.opts.ip_prefix.to_ipaddress(self.opts.id),
264-
NodeConfig::String(value) => IpAddr::from_str(value.as_str())
265-
.with_context(|| format!("unexpected content of broadcast_rpc_address: {value}"))
266-
.unwrap(),
267-
other => {
268-
panic!("unexpected content of broadcast_rpc_address: {other:#?}")
269-
}
270-
}
250+
self.opts.ip_prefix.to_ipaddress(self.opts.id)
271251
}
272252

273253
pub(crate) fn native_transport_port(&self) -> u16 {
274-
match self.config.get("native_transport_port", NodeConfig::Null) {
275-
NodeConfig::Null => 9042,
276-
NodeConfig::Int(value) => value as u16,
277-
other => {
278-
panic!("unexpected content of native_transport_port: {other:#?}")
279-
}
280-
}
254+
9042
281255
}
282256

283257
fn get_ccm_env(&self) -> HashMap<String, String> {
@@ -364,34 +338,6 @@ impl Node {
364338
Ok(())
365339
}
366340

367-
pub(crate) async fn sync_config(&self) -> Result<(), Error> {
368-
let mut args = vec![
369-
self.opts.name(),
370-
"updateconf".to_string(),
371-
"--config-dir".to_string(),
372-
self.config_dir.to_string_lossy().to_string(),
373-
];
374-
375-
// converting config to space separated list of `key:value`
376-
// example:
377-
// value: 1.1.1.1
378-
// obj:
379-
// value2: 2.2.2.2
380-
// should become "value:1.1.1.1 obj.value2:2.2.2.2"
381-
let additional: Vec<String> = self
382-
.config
383-
.to_flat_string()
384-
.split_whitespace()
385-
.map(String::from)
386-
.collect();
387-
388-
args.extend(additional);
389-
self.logged_cmd
390-
.run_command("ccm", &args, RunOptions::new())
391-
.await?;
392-
Ok(())
393-
}
394-
395341
fn set_status(&mut self, status: NodeStatus) {
396342
self.status = status;
397343
}
@@ -524,7 +470,6 @@ impl Cluster {
524470
datacenter_id: datacenter_id.unwrap_or(1),
525471
..NodeOptions::from_cluster_opts(&self.opts)
526472
},
527-
self.opts.config.clone(),
528473
self.logged_cmd.clone(),
529474
self.config_dir().to_owned(),
530475
);

scylla/tests/ccm_integration/ccm/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pub(crate) mod cluster;
22
mod ip_allocator;
33
mod logged_cmd;
4-
pub(crate) mod node_config;
54

65
use std::future::Future;
76
use std::path::PathBuf;

0 commit comments

Comments
 (0)