Skip to main content

FileBackendConfig

Struct FileBackendConfig 

Source
pub struct FileBackendConfig {
    pub address: String,
    pub weight: Option<u8>,
    pub sticky_id: Option<String>,
    pub backup: Option<bool>,
    pub backend_id: Option<String>,
    pub unix_path: Option<String>,
}
Expand description

A backend as written in the configuration file. address is either a socket address ("127.0.0.1:8080", "[::1]:8080") or a host:port ("ingress:8080") that FileBackendConfig::resolve turns into one BackendConfig per resolved address when the file is loaded (sozu-proxy/sozu#347). Workers only ever receive socket addresses.

Fields§

§address: String§weight: Option<u8>§sticky_id: Option<String>§backup: Option<bool>§backend_id: Option<String>§unix_path: Option<String>

Carried unchanged onto every backend this entry resolves to; see BackendConfig::unix_path.

Implementations§

Source§

impl FileBackendConfig

Source

pub fn resolve( &self, cluster_id: &str, index: usize, resolver: &BackendResolver<'_>, ) -> Result<Vec<BackendConfig>, ConfigError>

Resolves this entry into backends, once, through resolver (system_resolver outside tests).

A socket-address literal never reaches the resolver and keeps its configured backend_id, or the positional default id <cluster_id>-<index>-<address>, where index is the entry’s position in the file’s backends list, so it does not move when a name before it resolves to more or fewer addresses. A host:port yields one backend per distinct resolved address, sorted so the result does not depend on the resolver’s answer order, each with a deterministic id: <backend_id>-<address> when backend_id is set, <cluster_id>-<host:port>-<address> otherwise. When the name resolves, a configured sticky_id is suffixed with -<address> too, so it stays unique in the cluster and does not change when the answer grows or shrinks.

A host made only of dot-separated decimal, octal or 0x hexadecimal components that is not a valid IP literal (010.0.0.1, 1.2.3, 0x7f.1) is refused before the resolver: getaddrinfo reads such strings as legacy inet_aton shorthand (8.0.0.1, 1.2.0.3, 127.0.0.1), which the socket-address parser always rejected. An unbracketed IPv6 literal (::1:8080) is refused the same way: getaddrinfo would split it on the last colon.

Trait Implementations§

Source§

impl Clone for FileBackendConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileBackendConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FileBackendConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for FileBackendConfig

Source§

impl Hash for FileBackendConfig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FileBackendConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for FileBackendConfig

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FileBackendConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.