Factor usage of common error type more
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use serde::Deserialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Range {
|
||||
#[serde(rename = "type")]
|
||||
ty: String,
|
||||
@@ -12,10 +12,10 @@ pub struct Range {
|
||||
|
||||
// TODO implement Deserialize such that I recognize the different possible formats...
|
||||
// I guess, when serializing, it's ok to use the fully qualified format throughout.
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ChannelList {}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Query {
|
||||
range: Range,
|
||||
channels: ChannelList,
|
||||
|
||||
@@ -1446,3 +1446,73 @@ pub fn f64_close(a: f64, b: f64) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test_cluster() -> Cluster {
|
||||
let nodes = (0..3)
|
||||
.into_iter()
|
||||
.map(|id| Node {
|
||||
host: "localhost".into(),
|
||||
listen: "0.0.0.0".into(),
|
||||
port: 6170 + id as u16,
|
||||
port_raw: 6170 + id as u16 + 100,
|
||||
data_base_path: format!("../tmpdata/node{:02}", id).into(),
|
||||
cache_base_path: format!("../tmpdata/node{:02}", id).into(),
|
||||
ksprefix: "ks".into(),
|
||||
backend: "testbackend".into(),
|
||||
splits: None,
|
||||
archiver_appliance: None,
|
||||
channel_archiver: None,
|
||||
})
|
||||
.collect();
|
||||
Cluster {
|
||||
nodes,
|
||||
database: Database {
|
||||
host: "localhost".into(),
|
||||
name: "testingdaq".into(),
|
||||
user: "testingdaq".into(),
|
||||
pass: "testingdaq".into(),
|
||||
},
|
||||
run_map_pulse_task: false,
|
||||
is_central_storage: false,
|
||||
file_io_buffer_size: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sls_test_cluster() -> Cluster {
|
||||
let nodes = (0..1)
|
||||
.into_iter()
|
||||
.map(|id| Node {
|
||||
host: "localhost".into(),
|
||||
listen: "0.0.0.0".into(),
|
||||
port: 6190 + id as u16,
|
||||
port_raw: 6190 + id as u16 + 100,
|
||||
data_base_path: format!("NOdatapath{}", id).into(),
|
||||
cache_base_path: format!("../tmpdata/node{:02}", id).into(),
|
||||
ksprefix: "NOKS".into(),
|
||||
backend: "sls-archive".into(),
|
||||
splits: None,
|
||||
archiver_appliance: None,
|
||||
channel_archiver: Some(ChannelArchiver {
|
||||
data_base_paths: vec![PathBuf::from("/data/daqbuffer-testdata/sls/gfa03")],
|
||||
database: Database {
|
||||
host: "localhost".into(),
|
||||
name: "testingdaq".into(),
|
||||
user: "testingdaq".into(),
|
||||
pass: "testingdaq".into(),
|
||||
},
|
||||
}),
|
||||
})
|
||||
.collect();
|
||||
Cluster {
|
||||
nodes,
|
||||
database: Database {
|
||||
host: "localhost".into(),
|
||||
name: "testingdaq".into(),
|
||||
user: "testingdaq".into(),
|
||||
pass: "testingdaq".into(),
|
||||
},
|
||||
run_map_pulse_task: false,
|
||||
is_central_storage: false,
|
||||
file_io_buffer_size: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user