1#[derive(prost_helpers::AnyPB)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct InjectBarrierRequest {
5 #[prost(string, tag = "1")]
6 pub request_id: ::prost::alloc::string::String,
7 #[prost(message, optional, tag = "2")]
8 pub barrier: ::core::option::Option<super::stream_plan::Barrier>,
9 #[prost(uint32, repeated, tag = "4", wrapper = "crate::id::ActorId")]
10 pub actor_ids_to_collect: ::prost::alloc::vec::Vec<crate::id::ActorId>,
11 #[prost(uint32, repeated, tag = "5", wrapper = "crate::id::TableId")]
12 pub table_ids_to_sync: ::prost::alloc::vec::Vec<crate::id::TableId>,
13 #[prost(uint64, tag = "6", wrapper = "crate::id::PartialGraphId")]
14 pub partial_graph_id: crate::id::PartialGraphId,
15 #[prost(message, repeated, tag = "9")]
16 pub actors_to_build: ::prost::alloc::vec::Vec<
17 inject_barrier_request::FragmentBuildActorInfo,
18 >,
19}
20pub mod inject_barrier_request {
22 #[derive(prost_helpers::AnyPB)]
23 #[derive(Clone, PartialEq, ::prost::Message)]
24 pub struct FragmentBuildActorInfo {
25 #[prost(uint32, tag = "1", wrapper = "crate::id::FragmentId")]
26 pub fragment_id: crate::id::FragmentId,
27 #[prost(message, optional, tag = "2")]
28 pub node: ::core::option::Option<super::super::stream_plan::StreamNode>,
29 #[prost(message, repeated, tag = "3")]
30 pub actors: ::prost::alloc::vec::Vec<BuildActorInfo>,
31 }
32 #[derive(prost_helpers::AnyPB)]
33 #[derive(Clone, PartialEq, ::prost::Message)]
34 pub struct BuildActorInfo {
35 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
36 pub actor_id: crate::id::ActorId,
37 #[prost(map = "uint32, message", tag = "2", wrapper = "crate::id::FragmentId")]
38 pub fragment_upstreams: ::std::collections::HashMap<
39 crate::id::FragmentId,
40 build_actor_info::UpstreamActors,
41 >,
42 #[prost(message, repeated, tag = "3")]
43 pub dispatchers: ::prost::alloc::vec::Vec<super::super::stream_plan::Dispatcher>,
44 #[prost(message, optional, tag = "4")]
45 pub vnode_bitmap: ::core::option::Option<super::super::common::Buffer>,
46 #[prost(string, tag = "5")]
47 pub mview_definition: ::prost::alloc::string::String,
48 #[prost(message, optional, tag = "6")]
49 pub expr_context: ::core::option::Option<super::super::plan_common::ExprContext>,
50 #[prost(string, tag = "9")]
51 pub config_override: ::prost::alloc::string::String,
52 #[prost(uint32, repeated, tag = "7", wrapper = "crate::id::SubscriberId")]
53 pub initial_subscriber_ids: ::prost::alloc::vec::Vec<crate::id::SubscriberId>,
54 }
55 pub mod build_actor_info {
57 #[derive(prost_helpers::AnyPB)]
58 #[derive(Clone, PartialEq, ::prost::Message)]
59 pub struct UpstreamActors {
60 #[prost(message, repeated, tag = "1")]
61 pub actors: ::prost::alloc::vec::Vec<super::super::super::common::ActorInfo>,
62 }
63 }
64}
65#[derive(prost_helpers::AnyPB)]
66#[derive(Clone, PartialEq, ::prost::Message)]
67pub struct BarrierCompleteResponse {
68 #[prost(string, tag = "1")]
69 pub request_id: ::prost::alloc::string::String,
70 #[prost(message, optional, tag = "2")]
71 pub status: ::core::option::Option<super::common::Status>,
72 #[prost(message, repeated, tag = "3")]
73 pub create_mview_progress: ::prost::alloc::vec::Vec<
74 barrier_complete_response::CreateMviewProgress,
75 >,
76 #[prost(message, repeated, tag = "4")]
77 pub synced_sstables: ::prost::alloc::vec::Vec<
78 barrier_complete_response::LocalSstableInfo,
79 >,
80 #[prost(uint32, tag = "5", wrapper = "crate::id::WorkerId")]
81 pub worker_id: crate::id::WorkerId,
82 #[prost(map = "uint32, message", tag = "6", wrapper = "crate::id::TableId")]
83 pub table_watermarks: ::std::collections::HashMap<
84 crate::id::TableId,
85 super::hummock::TableWatermarks,
86 >,
87 #[prost(message, repeated, tag = "7")]
88 pub old_value_sstables: ::prost::alloc::vec::Vec<super::hummock::SstableInfo>,
89 #[prost(uint64, tag = "8", wrapper = "crate::id::PartialGraphId")]
90 pub partial_graph_id: crate::id::PartialGraphId,
91 #[prost(uint64, tag = "9")]
93 pub epoch: u64,
94 #[prost(message, repeated, tag = "11")]
95 pub load_finished_sources: ::prost::alloc::vec::Vec<
96 barrier_complete_response::LoadFinishedSource,
97 >,
98 #[prost(map = "uint32, message", tag = "12", wrapper = "crate::id::TableId")]
99 pub vector_index_adds: ::std::collections::HashMap<
100 crate::id::TableId,
101 super::hummock::vector_index_delta::VectorIndexAdds,
102 >,
103 #[prost(message, repeated, tag = "13")]
104 pub cdc_table_backfill_progress: ::prost::alloc::vec::Vec<
105 barrier_complete_response::CdcTableBackfillProgress,
106 >,
107 #[prost(uint32, repeated, tag = "14", wrapper = "crate::id::TableId")]
111 pub truncate_tables: ::prost::alloc::vec::Vec<crate::id::TableId>,
112 #[prost(uint32, repeated, tag = "15", wrapper = "crate::id::TableId")]
116 pub refresh_finished_tables: ::prost::alloc::vec::Vec<crate::id::TableId>,
117 #[prost(message, repeated, tag = "16")]
118 pub list_finished_sources: ::prost::alloc::vec::Vec<
119 barrier_complete_response::ListFinishedSource,
120 >,
121 #[prost(message, repeated, tag = "17")]
122 pub cdc_source_offset_updated: ::prost::alloc::vec::Vec<
123 barrier_complete_response::CdcSourceOffsetUpdated,
124 >,
125 #[prost(message, repeated, tag = "18")]
126 pub iceberg_pk_index_sink_metadata: ::prost::alloc::vec::Vec<
127 barrier_complete_response::IcebergPkIndexSinkMetadata,
128 >,
129}
130pub mod barrier_complete_response {
132 #[derive(prost_helpers::AnyPB)]
133 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
134 pub struct CreateMviewProgress {
135 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
138 pub backfill_actor_id: crate::id::ActorId,
139 #[prost(bool, tag = "2")]
140 pub done: bool,
141 #[prost(uint64, tag = "3")]
143 pub consumed_epoch: u64,
144 #[prost(uint64, tag = "4")]
146 pub consumed_rows: u64,
147 #[prost(uint64, tag = "5")]
148 pub pending_epoch_lag: u64,
149 #[prost(uint64, tag = "6")]
151 pub buffered_rows: u64,
152 #[prost(uint32, tag = "7", wrapper = "crate::id::FragmentId")]
153 pub fragment_id: crate::id::FragmentId,
154 }
155 #[derive(prost_helpers::AnyPB)]
156 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
157 pub struct CdcTableBackfillProgress {
158 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
159 pub actor_id: crate::id::ActorId,
160 #[prost(uint64, tag = "2")]
161 pub epoch: u64,
162 #[prost(bool, tag = "3")]
163 pub done: bool,
164 #[prost(int64, tag = "4")]
165 pub split_id_start_inclusive: i64,
166 #[prost(int64, tag = "5")]
167 pub split_id_end_inclusive: i64,
168 #[prost(uint64, tag = "6")]
169 pub generation: u64,
170 #[prost(uint32, tag = "7", wrapper = "crate::id::FragmentId")]
171 pub fragment_id: crate::id::FragmentId,
172 }
173 #[derive(prost_helpers::AnyPB)]
174 #[derive(Clone, PartialEq, ::prost::Message)]
175 pub struct LocalSstableInfo {
176 #[prost(message, optional, tag = "2")]
177 pub sst: ::core::option::Option<super::super::hummock::SstableInfo>,
178 #[prost(map = "uint32, message", tag = "3", wrapper = "crate::id::TableId")]
179 pub table_stats_map: ::std::collections::HashMap<
180 crate::id::TableId,
181 super::super::hummock::TableStats,
182 >,
183 #[prost(uint64, tag = "4")]
184 pub created_at: u64,
185 }
186 #[derive(prost_helpers::AnyPB)]
190 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
191 pub struct LoadFinishedSource {
192 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
194 pub reporter_actor_id: crate::id::ActorId,
195 #[prost(uint32, tag = "2", wrapper = "crate::id::TableId")]
197 pub table_id: crate::id::TableId,
198 #[prost(uint32, tag = "3", wrapper = "crate::id::SourceId")]
200 pub associated_source_id: crate::id::SourceId,
201 }
202 #[derive(prost_helpers::AnyPB)]
205 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
206 pub struct ListFinishedSource {
207 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
209 pub reporter_actor_id: crate::id::ActorId,
210 #[prost(uint32, tag = "2", wrapper = "crate::id::TableId")]
212 pub table_id: crate::id::TableId,
213 #[prost(uint32, tag = "3", wrapper = "crate::id::SourceId")]
215 pub associated_source_id: crate::id::SourceId,
216 }
217 #[derive(prost_helpers::AnyPB)]
220 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
221 pub struct CdcSourceOffsetUpdated {
222 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
224 pub reporter_actor_id: crate::id::ActorId,
225 #[prost(uint32, tag = "2", wrapper = "crate::id::SourceId")]
227 pub source_id: crate::id::SourceId,
228 }
229 #[derive(prost_helpers::AnyPB)]
230 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
231 pub struct IcebergPkIndexSinkMetadata {
232 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
233 pub reporter_actor_id: crate::id::ActorId,
234 #[prost(uint32, tag = "2", wrapper = "crate::id::SinkId")]
235 pub sink_id: crate::id::SinkId,
236 #[prost(uint64, tag = "3")]
237 pub prev_epoch: u64,
238 #[prost(enumeration = "super::PbIcebergPkIndexSinkRole", tag = "4")]
239 pub role: i32,
240 #[prost(message, optional, tag = "5")]
241 pub metadata: ::core::option::Option<
242 super::super::connector_service::SinkMetadata,
243 >,
244 }
245}
246#[derive(prost_helpers::AnyPB)]
247#[derive(Clone, PartialEq, ::prost::Message)]
248pub struct StreamingControlStreamRequest {
249 #[prost(oneof = "streaming_control_stream_request::Request", tags = "1, 2, 3, 4, 5")]
250 pub request: ::core::option::Option<streaming_control_stream_request::Request>,
251}
252pub mod streaming_control_stream_request {
254 #[derive(prost_helpers::AnyPB)]
255 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
256 pub struct InitRequest {
257 #[prost(string, tag = "1")]
258 pub term_id: ::prost::alloc::string::String,
259 }
260 #[derive(prost_helpers::AnyPB)]
261 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
262 pub struct CreatePartialGraphRequest {
263 #[prost(uint64, tag = "1", wrapper = "crate::id::PartialGraphId")]
264 pub partial_graph_id: crate::id::PartialGraphId,
265 }
266 #[derive(prost_helpers::AnyPB)]
267 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
268 pub struct RemovePartialGraphRequest {
269 #[prost(uint64, repeated, tag = "1", wrapper = "crate::id::PartialGraphId")]
270 pub partial_graph_ids: ::prost::alloc::vec::Vec<crate::id::PartialGraphId>,
271 }
272 #[derive(prost_helpers::AnyPB)]
273 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
274 pub struct ResetPartialGraphsRequest {
275 #[prost(uint64, repeated, tag = "1", wrapper = "crate::id::PartialGraphId")]
276 pub partial_graph_ids: ::prost::alloc::vec::Vec<crate::id::PartialGraphId>,
277 }
278 #[derive(prost_helpers::AnyPB)]
279 #[derive(Clone, PartialEq, ::prost::Oneof)]
280 pub enum Request {
281 #[prost(message, tag = "1")]
282 Init(InitRequest),
283 #[prost(message, tag = "2")]
284 InjectBarrier(super::InjectBarrierRequest),
285 #[prost(message, tag = "3")]
286 RemovePartialGraph(RemovePartialGraphRequest),
287 #[prost(message, tag = "4")]
288 CreatePartialGraph(CreatePartialGraphRequest),
289 #[prost(message, tag = "5")]
290 ResetPartialGraphs(ResetPartialGraphsRequest),
291 }
292}
293#[derive(prost_helpers::AnyPB)]
294#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
295pub struct ScoredError {
296 #[prost(string, tag = "1")]
297 pub err_msg: ::prost::alloc::string::String,
298 #[prost(int32, tag = "2")]
299 pub score: i32,
300}
301#[derive(prost_helpers::AnyPB)]
302#[derive(Clone, PartialEq, ::prost::Message)]
303pub struct StreamingControlStreamResponse {
304 #[prost(
305 oneof = "streaming_control_stream_response::Response",
306 tags = "1, 2, 3, 4, 5"
307 )]
308 pub response: ::core::option::Option<streaming_control_stream_response::Response>,
309}
310pub mod streaming_control_stream_response {
312 #[derive(prost_helpers::AnyPB)]
313 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
314 pub struct InitResponse {}
315 #[derive(prost_helpers::AnyPB)]
316 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
317 pub struct ShutdownResponse {}
318 #[derive(prost_helpers::AnyPB)]
319 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
320 pub struct ReportPartialGraphFailureResponse {
321 #[prost(uint64, tag = "1", wrapper = "crate::id::PartialGraphId")]
322 pub partial_graph_id: crate::id::PartialGraphId,
323 }
324 #[derive(prost_helpers::AnyPB)]
325 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
326 pub struct ResetPartialGraphResponse {
327 #[prost(uint64, tag = "1", wrapper = "crate::id::PartialGraphId")]
328 pub partial_graph_id: crate::id::PartialGraphId,
329 #[prost(message, optional, tag = "2")]
330 pub root_err: ::core::option::Option<super::ScoredError>,
331 }
332 #[derive(prost_helpers::AnyPB)]
333 #[derive(Clone, PartialEq, ::prost::Oneof)]
334 pub enum Response {
335 #[prost(message, tag = "1")]
336 Init(InitResponse),
337 #[prost(message, tag = "2")]
338 CompleteBarrier(super::BarrierCompleteResponse),
339 #[prost(message, tag = "3")]
340 Shutdown(ShutdownResponse),
341 #[prost(message, tag = "4")]
342 ReportPartialGraphFailure(ReportPartialGraphFailureResponse),
343 #[prost(message, tag = "5")]
344 ResetPartialGraph(ResetPartialGraphResponse),
345 }
346}
347#[derive(prost_helpers::AnyPB)]
348#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
349pub struct GetMinUncommittedObjectIdRequest {}
350#[derive(prost_helpers::AnyPB)]
351#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
352pub struct GetMinUncommittedObjectIdResponse {
353 #[prost(uint64, tag = "1", wrapper = "crate::id::HummockRawObjectId")]
354 pub min_uncommitted_object_id: crate::id::HummockRawObjectId,
355}
356#[derive(prost_helpers::AnyPB)]
357#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
358#[repr(i32)]
359pub enum PbIcebergPkIndexSinkRole {
360 Unspecified = 0,
361 Writer = 1,
362 PositionDeleteMerger = 2,
363}
364impl PbIcebergPkIndexSinkRole {
365 pub fn as_str_name(&self) -> &'static str {
370 match self {
371 Self::Unspecified => "PB_ICEBERG_PK_INDEX_SINK_ROLE_UNSPECIFIED",
372 Self::Writer => "PB_ICEBERG_PK_INDEX_SINK_ROLE_WRITER",
373 Self::PositionDeleteMerger => {
374 "PB_ICEBERG_PK_INDEX_SINK_ROLE_POSITION_DELETE_MERGER"
375 }
376 }
377 }
378 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
380 match value {
381 "PB_ICEBERG_PK_INDEX_SINK_ROLE_UNSPECIFIED" => Some(Self::Unspecified),
382 "PB_ICEBERG_PK_INDEX_SINK_ROLE_WRITER" => Some(Self::Writer),
383 "PB_ICEBERG_PK_INDEX_SINK_ROLE_POSITION_DELETE_MERGER" => {
384 Some(Self::PositionDeleteMerger)
385 }
386 _ => None,
387 }
388 }
389}
390pub mod stream_service_client {
392 #![allow(
393 unused_variables,
394 dead_code,
395 missing_docs,
396 clippy::wildcard_imports,
397 clippy::let_unit_value,
398 )]
399 use tonic::codegen::*;
400 use tonic::codegen::http::Uri;
401 #[derive(Debug, Clone)]
402 pub struct StreamServiceClient<T> {
403 inner: tonic::client::Grpc<T>,
404 }
405 impl StreamServiceClient<tonic::transport::Channel> {
406 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
408 where
409 D: TryInto<tonic::transport::Endpoint>,
410 D::Error: Into<StdError>,
411 {
412 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
413 Ok(Self::new(conn))
414 }
415 }
416 impl<T> StreamServiceClient<T>
417 where
418 T: tonic::client::GrpcService<tonic::body::Body>,
419 T::Error: Into<StdError>,
420 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
421 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
422 {
423 pub fn new(inner: T) -> Self {
424 let inner = tonic::client::Grpc::new(inner);
425 Self { inner }
426 }
427 pub fn with_origin(inner: T, origin: Uri) -> Self {
428 let inner = tonic::client::Grpc::with_origin(inner, origin);
429 Self { inner }
430 }
431 pub fn with_interceptor<F>(
432 inner: T,
433 interceptor: F,
434 ) -> StreamServiceClient<InterceptedService<T, F>>
435 where
436 F: tonic::service::Interceptor,
437 T::ResponseBody: Default,
438 T: tonic::codegen::Service<
439 http::Request<tonic::body::Body>,
440 Response = http::Response<
441 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
442 >,
443 >,
444 <T as tonic::codegen::Service<
445 http::Request<tonic::body::Body>,
446 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
447 {
448 StreamServiceClient::new(InterceptedService::new(inner, interceptor))
449 }
450 #[must_use]
455 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
456 self.inner = self.inner.send_compressed(encoding);
457 self
458 }
459 #[must_use]
461 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
462 self.inner = self.inner.accept_compressed(encoding);
463 self
464 }
465 #[must_use]
469 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
470 self.inner = self.inner.max_decoding_message_size(limit);
471 self
472 }
473 #[must_use]
477 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
478 self.inner = self.inner.max_encoding_message_size(limit);
479 self
480 }
481 pub async fn streaming_control_stream(
482 &mut self,
483 request: impl tonic::IntoStreamingRequest<
484 Message = super::StreamingControlStreamRequest,
485 >,
486 ) -> std::result::Result<
487 tonic::Response<
488 tonic::codec::Streaming<super::StreamingControlStreamResponse>,
489 >,
490 tonic::Status,
491 > {
492 self.inner
493 .ready()
494 .await
495 .map_err(|e| {
496 tonic::Status::unknown(
497 format!("Service was not ready: {}", e.into()),
498 )
499 })?;
500 let codec = tonic_prost::ProstCodec::default();
501 let path = http::uri::PathAndQuery::from_static(
502 "/stream_service.StreamService/StreamingControlStream",
503 );
504 let mut req = request.into_streaming_request();
505 req.extensions_mut()
506 .insert(
507 GrpcMethod::new(
508 "stream_service.StreamService",
509 "StreamingControlStream",
510 ),
511 );
512 self.inner.streaming(req, path, codec).await
513 }
514 pub async fn get_min_uncommitted_object_id(
515 &mut self,
516 request: impl tonic::IntoRequest<super::GetMinUncommittedObjectIdRequest>,
517 ) -> std::result::Result<
518 tonic::Response<super::GetMinUncommittedObjectIdResponse>,
519 tonic::Status,
520 > {
521 self.inner
522 .ready()
523 .await
524 .map_err(|e| {
525 tonic::Status::unknown(
526 format!("Service was not ready: {}", e.into()),
527 )
528 })?;
529 let codec = tonic_prost::ProstCodec::default();
530 let path = http::uri::PathAndQuery::from_static(
531 "/stream_service.StreamService/GetMinUncommittedObjectId",
532 );
533 let mut req = request.into_request();
534 req.extensions_mut()
535 .insert(
536 GrpcMethod::new(
537 "stream_service.StreamService",
538 "GetMinUncommittedObjectId",
539 ),
540 );
541 self.inner.unary(req, path, codec).await
542 }
543 }
544}
545pub mod stream_service_server {
547 #![allow(
548 unused_variables,
549 dead_code,
550 missing_docs,
551 clippy::wildcard_imports,
552 clippy::let_unit_value,
553 )]
554 use tonic::codegen::*;
555 #[async_trait]
557 pub trait StreamService: std::marker::Send + std::marker::Sync + 'static {
558 type StreamingControlStreamStream: tonic::codegen::tokio_stream::Stream<
560 Item = std::result::Result<
561 super::StreamingControlStreamResponse,
562 tonic::Status,
563 >,
564 >
565 + std::marker::Send
566 + 'static;
567 async fn streaming_control_stream(
568 &self,
569 request: tonic::Request<
570 tonic::Streaming<super::StreamingControlStreamRequest>,
571 >,
572 ) -> std::result::Result<
573 tonic::Response<Self::StreamingControlStreamStream>,
574 tonic::Status,
575 >;
576 async fn get_min_uncommitted_object_id(
577 &self,
578 request: tonic::Request<super::GetMinUncommittedObjectIdRequest>,
579 ) -> std::result::Result<
580 tonic::Response<super::GetMinUncommittedObjectIdResponse>,
581 tonic::Status,
582 >;
583 }
584 #[derive(Debug)]
585 pub struct StreamServiceServer<T> {
586 inner: Arc<T>,
587 accept_compression_encodings: EnabledCompressionEncodings,
588 send_compression_encodings: EnabledCompressionEncodings,
589 max_decoding_message_size: Option<usize>,
590 max_encoding_message_size: Option<usize>,
591 }
592 impl<T> StreamServiceServer<T> {
593 pub fn new(inner: T) -> Self {
594 Self::from_arc(Arc::new(inner))
595 }
596 pub fn from_arc(inner: Arc<T>) -> Self {
597 Self {
598 inner,
599 accept_compression_encodings: Default::default(),
600 send_compression_encodings: Default::default(),
601 max_decoding_message_size: None,
602 max_encoding_message_size: None,
603 }
604 }
605 pub fn with_interceptor<F>(
606 inner: T,
607 interceptor: F,
608 ) -> InterceptedService<Self, F>
609 where
610 F: tonic::service::Interceptor,
611 {
612 InterceptedService::new(Self::new(inner), interceptor)
613 }
614 #[must_use]
616 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
617 self.accept_compression_encodings.enable(encoding);
618 self
619 }
620 #[must_use]
622 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
623 self.send_compression_encodings.enable(encoding);
624 self
625 }
626 #[must_use]
630 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
631 self.max_decoding_message_size = Some(limit);
632 self
633 }
634 #[must_use]
638 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
639 self.max_encoding_message_size = Some(limit);
640 self
641 }
642 }
643 impl<T, B> tonic::codegen::Service<http::Request<B>> for StreamServiceServer<T>
644 where
645 T: StreamService,
646 B: Body + std::marker::Send + 'static,
647 B::Error: Into<StdError> + std::marker::Send + 'static,
648 {
649 type Response = http::Response<tonic::body::Body>;
650 type Error = std::convert::Infallible;
651 type Future = BoxFuture<Self::Response, Self::Error>;
652 fn poll_ready(
653 &mut self,
654 _cx: &mut Context<'_>,
655 ) -> Poll<std::result::Result<(), Self::Error>> {
656 Poll::Ready(Ok(()))
657 }
658 fn call(&mut self, req: http::Request<B>) -> Self::Future {
659 match req.uri().path() {
660 "/stream_service.StreamService/StreamingControlStream" => {
661 #[allow(non_camel_case_types)]
662 struct StreamingControlStreamSvc<T: StreamService>(pub Arc<T>);
663 impl<
664 T: StreamService,
665 > tonic::server::StreamingService<
666 super::StreamingControlStreamRequest,
667 > for StreamingControlStreamSvc<T> {
668 type Response = super::StreamingControlStreamResponse;
669 type ResponseStream = T::StreamingControlStreamStream;
670 type Future = BoxFuture<
671 tonic::Response<Self::ResponseStream>,
672 tonic::Status,
673 >;
674 fn call(
675 &mut self,
676 request: tonic::Request<
677 tonic::Streaming<super::StreamingControlStreamRequest>,
678 >,
679 ) -> Self::Future {
680 let inner = Arc::clone(&self.0);
681 let fut = async move {
682 <T as StreamService>::streaming_control_stream(
683 &inner,
684 request,
685 )
686 .await
687 };
688 Box::pin(fut)
689 }
690 }
691 let accept_compression_encodings = self.accept_compression_encodings;
692 let send_compression_encodings = self.send_compression_encodings;
693 let max_decoding_message_size = self.max_decoding_message_size;
694 let max_encoding_message_size = self.max_encoding_message_size;
695 let inner = self.inner.clone();
696 let fut = async move {
697 let method = StreamingControlStreamSvc(inner);
698 let codec = tonic_prost::ProstCodec::default();
699 let mut grpc = tonic::server::Grpc::new(codec)
700 .apply_compression_config(
701 accept_compression_encodings,
702 send_compression_encodings,
703 )
704 .apply_max_message_size_config(
705 max_decoding_message_size,
706 max_encoding_message_size,
707 );
708 let res = grpc.streaming(method, req).await;
709 Ok(res)
710 };
711 Box::pin(fut)
712 }
713 "/stream_service.StreamService/GetMinUncommittedObjectId" => {
714 #[allow(non_camel_case_types)]
715 struct GetMinUncommittedObjectIdSvc<T: StreamService>(pub Arc<T>);
716 impl<
717 T: StreamService,
718 > tonic::server::UnaryService<
719 super::GetMinUncommittedObjectIdRequest,
720 > for GetMinUncommittedObjectIdSvc<T> {
721 type Response = super::GetMinUncommittedObjectIdResponse;
722 type Future = BoxFuture<
723 tonic::Response<Self::Response>,
724 tonic::Status,
725 >;
726 fn call(
727 &mut self,
728 request: tonic::Request<
729 super::GetMinUncommittedObjectIdRequest,
730 >,
731 ) -> Self::Future {
732 let inner = Arc::clone(&self.0);
733 let fut = async move {
734 <T as StreamService>::get_min_uncommitted_object_id(
735 &inner,
736 request,
737 )
738 .await
739 };
740 Box::pin(fut)
741 }
742 }
743 let accept_compression_encodings = self.accept_compression_encodings;
744 let send_compression_encodings = self.send_compression_encodings;
745 let max_decoding_message_size = self.max_decoding_message_size;
746 let max_encoding_message_size = self.max_encoding_message_size;
747 let inner = self.inner.clone();
748 let fut = async move {
749 let method = GetMinUncommittedObjectIdSvc(inner);
750 let codec = tonic_prost::ProstCodec::default();
751 let mut grpc = tonic::server::Grpc::new(codec)
752 .apply_compression_config(
753 accept_compression_encodings,
754 send_compression_encodings,
755 )
756 .apply_max_message_size_config(
757 max_decoding_message_size,
758 max_encoding_message_size,
759 );
760 let res = grpc.unary(method, req).await;
761 Ok(res)
762 };
763 Box::pin(fut)
764 }
765 _ => {
766 Box::pin(async move {
767 let mut response = http::Response::new(
768 tonic::body::Body::default(),
769 );
770 let headers = response.headers_mut();
771 headers
772 .insert(
773 tonic::Status::GRPC_STATUS,
774 (tonic::Code::Unimplemented as i32).into(),
775 );
776 headers
777 .insert(
778 http::header::CONTENT_TYPE,
779 tonic::metadata::GRPC_CONTENT_TYPE,
780 );
781 Ok(response)
782 })
783 }
784 }
785 }
786 }
787 impl<T> Clone for StreamServiceServer<T> {
788 fn clone(&self) -> Self {
789 let inner = self.inner.clone();
790 Self {
791 inner,
792 accept_compression_encodings: self.accept_compression_encodings,
793 send_compression_encodings: self.send_compression_encodings,
794 max_decoding_message_size: self.max_decoding_message_size,
795 max_encoding_message_size: self.max_encoding_message_size,
796 }
797 }
798 }
799 pub const SERVICE_NAME: &str = "stream_service.StreamService";
801 impl<T> tonic::server::NamedService for StreamServiceServer<T> {
802 const NAME: &'static str = SERVICE_NAME;
803 }
804}