#[derive(Debug, Clone)]
pub struct AggregatorSpec {
id: Option<String>,
correlation_header: String,
completion: String,
strategy: Option<String>,
store: Option<String>,
}
impl AggregatorSpec {
pub fn new<H: Into<String>, C: Into<String>>(correlation_header: H, completion: C) -> Self {
Self {
id: None,
correlation_header: correlation_header.into(),
completion: completion.into(),
strategy: None,
store: None,
}
}
pub fn with_id<I, H, C>(id: I, correlation_header: H, completion: C) -> Self
where
I: Into<String>,
H: Into<String>,
C: Into<String>,
{
Self {
id: Some(id.into()),
correlation_header: correlation_header.into(),
completion: completion.into(),
strategy: None,
store: None,
}
}
pub fn set_strategy<S: Into<String>>(mut self, strategy: S) -> Self {
self.strategy = Some(strategy.into());
self
}
pub fn set_store<S: Into<String>>(mut self, store: S) -> Self {
self.store = Some(store.into());
self
}
pub fn id(&self) -> Option<&str> {
self.id.as_deref()
}
pub fn correlation_header(&self) -> &str {
&self.correlation_header
}
pub fn completion(&self) -> &str {
&self.completion
}
pub fn strategy(&self) -> Option<&str> {
self.strategy.as_deref()
}
pub fn store(&self) -> Option<&str> {
self.store.as_deref()
}
pub fn set_id(&mut self, id: String) {
self.id = Some(id);
}
}