pub struct RpcEnvelope {
pub route_key: String,
pub payload: Option<Bytes>,
pub error: Option<ErrorResponse>,
pub direction: Option<i32>,
pub traceparent: Option<String>,
pub tracestate: Option<String>,
pub request_id: String,
pub metadata: Vec<MetadataEntry>,
pub timeout_ms: i64,
}Expand description
RpcEnvelope wraps State Path RPC messages
Fields§
§route_key: StringRoute key: “package.Service.Method”
payload: Option<Bytes>Payload for successful RPC (request or response) Optional: when error is present, payload should be empty
error: Option<ErrorResponse>System-level error (envelope layer) Examples: UnknownRoute, DeserializationError, Panic, InvalidStateTransition Business errors should be in the response message payload
direction: Option<i32>Envelope direction: Request, Response, or Tell. See Direction above.
traceparent: Option<String>W3C trace context header values (for distributed tracing)
W3C trace context header value
tracestate: Option<String>W3C trace state header value
request_id: String§metadata: Vec<MetadataEntry>§timeout_ms: i64Caller deadline in milliseconds.
Contract: timeout_ms MUST be > 0 iff direction == DIRECTION_REQUEST. Senders set 0 as documented filler for TELL and RESPONSE envelopes. Receivers MUST ignore timeout_ms for TELL/RESPONSE and MUST NOT infer tell-ness (fire-and-forget) from timeout_ms == 0 — the explicit DIRECTION_TELL label is the only fire-and-forget marker.
Implementations§
Source§impl RpcEnvelope
impl RpcEnvelope
Sourcepub fn payload(&self) -> &[u8] ⓘ
pub fn payload(&self) -> &[u8] ⓘ
Returns the value of payload, or the default value if payload is unset.
Sourcepub fn direction(&self) -> Direction
pub fn direction(&self) -> Direction
Returns the enum value of direction, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_direction(&mut self, value: Direction)
pub fn set_direction(&mut self, value: Direction)
Sets direction to the provided enum value.
Sourcepub fn traceparent(&self) -> &str
pub fn traceparent(&self) -> &str
Returns the value of traceparent, or the default value if traceparent is unset.
Sourcepub fn tracestate(&self) -> &str
pub fn tracestate(&self) -> &str
Returns the value of tracestate, or the default value if tracestate is unset.
Trait Implementations§
Source§impl Clone for RpcEnvelope
impl Clone for RpcEnvelope
Source§impl Debug for RpcEnvelope
impl Debug for RpcEnvelope
Source§impl Default for RpcEnvelope
impl Default for RpcEnvelope
Source§impl Message for RpcEnvelope
impl Message for RpcEnvelope
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.