Skip to main content

cc_lb_plugin_wire/v2/
observe.rs

1//! v2 is a fork of v1 to allow additive cache-related fields. v1 is FROZEN.
2
3extern crate alloc;
4
5use alloc::vec::Vec;
6use serde::{Deserialize, Serialize};
7
8use crate::v2::common::ObserveEventWire;
9use crate::wire_function::{FallbackPolicy, WireFunction};
10
11#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
12#[serde(deny_unknown_fields)]
13pub struct ObserveRequest {
14    pub events: Vec<ObserveEventWire>,
15}
16
17impl ObserveRequest {
18    pub fn dry_run_sample() -> Self {
19        Self { events: Vec::new() }
20    }
21}
22
23#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
24#[serde(deny_unknown_fields)]
25pub struct ObserveResponse {}
26
27impl ObserveResponse {
28    pub fn dry_run_sample() -> Self {
29        Self {}
30    }
31}
32
33pub struct ObserveFn;
34
35impl WireFunction for ObserveFn {
36    const NAME: &'static str = "observe";
37    const FALLBACK: FallbackPolicy = FallbackPolicy::SilentSkip;
38    const SUPPORTED_VERSIONS: &'static [u32] = &[1];
39
40    type Request = ObserveRequest;
41    type Response = ObserveResponse;
42
43    fn dry_run_request() -> Self::Request {
44        ObserveRequest::dry_run_sample()
45    }
46
47    fn dry_run_response() -> Self::Response {
48        ObserveResponse::dry_run_sample()
49    }
50}