pub struct Config {
pub backs: Vec<String>,
pub keepers: Vec<String>,
}Expand description
A config file defining the backend and keeper network addresses
Fields§
§backs: Vec<String>§keepers: Vec<String>Implementations§
Source§impl Config
impl Config
Sourcepub fn read(location: Option<&str>) -> TribResult<Config>
pub fn read(location: Option<&str>) -> TribResult<Config>
Reads from an optional path a tribbler configuration into a Config struct. If None is provided, DEFAULT_CONFIG_LOCATION is used.
Sourcepub fn write(&self, location: Option<&str>) -> TribResult<()>
pub fn write(&self, location: Option<&str>) -> TribResult<()>
Writes a Config out to a file at a particular location. If None is specified, the location is DEFAULT_CONFIG_LOCATION.
If the specified location is -, then it will write to stdout
Sourcepub fn back_count(&self) -> usize
pub fn back_count(&self) -> usize
gets the total number of backends in the config.
Sourcepub fn keeper_count(&self) -> usize
pub fn keeper_count(&self) -> usize
gets the total number of keepers in the config.
Sourcepub fn back_config(
&self,
idx: usize,
store: Box<dyn Storage + Send + Sync>,
ready: Option<Sender<bool>>,
shutdown: Option<Receiver<()>>,
) -> BackConfig
pub fn back_config( &self, idx: usize, store: Box<dyn Storage + Send + Sync>, ready: Option<Sender<bool>>, shutdown: Option<Receiver<()>>, ) -> BackConfig
build a BackConfig for the given index i in the list of backend
addresses. i must be a valid index in the list of backends.
You can choose to pass in a Sender where the receiving end of the channel can get a message when the backend using this configuration has started.
Sourcepub fn keeper_config(
&self,
i: usize,
ready: Option<Sender<bool>>,
shutdown: Option<Receiver<()>>,
) -> TribResult<KeeperConfig>
pub fn keeper_config( &self, i: usize, ready: Option<Sender<bool>>, shutdown: Option<Receiver<()>>, ) -> TribResult<KeeperConfig>
build a KeeperConfig for the given index i in the list of keeper
addresses. i must be a valid index into the list of keepers.
You can choose to pass in a Sender where the receiving end of the channel can get a message when the backend using this configuration has started.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request