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]

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]

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]

look up replica config this will iterate and find all configuration that can resolve config

  1. match all config that matches criteria including asterik
  2. apply in terms of precedent

Trait Implementations

impl Debug for Config[src]

impl Default for Config[src]

impl<'de> Deserialize<'de> for Config[src]

impl PartialEq<Config> for Config[src]

impl Serialize for Config[src]

impl StructuralPartialEq for Config[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]