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
impl Config
[src]
impl Config
[src]pub fn new() -> Self
[src]
pub fn new_with_local_cluster(domain: String) -> Self
[src]
pub fn new_with_local_cluster(domain: String) -> Self
[src]create new config with a single local cluster
pub fn add_cluster(&mut self, cluster: FluvioConfig, name: String)
[src]
pub fn add_cluster(&mut self, cluster: FluvioConfig, name: String)
[src]add new cluster
pub fn add_profile(&mut self, profile: Profile, name: String)
[src]
pub fn version(&self) -> &str
[src]
pub fn current_profile_name(&self) -> Option<&str>
[src]
pub fn current_profile_name(&self) -> Option<&str>
[src]current profile
pub fn set_current_profile(&mut self, profile_name: &str) -> bool
[src]
pub fn set_current_profile(&mut self, profile_name: &str) -> bool
[src]set current profile, if profile doesn’t exists return false
pub fn rename_profile(&mut self, from: &str, to: String) -> bool
[src]
pub fn delete_profile(&mut self, profile_name: &str) -> bool
[src]
pub fn delete_profile(&mut self, profile_name: &str) -> bool
[src]delete profile
pub fn delete_cluster(&mut self, cluster_name: &str) -> Option<FluvioConfig>
[src]
pub fn delete_cluster(&mut self, cluster_name: &str) -> Option<FluvioConfig>
[src]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());
pub fn delete_cluster_check(
&mut self,
cluster_name: &str
) -> Result<(), Vec<&str>>
[src]
pub fn delete_cluster_check(
&mut self,
cluster_name: &str
) -> Result<(), Vec<&str>>
[src]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"]);
pub fn current_profile(&self) -> Result<&Profile, FluvioError>
[src]
pub fn current_profile(&self) -> Result<&Profile, FluvioError>
[src]Returns a reference to the current Profile if there is one.
pub fn profile_mut(&mut self, profile_name: &str) -> Option<&mut Profile>
[src]
pub fn profile_mut(&mut self, profile_name: &str) -> Option<&mut Profile>
[src]Returns a mutable reference to the current Profile if there is one.
pub fn current_cluster(&self) -> Result<&FluvioConfig, FluvioError>
[src]
pub fn current_cluster(&self) -> Result<&FluvioConfig, FluvioError>
[src]Returns the FluvioConfig belonging to the current profile.
pub fn cluster_with_profile(&self, profile_name: &str) -> Option<&FluvioConfig>
[src]
pub fn cluster_with_profile(&self, profile_name: &str) -> Option<&FluvioConfig>
[src]Returns the FluvioConfig belonging to the named profile.
pub fn cluster(&self, cluster_name: &str) -> Option<&FluvioConfig>
[src]
pub fn cluster(&self, cluster_name: &str) -> Option<&FluvioConfig>
[src]Returns a reference to the named FluvioConfig.
pub fn cluster_mut(&mut self, cluster_name: &str) -> Option<&mut FluvioConfig>
[src]
pub fn cluster_mut(&mut self, cluster_name: &str) -> Option<&mut FluvioConfig>
[src]Returns a mutable reference to the named FluvioConfig.
pub fn resolve_replica_config(
&self,
_topic_name: &str,
_partition: i32
) -> Replica
[src]
pub fn resolve_replica_config(
&self,
_topic_name: &str,
_partition: i32
) -> Replica
[src]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
impl<'de> Deserialize<'de> for Config
[src]
impl<'de> Deserialize<'de> for Config
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Config
[src]
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> AsyncConnector for T where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,