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
impl EarlyRequestContext
Sourcepub fn socket_accepted(application: &str) -> Self
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}Facts cannot be recovered at this boundary. Known facts must be attached below; this is distinct from an identity that has never been established.
pub fn with_application( self, application: &ApplicationId, ) -> Result<Self, ContextBindingError<Self>>
Sourcepub fn with_trace(
self,
trace: &TraceCorrelationId,
) -> Result<Self, ContextBindingError<Self>>
pub fn with_trace( self, trace: &TraceCorrelationId, ) -> Result<Self, ContextBindingError<Self>>
An already validated protocol identity. Does not generate a root span.
pub fn with_rpc( self, rpc: &RpcCorrelationId, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_event( self, event: &EventContext, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_call( self, call: &CallContext, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_request( self, request: &RequestIdentity, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_route( self, route: &RouteIdentity, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_module( self, module: &ModuleId, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_service( self, service: &ServiceId, ) -> Result<Self, ContextBindingError<Self>>
pub fn with_operation( self, operation: &OperationId, ) -> Result<Self, ContextBindingError<Self>>
Auto Trait Implementations§
impl Freeze for EarlyRequestContext
impl RefUnwindSafe for EarlyRequestContext
impl Send for EarlyRequestContext
impl Sync for EarlyRequestContext
impl Unpin for EarlyRequestContext
impl UnsafeUnpin for EarlyRequestContext
impl UnwindSafe for EarlyRequestContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more