miden_client/note_transport/generated/std/
miden_note_transport.rs1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct TransportNote {
6 #[prost(bytes = "vec", tag = "1")]
8 pub header: ::prost::alloc::vec::Vec<u8>,
9 #[prost(bytes = "vec", tag = "2")]
11 pub details: ::prost::alloc::vec::Vec<u8>,
12}
13#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
15pub struct SendNoteRequest {
16 #[prost(message, optional, tag = "1")]
17 pub note: ::core::option::Option<TransportNote>,
18}
19#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
21pub struct SendNoteResponse {}
22#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
24pub struct FetchNotesRequest {
25 #[prost(fixed32, repeated, tag = "1")]
26 pub tags: ::prost::alloc::vec::Vec<u32>,
27 #[prost(fixed64, tag = "2")]
28 pub cursor: u64,
29}
30#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct FetchNotesResponse {
33 #[prost(message, repeated, tag = "1")]
34 pub notes: ::prost::alloc::vec::Vec<TransportNote>,
35 #[prost(fixed64, tag = "2")]
37 pub cursor: u64,
38}
39#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
41pub struct StreamNotesRequest {
42 #[prost(fixed32, tag = "1")]
43 pub tag: u32,
44 #[prost(fixed64, tag = "2")]
45 pub cursor: u64,
46}
47#[derive(Clone, PartialEq, ::prost::Message)]
49pub struct StreamNotesUpdate {
50 #[prost(message, repeated, tag = "1")]
51 pub notes: ::prost::alloc::vec::Vec<TransportNote>,
52 #[prost(fixed64, tag = "2")]
54 pub cursor: u64,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct StatsResponse {
59 #[prost(uint64, tag = "1")]
60 pub total_notes: u64,
61 #[prost(uint64, tag = "2")]
62 pub total_tags: u64,
63 #[prost(message, repeated, tag = "3")]
64 pub notes_per_tag: ::prost::alloc::vec::Vec<TagStats>,
65}
66#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
68pub struct TagStats {
69 #[prost(fixed32, tag = "1")]
70 pub tag: u32,
71 #[prost(uint64, tag = "2")]
72 pub note_count: u64,
73 #[prost(message, optional, tag = "3")]
74 pub last_activity: ::core::option::Option<::prost_types::Timestamp>,
75}
76pub mod miden_note_transport_client {
78 #![allow(
79 unused_variables,
80 dead_code,
81 missing_docs,
82 clippy::wildcard_imports,
83 clippy::let_unit_value,
84 )]
85 use tonic::codegen::*;
86 use tonic::codegen::http::Uri;
87 #[derive(Debug, Clone)]
89 pub struct MidenNoteTransportClient<T> {
90 inner: tonic::client::Grpc<T>,
91 }
92 impl MidenNoteTransportClient<tonic::transport::Channel> {
93 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
95 where
96 D: TryInto<tonic::transport::Endpoint>,
97 D::Error: Into<StdError>,
98 {
99 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
100 Ok(Self::new(conn))
101 }
102 }
103 impl<T> MidenNoteTransportClient<T>
104 where
105 T: tonic::client::GrpcService<tonic::body::Body>,
106 T::Error: Into<StdError>,
107 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
108 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
109 {
110 pub fn new(inner: T) -> Self {
111 let inner = tonic::client::Grpc::new(inner);
112 Self { inner }
113 }
114 pub fn with_origin(inner: T, origin: Uri) -> Self {
115 let inner = tonic::client::Grpc::with_origin(inner, origin);
116 Self { inner }
117 }
118 pub fn with_interceptor<F>(
119 inner: T,
120 interceptor: F,
121 ) -> MidenNoteTransportClient<InterceptedService<T, F>>
122 where
123 F: tonic::service::Interceptor,
124 T::ResponseBody: Default,
125 T: tonic::codegen::Service<
126 http::Request<tonic::body::Body>,
127 Response = http::Response<
128 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
129 >,
130 >,
131 <T as tonic::codegen::Service<
132 http::Request<tonic::body::Body>,
133 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
134 {
135 MidenNoteTransportClient::new(InterceptedService::new(inner, interceptor))
136 }
137 #[must_use]
142 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
143 self.inner = self.inner.send_compressed(encoding);
144 self
145 }
146 #[must_use]
148 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
149 self.inner = self.inner.accept_compressed(encoding);
150 self
151 }
152 #[must_use]
156 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
157 self.inner = self.inner.max_decoding_message_size(limit);
158 self
159 }
160 #[must_use]
164 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
165 self.inner = self.inner.max_encoding_message_size(limit);
166 self
167 }
168 pub async fn send_note(
170 &mut self,
171 request: impl tonic::IntoRequest<super::SendNoteRequest>,
172 ) -> std::result::Result<
173 tonic::Response<super::SendNoteResponse>,
174 tonic::Status,
175 > {
176 self.inner
177 .ready()
178 .await
179 .map_err(|e| {
180 tonic::Status::unknown(
181 format!("Service was not ready: {}", e.into()),
182 )
183 })?;
184 let codec = tonic_prost::ProstCodec::default();
185 let path = http::uri::PathAndQuery::from_static(
186 "/miden_note_transport.MidenNoteTransport/SendNote",
187 );
188 let mut req = request.into_request();
189 req.extensions_mut()
190 .insert(
191 GrpcMethod::new(
192 "miden_note_transport.MidenNoteTransport",
193 "SendNote",
194 ),
195 );
196 self.inner.unary(req, path, codec).await
197 }
198 pub async fn fetch_notes(
200 &mut self,
201 request: impl tonic::IntoRequest<super::FetchNotesRequest>,
202 ) -> std::result::Result<
203 tonic::Response<super::FetchNotesResponse>,
204 tonic::Status,
205 > {
206 self.inner
207 .ready()
208 .await
209 .map_err(|e| {
210 tonic::Status::unknown(
211 format!("Service was not ready: {}", e.into()),
212 )
213 })?;
214 let codec = tonic_prost::ProstCodec::default();
215 let path = http::uri::PathAndQuery::from_static(
216 "/miden_note_transport.MidenNoteTransport/FetchNotes",
217 );
218 let mut req = request.into_request();
219 req.extensions_mut()
220 .insert(
221 GrpcMethod::new(
222 "miden_note_transport.MidenNoteTransport",
223 "FetchNotes",
224 ),
225 );
226 self.inner.unary(req, path, codec).await
227 }
228 pub async fn stream_notes(
230 &mut self,
231 request: impl tonic::IntoRequest<super::StreamNotesRequest>,
232 ) -> std::result::Result<
233 tonic::Response<tonic::codec::Streaming<super::StreamNotesUpdate>>,
234 tonic::Status,
235 > {
236 self.inner
237 .ready()
238 .await
239 .map_err(|e| {
240 tonic::Status::unknown(
241 format!("Service was not ready: {}", e.into()),
242 )
243 })?;
244 let codec = tonic_prost::ProstCodec::default();
245 let path = http::uri::PathAndQuery::from_static(
246 "/miden_note_transport.MidenNoteTransport/StreamNotes",
247 );
248 let mut req = request.into_request();
249 req.extensions_mut()
250 .insert(
251 GrpcMethod::new(
252 "miden_note_transport.MidenNoteTransport",
253 "StreamNotes",
254 ),
255 );
256 self.inner.server_streaming(req, path, codec).await
257 }
258 pub async fn stats(
260 &mut self,
261 request: impl tonic::IntoRequest<()>,
262 ) -> std::result::Result<tonic::Response<super::StatsResponse>, tonic::Status> {
263 self.inner
264 .ready()
265 .await
266 .map_err(|e| {
267 tonic::Status::unknown(
268 format!("Service was not ready: {}", e.into()),
269 )
270 })?;
271 let codec = tonic_prost::ProstCodec::default();
272 let path = http::uri::PathAndQuery::from_static(
273 "/miden_note_transport.MidenNoteTransport/Stats",
274 );
275 let mut req = request.into_request();
276 req.extensions_mut()
277 .insert(
278 GrpcMethod::new("miden_note_transport.MidenNoteTransport", "Stats"),
279 );
280 self.inner.unary(req, path, codec).await
281 }
282 }
283}