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]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Config[src]

fn default() -> Config[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for Config[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 PartialEq<Config> for Config[src]

fn eq(&self, other: &Config) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Config) -> bool[src]

This method tests for !=.

impl Serialize for Config[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. 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> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[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]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> AsyncConnector for T where
    T: Send + Sync
[src]

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