pub struct Director<D: VclDirector> { /* private fields */ }Expand description
Safe wrapper around a struct director pointer with a trait implementation
This struct wraps a C director along with a Rust implementation that provides
the director’s behavior through the VclDirector trait. The wrapper handles
the FFI boundary and ensures proper lifetime management.
Directors are typically used to implement load balancing strategies (round-robin, random, hash-based, etc.) by selecting from multiple backends.
Implementations§
Source§impl<D: VclDirector> Director<D>
impl<D: VclDirector> Director<D>
Sourcepub fn new(
ctx: &mut Ctx<'_>,
director_type: &str,
vcl_name: &str,
inner: D,
) -> VclResult<Self>
pub fn new( ctx: &mut Ctx<'_>, director_type: &str, vcl_name: &str, inner: D, ) -> VclResult<Self>
Create a new director by calling VRT_AddDirector
This registers the director with Varnish and sets up the appropriate callbacks. The director will be automatically unregistered when dropped.
Sourcepub fn get_inner_mut(&mut self) -> &mut D
pub fn get_inner_mut(&mut self) -> &mut D
Access the bep director implementation mutably
Sourcepub fn resolve(&self, ctx: &Ctx<'_>) -> VCL_BACKEND
pub fn resolve(&self, ctx: &Ctx<'_>) -> VCL_BACKEND
Resolve this director to a backend using VRT_DirectorResolve
This calls into Varnish’s resolution mechanism, which will invoke
the director’s resolve method if needed.
Sourcepub fn probe(&self, ctx: &Ctx<'_>) -> ProbeResult
pub fn probe(&self, ctx: &Ctx<'_>) -> ProbeResult
Check if this director is healthy using VRT_Healthy