sentinel_proxy/agents/
context.rs1use sentinel_agent_protocol::RequestMetadata;
4use sentinel_common::CorrelationId;
5
6pub struct AgentCallContext {
11 pub correlation_id: CorrelationId,
13 pub metadata: RequestMetadata,
15 pub route_id: Option<String>,
17 pub upstream_id: Option<String>,
19 pub request_body: Option<Vec<u8>>,
21 pub response_body: Option<Vec<u8>>,
23}
24
25impl AgentCallContext {
26 pub fn new(correlation_id: CorrelationId, metadata: RequestMetadata) -> Self {
28 Self {
29 correlation_id,
30 metadata,
31 route_id: None,
32 upstream_id: None,
33 request_body: None,
34 response_body: None,
35 }
36 }
37
38 pub fn with_route_id(mut self, route_id: impl Into<String>) -> Self {
40 self.route_id = Some(route_id.into());
41 self
42 }
43
44 pub fn with_upstream_id(mut self, upstream_id: impl Into<String>) -> Self {
46 self.upstream_id = Some(upstream_id.into());
47 self
48 }
49}