Struct fluvio::config::Config [−][src]
Fields
profile: HashMap<String, Profile>
cluster: HashMap<String, FluvioConfig>
Implementations
impl Config
[src]
pub fn new() -> 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]
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]
current profile
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]
delete profile
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]
&mut self,
cluster_name: &str
) -> Result<(), Vec<&str>>
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]
Returns a reference to the current Profile if there is one.
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]
Returns the FluvioConfig belonging to the current profile.
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]
Returns a reference to the named FluvioConfig.
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]
&self,
_topic_name: &str,
_partition: i32
) -> Replica
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 Debug for Config
[src]
impl Default for Config
[src]
impl<'de> Deserialize<'de> for Config
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<Config> for Config
[src]
impl Serialize for Config
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Config
[src]
Auto Trait Implementations
impl RefUnwindSafe for Config
[src]
impl Send for Config
[src]
impl Sync for Config
[src]
impl Unpin for Config
[src]
impl UnwindSafe for Config
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,