pub trait SeedsProvider: Send + Sync {
// Required method
fn fetch(&self) -> Result<Vec<ConfDynSeed>, SeedsError>;
// Provided method
fn refresh_interval(&self) -> Duration { ... }
}Expand description
Pluggable seeds provider.
The trait is the embed-API mirror of
crate::seeds::SeedsProvider; the in-crate providers are
re-exported below as default implementations.
§Examples
use dynomite::embed::hooks::{SeedsProvider, SimpleSeedsProvider};
use dynomite::conf::ConfDynSeed;
let sp = SimpleSeedsProvider::new(vec![ConfDynSeed::parse("h:1:r:d:1").unwrap()]);
assert_eq!(sp.fetch().unwrap().len(), 1);Required Methods§
Sourcefn fetch(&self) -> Result<Vec<ConfDynSeed>, SeedsError>
fn fetch(&self) -> Result<Vec<ConfDynSeed>, SeedsError>
Return the current list of seeds.
Provided Methods§
Sourcefn refresh_interval(&self) -> Duration
fn refresh_interval(&self) -> Duration
Refresh interval used by the gossip task between calls to
SeedsProvider::fetch.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".