Struct fluvio::config::Config [−][src]
pub struct Config { pub profile: HashMap<String, Profile>, pub cluster: HashMap<String, FluvioConfig>, // some fields omitted }
Fields
profile: HashMap<String, Profile>
cluster: HashMap<String, FluvioConfig>
Implementations
create new config with a single local cluster
add new cluster
current profile
set current profile, if profile doesn’t exists return false
delete profile
Deletes the named cluster, whether it is being used or not.
You may want to check if the named cluster is active or not using
delete_cluster_check
. Otherwise, you may remove a cluster that
is being used by the active profile.
Example
let mut config = Config::new(); let cluster = FluvioConfig::new("https://cloud.fluvio.io".to_string()); config.add_cluster(cluster, "fluvio-cloud".to_string()); let profile = Profile::new("fluvio-cloud".to_string()); config.add_profile(profile, "fluvio-cloud".to_string()); config.delete_cluster("fluvio-cloud").unwrap(); assert!(config.cluster("fluvio-cloud").is_none());
Checks whether it’s safe to delete the named cluster
If there are any profiles that reference the named cluster,
they are considered conflicts and the cluster is unsafe to delete.
When conflicts exist, the conflicting profile names are returned
in the Err()
return value.
If there are no profile conflicts, this returns with Ok(())
.
Example
let mut config = Config::new(); let cluster = FluvioConfig::new("https://cloud.fluvio.io".to_string()); config.add_cluster(cluster, "fluvio-cloud".to_string()); let profile = Profile::new("fluvio-cloud".to_string()); config.add_profile(profile, "fluvio-cloud".to_string()); let conflicts = config.delete_cluster_check("fluvio-cloud").unwrap_err(); assert_eq!(conflicts, vec!["fluvio-cloud"]);
Returns a reference to the current Profile if there is one.
Returns a mutable reference to the current Profile if there is one.
Returns the FluvioConfig belonging to the current profile.
Returns the FluvioConfig belonging to the named profile.
Returns a reference to the named FluvioConfig.
Returns a mutable reference to the named FluvioConfig.
look up replica config this will iterate and find all configuration that can resolve config
- match all config that matches criteria including asterik
- apply in terms of precedent
Trait Implementations
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Config
impl UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more