⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

L4LoadBalancer

Struct L4LoadBalancer 

Source
pub struct L4LoadBalancer { /* private fields */ }
Expand description

L4 Load Balancer implementation.

Implementations§

Source§

impl L4LoadBalancer

Source

pub fn new() -> Self

Create a new L4 load balancer.

Source

pub fn add_vip( &mut self, vip_addr: String, vip_port: u16, algorithm: LbAlgorithm, ) -> Result<(), L4Error>

Add a virtual IP.

Source

pub fn remove_vip( &mut self, vip_addr: &str, vip_port: u16, ) -> Result<(), L4Error>

Remove a virtual IP.

Source

pub fn add_backend( &mut self, vip_addr: &str, vip_port: u16, backend: Backend, ) -> Result<(), L4Error>

Add a backend to a VIP.

Source

pub fn remove_backend( &mut self, vip_addr: &str, vip_port: u16, backend_addr: &str, ) -> Result<(), L4Error>

Remove a backend from a VIP by address.

Source

pub fn select_backend( &mut self, vip_addr: &str, vip_port: u16, client_ip: u32, ) -> Result<(String, u16), L4Error>

Select a backend using the VIP’s configured algorithm.

Source

pub fn health_check(&mut self)

Run health checks on all backends in all VIPs.

Source

pub fn set_backend_health( &mut self, vip_addr: &str, vip_port: u16, backend_addr: &str, healthy: bool, ) -> Result<(), L4Error>

Mark a specific backend as healthy/unhealthy.

Source

pub fn get_vip(&self, vip_addr: &str, vip_port: u16) -> Option<&VirtualIp>

Get VIP info.

Source

pub fn list_vips(&self) -> Vec<&VirtualIp>

List all VIPs.

Source

pub fn vip_count(&self) -> usize

Get total number of VIPs.

Trait Implementations§

Source§

impl Debug for L4LoadBalancer

Source§

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

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

impl Default for L4LoadBalancer

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for L4LoadBalancer

§

impl RefUnwindSafe for L4LoadBalancer

§

impl Send for L4LoadBalancer

§

impl Sync for L4LoadBalancer

§

impl Unpin for L4LoadBalancer

§

impl UnwindSafe for L4LoadBalancer

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.