summaryrefslogtreecommitdiff
path: root/common/rust/src/payloads.rs
blob: c97ac1db5cb9414d42f2fadf0abbc2d0f8303cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use serde::{Deserialize, Serialize};
use std::fmt::Debug;

/// Data structure sent to the cache component
/// by the gateway & webhook.
#[derive(Serialize, Deserialize, Debug)]
#[serde(bound(deserialize = "T: Deserialize<'de> + Debug"))]
pub struct CachePayload<T> {

    #[serde(rename = "tr")]
    pub tracing: Tracing,

    #[serde(rename = "d")]
    pub data: T,

    #[serde(rename = "o")]
    pub operation: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct Tracing {
    pub node_id: String,
    pub span: Option<String>
}