Skip to main content

ConfigSnapshot

Struct ConfigSnapshot 

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

A configuration pinned for one request transaction. Obtain via crate::Control::snapshot; run on_request then (later) on_response against the same snapshot so a reload cannot desync the two halves.

The snapshot also carries the request’s RequestTrace (ADR 000009): both halves run under one trace context, so the request-side and response-side filter spans belong to the same trace. The host emits those spans to its sink as the chain runs.

Clone is cheap (an Arc clone + the trace ids) and yields the same pinned config and trace — the fast-path server clones one snapshot to run the request and response halves on separate spawn_blocking tasks while keeping them in one transaction (ADR 000013).

Implementations§

Source§

impl ConfigSnapshot

Source

pub fn on_request(&self, request: HttpRequest) -> ChainOutcome

Drive a request through the default [chain] (the chain-only convenience). The fast-path server uses ConfigSnapshot::find_route + ConfigSnapshot::dispatch_request.

Source

pub fn on_response( &self, request: &HttpRequest, response: HttpResponse, ) -> ResponseOutcome

Drive a response back through the default [chain] in reverse. request is the as-forwarded request snapshot every response hook sees (ADR 000073).

Source

pub fn find_route(&self, request: &HttpRequest) -> Option<RouteInfo>

Match a request to a route by its [route.match] dimensions — host, path prefix, method, headers, query (ADR 000013 / 000034) — or None when no route matches (the server responds 404). The most specific match wins (see [route::select]). Pure config lookup — cheap and non-blocking, so it runs on the async thread; only the returned route’s chain dispatch is blocking work. Reads only borrowed request fields, so matching is allocation-free.

Source

pub fn dispatch_request( &self, route: usize, request: HttpRequest, ) -> ChainOutcome

Drive a request through a matched route’s chain (request side). route is the index from ConfigSnapshot::find_route on this same snapshot. Returns forward-or-respond just like on_request. Out-of-range (a stale index from another snapshot) responds with a fail-closed 404 rather than panicking (data-plane no-panic, bp-rust).

Source

pub fn dispatch_request_body( &self, route: usize, body: Vec<u8>, ) -> RequestBodyOutcome

Drive a buffered request body through a matched route’s on-request-body chain (ADR 000025). Same route index as the request side, on the same snapshot. The server calls this only for a route with filters and a non-empty body; a stale index forwards the body unchanged.

Source

pub fn dispatch_response( &self, route: usize, request: &HttpRequest, response: HttpResponse, ) -> ResponseOutcome

Drive a response back through a matched route’s chain in reverse. Same route index as the request side, on the same (cloned) snapshot, so both halves run one route’s chain. request is the as-forwarded request snapshot (ADR 000073). A stale index forwards the response unchanged (fail-soft, same as the other dispatch_*).

Source

pub fn config_version(&self) -> &str

The config version (manifest content hash) this transaction is pinned to.

Source

pub fn traceparent(&self) -> String

The W3C traceparent for this transaction — pass downstream so the upstream request continues the same trace (ADR 000009 propagation).

Trait Implementations§

Source§

impl Clone for ConfigSnapshot

Source§

fn clone(&self) -> ConfigSnapshot

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

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<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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

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

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more