weaverpb/generated/
common.state.rs

1/// Metadata for a View
2#[derive(serde::Serialize, serde::Deserialize)]
3#[allow(clippy::derive_partial_eq_without_eq)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Meta {
6    /// Underlying distributed ledger protocol.
7    #[prost(enumeration = "meta::Protocol", tag = "1")]
8    pub protocol: i32,
9    /// What notion of time?
10    /// If the observer and network are synchronizing on a global clock
11    /// there won't be a need to distinguish between static and dynamic views.
12    #[prost(string, tag = "2")]
13    pub timestamp: ::prost::alloc::string::String,
14    /// Notorization, SPV, ZKP, etc. Possibly enum
15    #[prost(string, tag = "3")]
16    pub proof_type: ::prost::alloc::string::String,
17    /// The data field's serialization format (e.g. JSON, XML, Protobuf)
18    #[prost(string, tag = "4")]
19    pub serialization_format: ::prost::alloc::string::String,
20}
21/// Nested message and enum types in `Meta`.
22pub mod meta {
23    #[derive(serde::Serialize, serde::Deserialize)]
24    #[derive(
25        Clone,
26        Copy,
27        Debug,
28        PartialEq,
29        Eq,
30        Hash,
31        PartialOrd,
32        Ord,
33        ::prost::Enumeration
34    )]
35    #[repr(i32)]
36    pub enum Protocol {
37        Bitcoin = 0,
38        Ethereum = 1,
39        Fabric = 3,
40        Corda = 4,
41    }
42    impl Protocol {
43        /// String value of the enum field names used in the ProtoBuf definition.
44        ///
45        /// The values are not transformed in any way and thus are considered stable
46        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
47        pub fn as_str_name(&self) -> &'static str {
48            match self {
49                Protocol::Bitcoin => "BITCOIN",
50                Protocol::Ethereum => "ETHEREUM",
51                Protocol::Fabric => "FABRIC",
52                Protocol::Corda => "CORDA",
53            }
54        }
55        /// Creates an enum from field names used in the ProtoBuf definition.
56        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
57            match value {
58                "BITCOIN" => Some(Self::Bitcoin),
59                "ETHEREUM" => Some(Self::Ethereum),
60                "FABRIC" => Some(Self::Fabric),
61                "CORDA" => Some(Self::Corda),
62                _ => None,
63            }
64        }
65    }
66}
67#[derive(serde::Serialize, serde::Deserialize)]
68#[allow(clippy::derive_partial_eq_without_eq)]
69#[derive(Clone, PartialEq, ::prost::Message)]
70pub struct View {
71    #[prost(message, optional, tag = "1")]
72    pub meta: ::core::option::Option<Meta>,
73    /// Represents the data playload of this view.
74    /// The representation of Fabric, Corda etc will be captured elsewhere.
75    /// For some protocols, like Bitcoin, the structure of an SPV proof is well known.
76    #[prost(bytes = "vec", tag = "2")]
77    pub data: ::prost::alloc::vec::Vec<u8>,
78}
79/// View represents the response from a remote network
80#[derive(serde::Serialize, serde::Deserialize)]
81#[allow(clippy::derive_partial_eq_without_eq)]
82#[derive(Clone, PartialEq, ::prost::Message)]
83pub struct ViewPayload {
84    #[prost(string, tag = "1")]
85    pub request_id: ::prost::alloc::string::String,
86    #[prost(oneof = "view_payload::State", tags = "2, 3")]
87    pub state: ::core::option::Option<view_payload::State>,
88}
89/// Nested message and enum types in `ViewPayload`.
90pub mod view_payload {
91    #[derive(serde::Serialize, serde::Deserialize)]
92    #[allow(clippy::derive_partial_eq_without_eq)]
93    #[derive(Clone, PartialEq, ::prost::Oneof)]
94    pub enum State {
95        #[prost(message, tag = "2")]
96        View(super::View),
97        #[prost(string, tag = "3")]
98        Error(::prost::alloc::string::String),
99    }
100}
101/// the payload that is used for the communication between the requesting relay
102/// and its network
103#[derive(serde::Serialize, serde::Deserialize)]
104#[allow(clippy::derive_partial_eq_without_eq)]
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct RequestState {
107    #[prost(string, tag = "1")]
108    pub request_id: ::prost::alloc::string::String,
109    #[prost(enumeration = "request_state::Status", tag = "2")]
110    pub status: i32,
111    #[prost(oneof = "request_state::State", tags = "3, 4")]
112    pub state: ::core::option::Option<request_state::State>,
113}
114/// Nested message and enum types in `RequestState`.
115pub mod request_state {
116    #[derive(serde::Serialize, serde::Deserialize)]
117    #[derive(
118        Clone,
119        Copy,
120        Debug,
121        PartialEq,
122        Eq,
123        Hash,
124        PartialOrd,
125        Ord,
126        ::prost::Enumeration
127    )]
128    #[repr(i32)]
129    pub enum Status {
130        /// pending ACK from remote relay
131        PendingAck = 0,
132        /// Received ACK, waiting for data to be sent from remote relay
133        Pending = 1,
134        /// View is not there, received error from remote relay
135        Error = 2,
136        /// Data Sharing completed Successfully
137        Completed = 3,
138        /// View is there and event is received from remote relay
139        EventReceived = 4,
140        /// Driver Successfully wrote the view to ledger
141        EventWritten = 5,
142        /// View is there but driver failed to write
143        EventWriteError = 6,
144        /// Once network fetches this request state, mark it delete for cleanup later on
145        Deleted = 7,
146    }
147    impl Status {
148        /// String value of the enum field names used in the ProtoBuf definition.
149        ///
150        /// The values are not transformed in any way and thus are considered stable
151        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
152        pub fn as_str_name(&self) -> &'static str {
153            match self {
154                Status::PendingAck => "PENDING_ACK",
155                Status::Pending => "PENDING",
156                Status::Error => "ERROR",
157                Status::Completed => "COMPLETED",
158                Status::EventReceived => "EVENT_RECEIVED",
159                Status::EventWritten => "EVENT_WRITTEN",
160                Status::EventWriteError => "EVENT_WRITE_ERROR",
161                Status::Deleted => "DELETED",
162            }
163        }
164        /// Creates an enum from field names used in the ProtoBuf definition.
165        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
166            match value {
167                "PENDING_ACK" => Some(Self::PendingAck),
168                "PENDING" => Some(Self::Pending),
169                "ERROR" => Some(Self::Error),
170                "COMPLETED" => Some(Self::Completed),
171                "EVENT_RECEIVED" => Some(Self::EventReceived),
172                "EVENT_WRITTEN" => Some(Self::EventWritten),
173                "EVENT_WRITE_ERROR" => Some(Self::EventWriteError),
174                "DELETED" => Some(Self::Deleted),
175                _ => None,
176            }
177        }
178    }
179    #[derive(serde::Serialize, serde::Deserialize)]
180    #[allow(clippy::derive_partial_eq_without_eq)]
181    #[derive(Clone, PartialEq, ::prost::Oneof)]
182    pub enum State {
183        #[prost(message, tag = "3")]
184        View(super::View),
185        #[prost(string, tag = "4")]
186        Error(::prost::alloc::string::String),
187    }
188}