Skip to main content

EarlyRequestContext

Struct EarlyRequestContext 

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

Fixed early-request projection. It is metadata, not a second execution context, admission permission or source receipt. No trace/sequence is minted.

ⓘ
let forged = saddle_observability::EarlyRequestContext { context: todo!() };

Implementations§

Source§

impl EarlyRequestContext

Source

pub fn socket_accepted(application: &str) -> Self

No request bytes/identities have been accepted yet. Application is the existing configured application label, NOT peer/body/header data.

Examples found in repository?
examples/early_request_diagnostic.rs (line 36)
32fn main() {
33    // Caller is at the accepted socket phase; no trace, span, request or task is
34    // fabricated to satisfy a constructor. The output may genuinely be absent.
35    let scope =
36        RequestDiagnosticScope::early(None, EarlyRequestContext::socket_accepted("example"))
37            .with_phase(DiagnosticRequestPhase::ReadingHead);
38    let failure = match read_head(&mut io::empty(), &scope) {
39        Err(failure) => failure,
40        Ok(()) => panic!("owned empty reader must fail"),
41    };
42    let id = failure.source_diagnostic().id();
43    let (retained, delivery) = failure.finish_boundary_retained(
44        None,
45        &DiagnosticOutcomeAxes {
46            operation: OperationOutcome::Failed,
47            ..Default::default()
48        },
49    );
50    assert_eq!(retained.error().kind(), io::ErrorKind::UnexpectedEof);
51    assert_eq!(retained.source_diagnostic().id(), id);
52    assert_eq!(
53        delivery.source_submission(),
54        DiagnosticSubmission::OutputUnavailable
55    );
56    assert_eq!(
57        delivery.boundary_submission(),
58        DiagnosticSubmission::OutputUnavailable
59    );
60    // Real consumer keeps `retained` in its task/response result, not just bool.
61    println!("GO: early source retained without invented identities or output");
62}
Source

pub fn unavailable() -> Self

Facts cannot be recovered at this boundary. Known facts must be attached below; this is distinct from an identity that has never been established.

Source

pub fn with_application( self, application: &ApplicationId, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_trace( self, trace: &TraceCorrelationId, ) -> Result<Self, ContextBindingError<Self>>

An already validated protocol identity. Does not generate a root span.

Source

pub fn with_rpc( self, rpc: &RpcCorrelationId, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_event( self, event: &EventContext, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_call( self, call: &CallContext, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_request( self, request: &RequestIdentity, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_route( self, route: &RouteIdentity, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_module( self, module: &ModuleId, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_service( self, service: &ServiceId, ) -> Result<Self, ContextBindingError<Self>>

Source

pub fn with_operation( self, operation: &OperationId, ) -> Result<Self, ContextBindingError<Self>>

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> 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, 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.