Skip to main content

DiagnosticTaskId

Struct DiagnosticTaskId 

Source
pub struct DiagnosticTaskId(/* private fields */);
Expand description

Validated read-only rendering of the existing runtime task instance ID. This does not allocate a task/sequence or prove task ownership. RP must take the digits from its real runtime ID, never a task-kind label or invented ID.

Implementations§

Source§

impl DiagnosticTaskId

Source

pub fn from_runtime_id(value: &str) -> Option<Self>

Examples found in repository?
examples/outbound_child_diagnostic.rs (line 31)
12fn main() {
13    let observer = Observer::with_writer(ObserverConfig::default(), std::io::sink()).unwrap();
14    let (incoming, _) = observer
15        .start_external_call_with_rpc(
16            "shop",
17            "ingress",
18            "orders",
19            "query",
20            Some("gateway-opaque"),
21            RpcCorrelationId::new("0.3").unwrap(),
22        )
23        .unwrap();
24    let ingress_event = EventContext::new(
25        RequestIdentity::new("request-7").unwrap(),
26        RouteIdentity::new("/incoming").unwrap(),
27        1,
28    )
29    .unwrap();
30    let parent = RequestDiagnosticScope::output_unavailable(incoming.context(), &ingress_event)
31        .with_task(DiagnosticTaskId::from_runtime_id("42").unwrap())
32        .unwrap_or_else(|_| panic!("task"))
33        .with_zone(DiagnosticZone::from_validated_ingress("zone-a").unwrap());
34
35    // programming.rs generates the wire child; Boundary uses its trace/rpc plus
36    // request_id/function. The adapter below does NOT generate these identities.
37    let wire_trace = "gateway-opaque";
38    let wire_rpc = "0.3.1";
39    let request_id = "request-7";
40    let function = "remote.query";
41    let (root, _) = observer
42        .start_external_call_with_rpc(
43            "saddle",
44            "zone-a",
45            "profusecontract",
46            "invoke",
47            Some(wire_trace),
48            RpcCorrelationId::new(wire_rpc).unwrap(),
49        )
50        .unwrap();
51    let event = EventContext::new(
52        RequestIdentity::new(request_id).unwrap(),
53        RouteIdentity::new(function).unwrap(),
54        1,
55    )
56    .unwrap();
57    let child = parent
58        .derive_outbound_child(root.context(), &event)
59        .unwrap();
60    let failure = child.fail(
61        std::io::ErrorKind::ConnectionRefused,
62        DiagnosticCategory::UnexpectedError,
63        BoundedDiagnosticCause::new(
64            DiagnosticStage::RequestDecode,
65            DiagnosticCode::new("outbound.connect_failed").unwrap(),
66        ),
67    );
68    let id = failure.source_diagnostic().id();
69    let (retained, delivery) =
70        failure.finish_boundary_retained(None, &DiagnosticOutcomeAxes::default());
71    assert_eq!(retained.source_diagnostic().id(), id);
72    assert_eq!(*retained.error(), std::io::ErrorKind::ConnectionRefused);
73    assert_eq!(
74        delivery.source_submission(),
75        DiagnosticSubmission::OutputUnavailable
76    );
77    assert_eq!(
78        delivery.boundary_submission(),
79        DiagnosticSubmission::OutputUnavailable
80    );
81    println!("GO: Boundary-shaped child Call/Event consumed; absent output retains same failure");
82}

Trait Implementations§

Source§

impl Clone for DiagnosticTaskId

Source§

fn clone(&self) -> Self

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

impl Copy for DiagnosticTaskId

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> 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> 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 = !

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.