sol_parser_sdk/shredstream/proto/
mod.rs1pub mod shredstream {
4 use tonic::codegen::*;
7
8 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
10 pub struct SubscribeEntriesRequest {}
11
12 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
14 pub struct Entry {
15 #[prost(uint64, tag = "1")]
17 pub slot: u64,
18 #[prost(bytes = "vec", tag = "2")]
20 pub entries: ::prost::alloc::vec::Vec<u8>,
21 }
22
23 #[derive(Debug, Clone)]
25 pub struct ShredstreamProxyClient<T> {
26 inner: tonic::client::Grpc<T>,
27 }
28
29 impl ShredstreamProxyClient<tonic::transport::Channel> {
30 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
32 where
33 D: TryInto<tonic::transport::Endpoint>,
34 D::Error: Into<StdError>,
35 {
36 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
37 Ok(Self::new(conn))
38 }
39 }
40
41 impl<T> ShredstreamProxyClient<T>
42 where
43 T: tonic::client::GrpcService<tonic::body::Body>,
44 T::Error: Into<StdError>,
45 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
46 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
47 {
48 pub fn new(inner: T) -> Self {
49 let inner = tonic::client::Grpc::new(inner);
50 Self { inner }
51 }
52
53 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
55 self.inner = self.inner.max_decoding_message_size(limit);
56 self
57 }
58
59 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
61 self.inner = self.inner.max_encoding_message_size(limit);
62 self
63 }
64
65 pub async fn subscribe_entries(
67 &mut self,
68 request: impl tonic::IntoRequest<SubscribeEntriesRequest>,
69 ) -> std::result::Result<tonic::Response<tonic::codec::Streaming<Entry>>, tonic::Status>
70 {
71 self.inner.ready().await.map_err(|e| {
72 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
73 })?;
74 let codec = tonic::codec::ProstCodec::default();
75 let path = http::uri::PathAndQuery::from_static(
76 "/shredstream.ShredstreamProxy/SubscribeEntries",
77 );
78 let mut req = request.into_request();
79 req.extensions_mut()
80 .insert(GrpcMethod::new("shredstream.ShredstreamProxy", "SubscribeEntries"));
81 self.inner.server_streaming(req, path, codec).await
82 }
83 }
84}
85
86pub use shredstream::{Entry, ShredstreamProxyClient, SubscribeEntriesRequest};