fn parse(s: &Option<String>) -> Result<Self, AE>;
}
+impl Parseable for Duration {
+ #[throws(AE)]
+ fn parse(s: &Option<String>) -> Duration {
+ let s = s.as_ref().ok_or_else(|| anyhow!("value needed"))?;
+ if let Ok(u64) = s.parse() { return Duration::from_secs(u64) }
+ throw!(anyhow!("xxx parse with humantime"))
+ }
+}
+
impl<'c> ResolveContext<'c> {
fn first_of_raw(&self, key: &'static str, sections: &[SectionName])
-> Option<&'c RawVal> {
}
}
-/*
-fn resolve_instance_config() {
- InstanceConfig {
- max_batch_down: resolve::limited(&agg, "max_batch_down")?.into()
+impl<'c> ResolveContext<'c> {
+ #[throws(AE)]
+ fn resolve_instance(&self) -> InstanceConfig {
+ InstanceConfig {
+ max_batch_down: self.limited::<u32>("max_batch_down")?.into(),
+ }
}
}
-*/
#[throws(AE)]
pub fn read() {