diff options
| author | Matthieu <matthieu@developershouse.xyz> | 2021-09-18 00:17:22 +0400 |
|---|---|---|
| committer | Matthieu <matthieu@developershouse.xyz> | 2021-09-18 00:17:22 +0400 |
| commit | 88300c45202a228d54c1e99dd3b295ef3fb9aabd (patch) | |
| tree | 63a2679ad815cde8c6bd2325fda7123b08ad284f /common/rust/src | |
| parent | 469a8fb1ea7b689399c30badbf33fc467531c561 (diff) | |
work on the gateway
Diffstat (limited to 'common/rust/src')
| -rw-r--r-- | common/rust/src/error.rs | 18 | ||||
| -rw-r--r-- | common/rust/src/lib.rs | 3 | ||||
| -rw-r--r-- | common/rust/src/payloads.rs | 8 |
3 files changed, 27 insertions, 2 deletions
diff --git a/common/rust/src/error.rs b/common/rust/src/error.rs new file mode 100644 index 0000000..dcb7a54 --- /dev/null +++ b/common/rust/src/error.rs @@ -0,0 +1,18 @@ +use std::fmt; + +pub struct NovaError { + pub message: String, +} + +impl fmt::Display for NovaError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "An error occured wihind the nova system: {}", self.message) // user-facing output + } +} + +impl fmt::Debug for NovaError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{{ file: {}, line: {} }}", file!(), line!()) // programmer-facing output + } +} + diff --git a/common/rust/src/lib.rs b/common/rust/src/lib.rs index 24e16ec..943d7cc 100644 --- a/common/rust/src/lib.rs +++ b/common/rust/src/lib.rs @@ -3,4 +3,5 @@ pub mod config; pub mod monitoring; pub mod nats; -pub mod payloads;
\ No newline at end of file +pub mod payloads; +pub mod error;
\ No newline at end of file diff --git a/common/rust/src/payloads.rs b/common/rust/src/payloads.rs index 1957077..6eb35c8 100644 --- a/common/rust/src/payloads.rs +++ b/common/rust/src/payloads.rs @@ -4,6 +4,12 @@ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(bound(deserialize = "T: Deserialize<'de> + std::default::Default + Clone"))] pub struct CachePayload<T> { - pub tracing: (), + pub tracing: Tracing, pub data: T } + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct Tracing { + pub node_id: String, + pub span: Option<String> +}
\ No newline at end of file |
