weaverpb/generated/
common.events.rs

1#[derive(serde::Serialize, serde::Deserialize)]
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct EventMatcher {
5    #[prost(enumeration = "EventType", tag = "1")]
6    pub event_type: i32,
7    #[prost(string, tag = "2")]
8    pub event_class_id: ::prost::alloc::string::String,
9    #[prost(string, tag = "3")]
10    pub transaction_ledger_id: ::prost::alloc::string::String,
11    #[prost(string, tag = "4")]
12    pub transaction_contract_id: ::prost::alloc::string::String,
13    #[prost(string, tag = "5")]
14    pub transaction_func: ::prost::alloc::string::String,
15}
16/// Below message is used to communicate between dest-relay and src-relay;
17/// and src-relay and src-driver.
18#[derive(serde::Serialize, serde::Deserialize)]
19#[allow(clippy::derive_partial_eq_without_eq)]
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct EventSubscription {
22    #[prost(message, optional, tag = "1")]
23    pub event_matcher: ::core::option::Option<EventMatcher>,
24    #[prost(message, optional, tag = "2")]
25    pub query: ::core::option::Option<super::query::Query>,
26    #[prost(enumeration = "EventSubOperation", tag = "3")]
27    pub operation: i32,
28}
29#[derive(serde::Serialize, serde::Deserialize)]
30#[allow(clippy::derive_partial_eq_without_eq)]
31#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct EventSubscriptionState {
33    #[prost(string, tag = "1")]
34    pub request_id: ::prost::alloc::string::String,
35    #[prost(string, tag = "2")]
36    pub publishing_request_id: ::prost::alloc::string::String,
37    #[prost(enumeration = "event_subscription_state::Status", tag = "3")]
38    pub status: i32,
39    #[prost(string, tag = "4")]
40    pub message: ::prost::alloc::string::String,
41    #[prost(message, optional, tag = "5")]
42    pub event_matcher: ::core::option::Option<EventMatcher>,
43    #[prost(message, repeated, tag = "6")]
44    pub event_publication_specs: ::prost::alloc::vec::Vec<EventPublication>,
45}
46/// Nested message and enum types in `EventSubscriptionState`.
47pub mod event_subscription_state {
48    #[derive(serde::Serialize, serde::Deserialize)]
49    #[derive(
50        Clone,
51        Copy,
52        Debug,
53        PartialEq,
54        Eq,
55        Hash,
56        PartialOrd,
57        Ord,
58        ::prost::Enumeration
59    )]
60    #[repr(i32)]
61    pub enum Status {
62        /// pending ACK from remote relay
63        SubscribePendingAck = 0,
64        /// Received ACK, waiting for event subscription confirmation from remote relay
65        SubscribePending = 1,
66        Subscribed = 2,
67        UnsubscribePendingAck = 3,
68        UnsubscribePending = 4,
69        Unsubscribed = 5,
70        Error = 6,
71        DuplicateQuerySubscribed = 7,
72    }
73    impl Status {
74        /// String value of the enum field names used in the ProtoBuf definition.
75        ///
76        /// The values are not transformed in any way and thus are considered stable
77        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
78        pub fn as_str_name(&self) -> &'static str {
79            match self {
80                Status::SubscribePendingAck => "SUBSCRIBE_PENDING_ACK",
81                Status::SubscribePending => "SUBSCRIBE_PENDING",
82                Status::Subscribed => "SUBSCRIBED",
83                Status::UnsubscribePendingAck => "UNSUBSCRIBE_PENDING_ACK",
84                Status::UnsubscribePending => "UNSUBSCRIBE_PENDING",
85                Status::Unsubscribed => "UNSUBSCRIBED",
86                Status::Error => "ERROR",
87                Status::DuplicateQuerySubscribed => "DUPLICATE_QUERY_SUBSCRIBED",
88            }
89        }
90        /// Creates an enum from field names used in the ProtoBuf definition.
91        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
92            match value {
93                "SUBSCRIBE_PENDING_ACK" => Some(Self::SubscribePendingAck),
94                "SUBSCRIBE_PENDING" => Some(Self::SubscribePending),
95                "SUBSCRIBED" => Some(Self::Subscribed),
96                "UNSUBSCRIBE_PENDING_ACK" => Some(Self::UnsubscribePendingAck),
97                "UNSUBSCRIBE_PENDING" => Some(Self::UnsubscribePending),
98                "UNSUBSCRIBED" => Some(Self::Unsubscribed),
99                "ERROR" => Some(Self::Error),
100                "DUPLICATE_QUERY_SUBSCRIBED" => Some(Self::DuplicateQuerySubscribed),
101                _ => None,
102            }
103        }
104    }
105}
106#[derive(serde::Serialize, serde::Deserialize)]
107#[allow(clippy::derive_partial_eq_without_eq)]
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct ContractTransaction {
110    #[prost(string, tag = "1")]
111    pub driver_id: ::prost::alloc::string::String,
112    #[prost(string, tag = "2")]
113    pub ledger_id: ::prost::alloc::string::String,
114    #[prost(string, tag = "3")]
115    pub contract_id: ::prost::alloc::string::String,
116    #[prost(string, tag = "4")]
117    pub func: ::prost::alloc::string::String,
118    #[prost(bytes = "vec", repeated, tag = "5")]
119    pub args: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
120    #[prost(uint64, tag = "6")]
121    pub replace_arg_index: u64,
122    #[prost(string, repeated, tag = "7")]
123    pub members: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
124}
125#[derive(serde::Serialize, serde::Deserialize)]
126#[allow(clippy::derive_partial_eq_without_eq)]
127#[derive(Clone, PartialEq, ::prost::Message)]
128pub struct EventPublication {
129    #[prost(oneof = "event_publication::PublicationTarget", tags = "1, 2")]
130    pub publication_target: ::core::option::Option<event_publication::PublicationTarget>,
131}
132/// Nested message and enum types in `EventPublication`.
133pub mod event_publication {
134    #[derive(serde::Serialize, serde::Deserialize)]
135    #[allow(clippy::derive_partial_eq_without_eq)]
136    #[derive(Clone, PartialEq, ::prost::Oneof)]
137    pub enum PublicationTarget {
138        #[prost(message, tag = "1")]
139        Ctx(super::ContractTransaction),
140        #[prost(string, tag = "2")]
141        AppUrl(::prost::alloc::string::String),
142    }
143}
144#[derive(serde::Serialize, serde::Deserialize)]
145#[allow(clippy::derive_partial_eq_without_eq)]
146#[derive(Clone, PartialEq, ::prost::Message)]
147pub struct EventStates {
148    #[prost(message, repeated, tag = "1")]
149    pub states: ::prost::alloc::vec::Vec<EventState>,
150}
151/// the payload that is used for the communication between the requesting relay
152/// and its network
153#[derive(serde::Serialize, serde::Deserialize)]
154#[allow(clippy::derive_partial_eq_without_eq)]
155#[derive(Clone, PartialEq, ::prost::Message)]
156pub struct EventState {
157    #[prost(message, optional, tag = "1")]
158    pub state: ::core::option::Option<super::state::RequestState>,
159    #[prost(string, tag = "2")]
160    pub event_id: ::prost::alloc::string::String,
161    #[prost(string, tag = "3")]
162    pub message: ::prost::alloc::string::String,
163}
164#[derive(serde::Serialize, serde::Deserialize)]
165#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
166#[repr(i32)]
167pub enum EventType {
168    LedgerState = 0,
169    AssetLock = 1,
170    AssetClaim = 2,
171}
172impl EventType {
173    /// String value of the enum field names used in the ProtoBuf definition.
174    ///
175    /// The values are not transformed in any way and thus are considered stable
176    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
177    pub fn as_str_name(&self) -> &'static str {
178        match self {
179            EventType::LedgerState => "LEDGER_STATE",
180            EventType::AssetLock => "ASSET_LOCK",
181            EventType::AssetClaim => "ASSET_CLAIM",
182        }
183    }
184    /// Creates an enum from field names used in the ProtoBuf definition.
185    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
186        match value {
187            "LEDGER_STATE" => Some(Self::LedgerState),
188            "ASSET_LOCK" => Some(Self::AssetLock),
189            "ASSET_CLAIM" => Some(Self::AssetClaim),
190            _ => None,
191        }
192    }
193}
194#[derive(serde::Serialize, serde::Deserialize)]
195#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
196#[repr(i32)]
197pub enum EventSubOperation {
198    Subscribe = 0,
199    Unsubscribe = 1,
200    Update = 2,
201}
202impl EventSubOperation {
203    /// String value of the enum field names used in the ProtoBuf definition.
204    ///
205    /// The values are not transformed in any way and thus are considered stable
206    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
207    pub fn as_str_name(&self) -> &'static str {
208        match self {
209            EventSubOperation::Subscribe => "SUBSCRIBE",
210            EventSubOperation::Unsubscribe => "UNSUBSCRIBE",
211            EventSubOperation::Update => "UPDATE",
212        }
213    }
214    /// Creates an enum from field names used in the ProtoBuf definition.
215    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
216        match value {
217            "SUBSCRIBE" => Some(Self::Subscribe),
218            "UNSUBSCRIBE" => Some(Self::Unsubscribe),
219            "UPDATE" => Some(Self::Update),
220            _ => None,
221        }
222    }
223}