1#[allow(clippy::all)]
4#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct Request {
6 #[prost(string, tag = "1")]
8 pub operation: ::prost::alloc::string::String,
9 #[prost(bytes = "vec", tag = "2")]
11 pub payload: ::prost::alloc::vec::Vec<u8>,
12 #[prost(string, tag = "3")]
14 pub invocation: ::prost::alloc::string::String,
15 #[prost(uint32, tag = "4")]
17 pub attempt: u32,
18 #[prost(string, tag = "5")]
20 pub scope: ::prost::alloc::string::String,
21 #[prost(string, repeated, tag = "6")]
23 pub capturing_executions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
24}
25#[allow(clippy::all)]
27#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
28pub struct Cancel {
29 #[prost(string, tag = "1")]
30 pub reason: ::prost::alloc::string::String,
31}
32#[allow(clippy::all)]
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct Response {
36 #[prost(oneof = "response::Result", tags = "1, 2")]
38 pub result: ::core::option::Option<response::Result>,
39}
40pub mod response {
42 #[allow(clippy::all)]
44 #[derive(Clone, PartialEq, ::prost::Oneof)]
45 pub enum Result {
46 #[prost(bytes, tag = "1")]
48 Payload(::prost::alloc::vec::Vec<u8>),
49 #[prost(message, tag = "2")]
50 Failure(crate::model::Failure),
51 }
52}
53#[allow(clippy::all)]
55#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
56pub struct ChildRequest {
57 #[prost(uint64, tag = "1")]
59 pub call: u64,
60 #[prost(string, tag = "2")]
62 pub operation: ::prost::alloc::string::String,
63 #[prost(bytes = "vec", tag = "3")]
65 pub payload: ::prost::alloc::vec::Vec<u8>,
66 #[prost(bytes = "vec", tag = "4")]
68 pub fingerprint: ::prost::alloc::vec::Vec<u8>,
69 #[prost(message, optional, tag = "5")]
71 pub policy: ::core::option::Option<crate::model::OperationPolicy>,
72 #[prost(bool, tag = "6")]
74 pub watch: bool,
75 #[prost(uint64, tag = "7")]
77 pub max_response_bytes: u64,
78 #[prost(bool, tag = "8")]
80 pub background: bool,
81 #[prost(string, optional, tag = "9")]
84 pub json: ::core::option::Option<::prost::alloc::string::String>,
85}
86#[allow(clippy::all)]
88#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
89pub struct ChildDemand {
90 #[prost(uint64, tag = "1")]
92 pub call: u64,
93}
94#[allow(clippy::all)]
96#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
97pub struct ChildCancel {
98 #[prost(uint64, tag = "1")]
100 pub call: u64,
101}
102#[allow(clippy::all)]
104#[derive(Clone, PartialEq, ::prost::Message)]
105pub struct ChildResponse {
106 #[prost(uint64, tag = "1")]
108 pub call: u64,
109 #[prost(oneof = "child_response::Result", tags = "2, 3, 4")]
111 pub result: ::core::option::Option<child_response::Result>,
112}
113pub mod child_response {
115 #[allow(clippy::all)]
117 #[derive(Clone, PartialEq, ::prost::Oneof)]
118 pub enum Result {
119 #[prost(bytes, tag = "2")]
121 Payload(::prost::alloc::vec::Vec<u8>),
122 #[prost(message, tag = "3")]
123 Failure(crate::model::Failure),
124 #[prost(bytes, tag = "4")]
125 Item(::prost::alloc::vec::Vec<u8>),
126 }
127}
128#[allow(clippy::all)]
130#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
131pub struct AssignedOperation {
132 #[prost(string, tag = "1")]
134 pub operation: ::prost::alloc::string::String,
135 #[prost(bytes = "vec", tag = "2")]
137 pub fingerprint: ::prost::alloc::vec::Vec<u8>,
138 #[prost(uint64, tag = "3")]
140 pub generation: u64,
141}
142#[allow(clippy::all)]
144#[derive(Clone, PartialEq, ::prost::Message)]
145pub struct OperationAssignments {
146 #[prost(message, repeated, tag = "1")]
147 pub operations: ::prost::alloc::vec::Vec<AssignedOperation>,
148}
149#[allow(clippy::all)]
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct GuestRegistration {
153 #[prost(string, tag = "1")]
155 pub id: ::prost::alloc::string::String,
156 #[prost(string, tag = "2")]
158 pub version: ::prost::alloc::string::String,
159 #[prost(message, optional, tag = "3")]
160 pub declarations: ::core::option::Option<crate::model::Declarations>,
161 #[prost(message, optional, tag = "4")]
163 pub initialization: ::core::option::Option<crate::model::OperationPolicy>,
164 #[prost(message, optional, tag = "5")]
166 pub shutdown: ::core::option::Option<crate::model::OperationPolicy>,
167 #[prost(message, repeated, tag = "6")]
168 pub requirements: ::prost::alloc::vec::Vec<GuestRequirement>,
169 #[prost(uint64, tag = "7")]
171 pub message_bytes: u64,
172}
173#[allow(clippy::all)]
175#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
176pub struct GuestRequirement {
177 #[prost(string, tag = "1")]
179 pub id: ::prost::alloc::string::String,
180 #[prost(string, tag = "2")]
181 pub request: ::prost::alloc::string::String,
182 #[prost(string, tag = "3")]
183 pub response: ::prost::alloc::string::String,
184 #[prost(bytes = "vec", tag = "4")]
186 pub fingerprint: ::prost::alloc::vec::Vec<u8>,
187}
188#[allow(clippy::all)]
190#[derive(Clone, PartialEq, ::prost::Message)]
191pub struct GuestCommand {
192 #[prost(oneof = "guest_command::Phase", tags = "1, 2, 3, 4, 5")]
194 pub phase: ::core::option::Option<guest_command::Phase>,
195}
196pub mod guest_command {
198 #[allow(clippy::all)]
200 #[derive(Clone, PartialEq, ::prost::Oneof)]
201 pub enum Phase {
202 #[prost(message, tag = "1")]
204 Prepare(super::GuestPrepare),
205 #[prost(message, tag = "2")]
207 Initialize(super::GuestInvocation),
208 #[prost(message, tag = "3")]
210 Attempt(super::GuestInvocation),
211 #[prost(uint64, tag = "4")]
213 Finalize(u64),
214 #[prost(uint64, tag = "5")]
216 Cancel(u64),
217 }
218}
219#[allow(clippy::all)]
221#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
222pub struct GuestPrepare {
223 #[prost(uint64, tag = "1")]
225 pub invocation: u64,
226 #[prost(string, tag = "2")]
228 pub operation: ::prost::alloc::string::String,
229 #[prost(bytes = "vec", tag = "3")]
231 pub fingerprint: ::prost::alloc::vec::Vec<u8>,
232 #[prost(uint64, tag = "4")]
234 pub generation: u64,
235 #[prost(bytes = "vec", tag = "5")]
237 pub payload: ::prost::alloc::vec::Vec<u8>,
238}
239#[allow(clippy::all)]
241#[derive(Clone, PartialEq, ::prost::Message)]
242pub struct GuestInvocation {
243 #[prost(uint64, tag = "1")]
245 pub invocation: u64,
246 #[prost(bytes = "vec", tag = "2")]
248 pub context: ::prost::alloc::vec::Vec<u8>,
249 #[prost(message, repeated, tag = "3")]
250 pub values: ::prost::alloc::vec::Vec<GuestValue>,
251}
252#[allow(clippy::all)]
254#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
255pub struct GuestValue {
256 #[prost(string, tag = "1")]
258 pub key: ::prost::alloc::string::String,
259 #[prost(bytes = "vec", tag = "2")]
261 pub payload: ::prost::alloc::vec::Vec<u8>,
262}
263#[allow(clippy::all)]
265#[derive(Clone, PartialEq, ::prost::Message)]
266pub struct GuestInitialize {
267 #[prost(bytes = "vec", tag = "1")]
269 pub configuration: ::prost::alloc::vec::Vec<u8>,
270 #[prost(bytes = "vec", tag = "2")]
272 pub generation_context: ::prost::alloc::vec::Vec<u8>,
273 #[prost(message, optional, tag = "3")]
274 pub assignments: ::core::option::Option<OperationAssignments>,
275}
276#[allow(clippy::all)]
278#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
279pub struct GuestShutdown {}
280#[allow(clippy::all)]
282#[derive(Clone, PartialEq, ::prost::Message)]
283pub struct GuestChild {
284 #[prost(oneof = "guest_child::Action", tags = "1, 2")]
286 pub action: ::core::option::Option<guest_child::Action>,
287}
288pub mod guest_child {
290 #[allow(clippy::all)]
292 #[derive(Clone, PartialEq, ::prost::Oneof)]
293 pub enum Action {
294 #[prost(message, tag = "1")]
296 Call(super::GuestChildRequest),
297 #[prost(message, tag = "2")]
298 Control(super::GuestChildControl),
299 }
300}
301#[allow(clippy::all)]
303#[derive(Clone, PartialEq, ::prost::Message)]
304pub struct GuestChildRequest {
305 #[prost(bytes = "vec", tag = "1")]
307 pub context: ::prost::alloc::vec::Vec<u8>,
308 #[prost(bytes = "vec", tag = "2")]
310 pub generation_context: ::prost::alloc::vec::Vec<u8>,
311 #[prost(message, optional, tag = "3")]
312 pub request: ::core::option::Option<ChildRequest>,
313 #[prost(uint64, tag = "4")]
315 pub generation: u64,
316 #[prost(bool, tag = "5")]
318 pub submit: bool,
319 #[prost(message, repeated, tag = "6")]
320 pub values: ::prost::alloc::vec::Vec<GuestValue>,
321}
322#[allow(clippy::all)]
324#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
325pub struct GuestChildControl {
326 #[prost(bytes = "vec", tag = "1")]
328 pub context: ::prost::alloc::vec::Vec<u8>,
329 #[prost(uint64, tag = "2")]
331 pub instance: u64,
332 #[prost(enumeration = "GuestChildAction", tag = "3")]
333 pub action: i32,
334}
335#[allow(clippy::all)]
337#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
338pub struct GuestSubmitted {
339 #[prost(uint64, tag = "1")]
341 pub instance: u64,
342}
343#[allow(clippy::all)]
345#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
346#[repr(i32)]
347pub enum GuestChildAction {
348 Unspecified = 0,
349 Status = 1,
350 Cancel = 2,
351 Join = 3,
352 Release = 4,
353 Detach = 5,
354}
355impl GuestChildAction {
356 pub fn as_str_name(&self) -> &'static str {
361 match self {
362 Self::Unspecified => "GUEST_CHILD_ACTION_UNSPECIFIED",
363 Self::Status => "GUEST_CHILD_ACTION_STATUS",
364 Self::Cancel => "GUEST_CHILD_ACTION_CANCEL",
365 Self::Join => "GUEST_CHILD_ACTION_JOIN",
366 Self::Release => "GUEST_CHILD_ACTION_RELEASE",
367 Self::Detach => "GUEST_CHILD_ACTION_DETACH",
368 }
369 }
370 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
372 match value {
373 "GUEST_CHILD_ACTION_UNSPECIFIED" => Some(Self::Unspecified),
374 "GUEST_CHILD_ACTION_STATUS" => Some(Self::Status),
375 "GUEST_CHILD_ACTION_CANCEL" => Some(Self::Cancel),
376 "GUEST_CHILD_ACTION_JOIN" => Some(Self::Join),
377 "GUEST_CHILD_ACTION_RELEASE" => Some(Self::Release),
378 "GUEST_CHILD_ACTION_DETACH" => Some(Self::Detach),
379 _ => None,
380 }
381 }
382}
383#[allow(clippy::all)]
385#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
386pub struct Window {
387 #[prost(message, optional, tag = "1")]
389 pub start: ::core::option::Option<::prost_types::Timestamp>,
390 #[prost(message, optional, tag = "2")]
392 pub period: ::core::option::Option<::prost_types::Duration>,
393 #[prost(uint64, tag = "3")]
395 pub count: u64,
396 #[prost(uint64, tag = "4")]
398 pub sequence: u64,
399 #[prost(string, repeated, tag = "5")]
401 pub capturing_executions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
402}
403#[allow(clippy::all)]
405#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
406pub struct SampleBatch {
407 #[prost(uint64, tag = "1")]
409 pub offset: u64,
410 #[prost(uint64, tag = "2")]
412 pub count: u64,
413 #[prost(bytes = "vec", tag = "3")]
419 pub columns: ::prost::alloc::vec::Vec<u8>,
420 #[prost(bool, tag = "4")]
422 pub last: bool,
423}
424#[allow(clippy::all)]
427#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
428pub struct CollectionDemand {
429 #[prost(string, repeated, tag = "1")]
430 pub streams: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
431}
432#[allow(clippy::all)]
434#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
435pub struct CollectionDemandResponse {}
436#[allow(clippy::all)]
438#[derive(Clone, PartialEq, ::prost::Message)]
439pub struct CollectionBatch {
440 #[prost(uint64, tag = "1")]
442 pub offset: u64,
443 #[prost(message, repeated, tag = "2")]
444 pub streams: ::prost::alloc::vec::Vec<CollectionRows>,
445 #[prost(bool, tag = "3")]
447 pub last: bool,
448}
449#[allow(clippy::all)]
451#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
452pub struct CollectionRows {
453 #[prost(string, tag = "1")]
454 pub stream: ::prost::alloc::string::String,
455 #[prost(bytes = "vec", repeated, tag = "2")]
456 pub rows: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
457}
458#[allow(clippy::all)]
460#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
461pub struct SamplesSelection {
462 #[prost(string, tag = "1")]
464 pub stream: ::prost::alloc::string::String,
465 #[prost(string, tag = "2")]
467 pub scope: ::prost::alloc::string::String,
468}
469#[allow(clippy::all)]
471#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
472pub struct Sample {
473 #[prost(message, optional, tag = "1")]
476 pub at: ::core::option::Option<::prost_types::Timestamp>,
477 #[prost(bytes = "vec", tag = "2")]
479 pub row: ::prost::alloc::vec::Vec<u8>,
480 #[prost(uint64, tag = "3")]
482 pub sequence: u64,
483}
484#[allow(clippy::all)]
486#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
487pub struct InstanceGetRequest {
488 #[prost(uint32, tag = "1")]
491 pub revision: u32,
492 #[prost(string, tag = "2")]
494 pub host: ::prost::alloc::string::String,
495 #[prost(string, tag = "3")]
496 pub host_version: ::prost::alloc::string::String,
497}
498#[allow(clippy::all)]
500#[derive(Clone, PartialEq, ::prost::Message)]
501pub struct InstanceGetResponse {
502 #[prost(string, tag = "1")]
504 pub id: ::prost::alloc::string::String,
505 #[prost(string, tag = "2")]
507 pub version: ::prost::alloc::string::String,
508 #[prost(message, optional, tag = "3")]
511 pub started_at: ::core::option::Option<::prost_types::Timestamp>,
512 #[prost(message, optional, tag = "4")]
513 pub declarations: ::core::option::Option<crate::model::Declarations>,
514 #[prost(uint32, tag = "5")]
516 pub revision: u32,
517 #[prost(string, tag = "6")]
519 pub sdk: ::prost::alloc::string::String,
520 #[prost(string, tag = "7")]
521 pub sdk_version: ::prost::alloc::string::String,
522 #[prost(uint64, tag = "8")]
524 pub message_bytes: u64,
525}
526#[allow(clippy::all)]
528#[derive(Clone, PartialEq, ::prost::Message)]
529pub struct InstanceInvokeRequest {
530 #[prost(oneof = "instance_invoke_request::Frame", tags = "1, 2, 3, 4")]
532 pub frame: ::core::option::Option<instance_invoke_request::Frame>,
533}
534pub mod instance_invoke_request {
536 #[allow(clippy::all)]
538 #[derive(Clone, PartialEq, ::prost::Oneof)]
539 pub enum Frame {
540 #[prost(message, tag = "1")]
541 Request(super::Request),
542 #[prost(message, tag = "2")]
543 Child(super::ChildResponse),
544 #[prost(message, tag = "3")]
545 Cancel(super::Cancel),
546 #[prost(bool, tag = "4")]
548 WindDown(bool),
549 }
550}
551#[allow(clippy::all)]
553#[derive(Clone, PartialEq, ::prost::Message)]
554pub struct InstanceInvokeResponse {
555 #[prost(oneof = "instance_invoke_response::Frame", tags = "1, 2, 3, 4")]
557 pub frame: ::core::option::Option<instance_invoke_response::Frame>,
558}
559pub mod instance_invoke_response {
561 #[allow(clippy::all)]
563 #[derive(Clone, PartialEq, ::prost::Oneof)]
564 pub enum Frame {
565 #[prost(message, tag = "1")]
566 Child(super::ChildRequest),
567 #[prost(message, tag = "2")]
568 ChildCancel(super::ChildCancel),
569 #[prost(message, tag = "3")]
570 Response(super::Response),
571 #[prost(message, tag = "4")]
572 ChildDemand(super::ChildDemand),
573 }
574}
575#[allow(clippy::all)]
577#[derive(Clone, PartialEq, ::prost::Message)]
578pub struct InstanceSamplesRequest {
579 #[prost(oneof = "instance_samples_request::Frame", tags = "1, 3, 4, 5, 6")]
581 pub frame: ::core::option::Option<instance_samples_request::Frame>,
582}
583pub mod instance_samples_request {
585 #[allow(clippy::all)]
587 #[derive(Clone, PartialEq, ::prost::Oneof)]
588 pub enum Frame {
589 #[prost(message, tag = "1")]
591 Open(super::SamplesSelection),
592 #[prost(message, tag = "3")]
594 Child(super::ChildResponse),
595 #[prost(message, tag = "4")]
597 Window(super::Window),
598 #[prost(message, tag = "5")]
600 Demand(super::CollectionDemand),
601 #[prost(bool, tag = "6")]
603 WindDown(bool),
604 }
605}
606#[allow(clippy::all)]
608#[derive(Clone, PartialEq, ::prost::Message)]
609pub struct InstanceSamplesResponse {
610 #[prost(message, repeated, tag = "1")]
612 pub samples: ::prost::alloc::vec::Vec<Sample>,
613 #[prost(oneof = "instance_samples_response::Frame", tags = "2, 3, 4, 5, 6, 7")]
615 pub frame: ::core::option::Option<instance_samples_response::Frame>,
616}
617pub mod instance_samples_response {
619 #[allow(clippy::all)]
621 #[derive(Clone, PartialEq, ::prost::Oneof)]
622 pub enum Frame {
623 #[prost(message, tag = "2")]
624 Child(super::ChildRequest),
625 #[prost(message, tag = "3")]
626 ChildCancel(super::ChildCancel),
627 #[prost(message, tag = "4")]
628 ChildDemand(super::ChildDemand),
629 #[prost(message, tag = "5")]
631 Batch(super::SampleBatch),
632 #[prost(message, tag = "6")]
634 Collection(super::CollectionBatch),
635 #[prost(message, tag = "7")]
637 Demand(super::CollectionDemandResponse),
638 }
639}
640#[allow(clippy::all)]
642#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
643pub struct InstanceStopRequest {
644 #[prost(string, tag = "1")]
645 pub reason: ::prost::alloc::string::String,
646}
647#[allow(clippy::all)]
649#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
650pub struct InstanceStopResponse {}
651#[cfg(not(target_arch = "wasm32"))]
653pub mod instance_client {
654 #![allow(
655 unused_variables,
656 dead_code,
657 missing_docs,
658 clippy::wildcard_imports,
659 clippy::let_unit_value,
660 )]
661 use tonic::codegen::*;
662 use tonic::codegen::http::Uri;
663 #[derive(Debug, Clone)]
665 pub struct InstanceClient<T> {
666 inner: tonic::client::Grpc<T>,
667 }
668 impl InstanceClient<tonic::transport::Channel> {
669 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
671 where
672 D: TryInto<tonic::transport::Endpoint>,
673 D::Error: Into<StdError>,
674 {
675 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
676 Ok(Self::new(conn))
677 }
678 }
679 impl<T> InstanceClient<T>
680 where
681 T: tonic::client::GrpcService<tonic::body::Body>,
682 T::Error: Into<StdError>,
683 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
684 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
685 {
686 pub fn new(inner: T) -> Self {
687 let inner = tonic::client::Grpc::new(inner);
688 Self { inner }
689 }
690 pub fn with_origin(inner: T, origin: Uri) -> Self {
691 let inner = tonic::client::Grpc::with_origin(inner, origin);
692 Self { inner }
693 }
694 pub fn with_interceptor<F>(
695 inner: T,
696 interceptor: F,
697 ) -> InstanceClient<InterceptedService<T, F>>
698 where
699 F: tonic::service::Interceptor,
700 T::ResponseBody: Default,
701 T: tonic::codegen::Service<
702 http::Request<tonic::body::Body>,
703 Response = http::Response<
704 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
705 >,
706 >,
707 <T as tonic::codegen::Service<
708 http::Request<tonic::body::Body>,
709 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
710 {
711 InstanceClient::new(InterceptedService::new(inner, interceptor))
712 }
713 #[must_use]
718 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
719 self.inner = self.inner.send_compressed(encoding);
720 self
721 }
722 #[must_use]
724 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
725 self.inner = self.inner.accept_compressed(encoding);
726 self
727 }
728 #[must_use]
732 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
733 self.inner = self.inner.max_decoding_message_size(limit);
734 self
735 }
736 #[must_use]
740 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
741 self.inner = self.inner.max_encoding_message_size(limit);
742 self
743 }
744 pub async fn get(
746 &mut self,
747 request: impl tonic::IntoRequest<super::InstanceGetRequest>,
748 ) -> std::result::Result<
749 tonic::Response<super::InstanceGetResponse>,
750 tonic::Status,
751 > {
752 self.inner
753 .ready()
754 .await
755 .map_err(|e| {
756 tonic::Status::unknown(
757 format!("Service was not ready: {}", e.into()),
758 )
759 })?;
760 let codec = tonic_prost::ProstCodec::default();
761 let path = http::uri::PathAndQuery::from_static(
762 "/harmos.plugin.v1.Instance/Get",
763 );
764 let mut req = request.into_request();
765 req.extensions_mut()
766 .insert(GrpcMethod::new("harmos.plugin.v1.Instance", "Get"));
767 self.inner.unary(req, path, codec).await
768 }
769 pub async fn invoke(
774 &mut self,
775 request: impl tonic::IntoStreamingRequest<
776 Message = super::InstanceInvokeRequest,
777 >,
778 ) -> std::result::Result<
779 tonic::Response<tonic::codec::Streaming<super::InstanceInvokeResponse>>,
780 tonic::Status,
781 > {
782 self.inner
783 .ready()
784 .await
785 .map_err(|e| {
786 tonic::Status::unknown(
787 format!("Service was not ready: {}", e.into()),
788 )
789 })?;
790 let codec = tonic_prost::ProstCodec::default();
791 let path = http::uri::PathAndQuery::from_static(
792 "/harmos.plugin.v1.Instance/Invoke",
793 );
794 let mut req = request.into_streaming_request();
795 req.extensions_mut()
796 .insert(GrpcMethod::new("harmos.plugin.v1.Instance", "Invoke"));
797 self.inner.streaming(req, path, codec).await
798 }
799 pub async fn samples(
817 &mut self,
818 request: impl tonic::IntoStreamingRequest<
819 Message = super::InstanceSamplesRequest,
820 >,
821 ) -> std::result::Result<
822 tonic::Response<tonic::codec::Streaming<super::InstanceSamplesResponse>>,
823 tonic::Status,
824 > {
825 self.inner
826 .ready()
827 .await
828 .map_err(|e| {
829 tonic::Status::unknown(
830 format!("Service was not ready: {}", e.into()),
831 )
832 })?;
833 let codec = tonic_prost::ProstCodec::default();
834 let path = http::uri::PathAndQuery::from_static(
835 "/harmos.plugin.v1.Instance/Samples",
836 );
837 let mut req = request.into_streaming_request();
838 req.extensions_mut()
839 .insert(GrpcMethod::new("harmos.plugin.v1.Instance", "Samples"));
840 self.inner.streaming(req, path, codec).await
841 }
842 pub async fn stop(
847 &mut self,
848 request: impl tonic::IntoRequest<super::InstanceStopRequest>,
849 ) -> std::result::Result<
850 tonic::Response<super::InstanceStopResponse>,
851 tonic::Status,
852 > {
853 self.inner
854 .ready()
855 .await
856 .map_err(|e| {
857 tonic::Status::unknown(
858 format!("Service was not ready: {}", e.into()),
859 )
860 })?;
861 let codec = tonic_prost::ProstCodec::default();
862 let path = http::uri::PathAndQuery::from_static(
863 "/harmos.plugin.v1.Instance/Stop",
864 );
865 let mut req = request.into_request();
866 req.extensions_mut()
867 .insert(GrpcMethod::new("harmos.plugin.v1.Instance", "Stop"));
868 self.inner.unary(req, path, codec).await
869 }
870 }
871}
872#[cfg(not(target_arch = "wasm32"))]
874pub mod instance_server {
875 #![allow(
876 unused_variables,
877 dead_code,
878 missing_docs,
879 clippy::wildcard_imports,
880 clippy::let_unit_value,
881 )]
882 use tonic::codegen::*;
883 #[async_trait]
885 pub trait Instance: std::marker::Send + std::marker::Sync + 'static {
886 async fn get(
888 &self,
889 request: tonic::Request<super::InstanceGetRequest>,
890 ) -> std::result::Result<
891 tonic::Response<super::InstanceGetResponse>,
892 tonic::Status,
893 >;
894 type InvokeStream: tonic::codegen::tokio_stream::Stream<
896 Item = std::result::Result<super::InstanceInvokeResponse, tonic::Status>,
897 >
898 + std::marker::Send
899 + 'static;
900 async fn invoke(
905 &self,
906 request: tonic::Request<tonic::Streaming<super::InstanceInvokeRequest>>,
907 ) -> std::result::Result<tonic::Response<Self::InvokeStream>, tonic::Status>;
908 type SamplesStream: tonic::codegen::tokio_stream::Stream<
910 Item = std::result::Result<super::InstanceSamplesResponse, tonic::Status>,
911 >
912 + std::marker::Send
913 + 'static;
914 async fn samples(
932 &self,
933 request: tonic::Request<tonic::Streaming<super::InstanceSamplesRequest>>,
934 ) -> std::result::Result<tonic::Response<Self::SamplesStream>, tonic::Status>;
935 async fn stop(
940 &self,
941 request: tonic::Request<super::InstanceStopRequest>,
942 ) -> std::result::Result<
943 tonic::Response<super::InstanceStopResponse>,
944 tonic::Status,
945 >;
946 }
947 #[derive(Debug)]
949 pub struct InstanceServer<T> {
950 inner: Arc<T>,
951 accept_compression_encodings: EnabledCompressionEncodings,
952 send_compression_encodings: EnabledCompressionEncodings,
953 max_decoding_message_size: Option<usize>,
954 max_encoding_message_size: Option<usize>,
955 }
956 impl<T> InstanceServer<T> {
957 pub fn new(inner: T) -> Self {
958 Self::from_arc(Arc::new(inner))
959 }
960 pub fn from_arc(inner: Arc<T>) -> Self {
961 Self {
962 inner,
963 accept_compression_encodings: Default::default(),
964 send_compression_encodings: Default::default(),
965 max_decoding_message_size: None,
966 max_encoding_message_size: None,
967 }
968 }
969 pub fn with_interceptor<F>(
970 inner: T,
971 interceptor: F,
972 ) -> InterceptedService<Self, F>
973 where
974 F: tonic::service::Interceptor,
975 {
976 InterceptedService::new(Self::new(inner), interceptor)
977 }
978 #[must_use]
980 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
981 self.accept_compression_encodings.enable(encoding);
982 self
983 }
984 #[must_use]
986 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
987 self.send_compression_encodings.enable(encoding);
988 self
989 }
990 #[must_use]
994 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
995 self.max_decoding_message_size = Some(limit);
996 self
997 }
998 #[must_use]
1002 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1003 self.max_encoding_message_size = Some(limit);
1004 self
1005 }
1006 }
1007 impl<T, B> tonic::codegen::Service<http::Request<B>> for InstanceServer<T>
1008 where
1009 T: Instance,
1010 B: Body + std::marker::Send + 'static,
1011 B::Error: Into<StdError> + std::marker::Send + 'static,
1012 {
1013 type Response = http::Response<tonic::body::Body>;
1014 type Error = std::convert::Infallible;
1015 type Future = BoxFuture<Self::Response, Self::Error>;
1016 fn poll_ready(
1017 &mut self,
1018 _cx: &mut Context<'_>,
1019 ) -> Poll<std::result::Result<(), Self::Error>> {
1020 Poll::Ready(Ok(()))
1021 }
1022 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1023 match req.uri().path() {
1024 "/harmos.plugin.v1.Instance/Get" => {
1025 #[allow(non_camel_case_types)]
1026 struct GetSvc<T: Instance>(pub Arc<T>);
1027 impl<
1028 T: Instance,
1029 > tonic::server::UnaryService<super::InstanceGetRequest>
1030 for GetSvc<T> {
1031 type Response = super::InstanceGetResponse;
1032 type Future = BoxFuture<
1033 tonic::Response<Self::Response>,
1034 tonic::Status,
1035 >;
1036 fn call(
1037 &mut self,
1038 request: tonic::Request<super::InstanceGetRequest>,
1039 ) -> Self::Future {
1040 let inner = Arc::clone(&self.0);
1041 let fut = async move {
1042 <T as Instance>::get(&inner, request).await
1043 };
1044 Box::pin(fut)
1045 }
1046 }
1047 let accept_compression_encodings = self.accept_compression_encodings;
1048 let send_compression_encodings = self.send_compression_encodings;
1049 let max_decoding_message_size = self.max_decoding_message_size;
1050 let max_encoding_message_size = self.max_encoding_message_size;
1051 let inner = self.inner.clone();
1052 let fut = async move {
1053 let method = GetSvc(inner);
1054 let codec = tonic_prost::ProstCodec::default();
1055 let mut grpc = tonic::server::Grpc::new(codec)
1056 .apply_compression_config(
1057 accept_compression_encodings,
1058 send_compression_encodings,
1059 )
1060 .apply_max_message_size_config(
1061 max_decoding_message_size,
1062 max_encoding_message_size,
1063 );
1064 let res = grpc.unary(method, req).await;
1065 Ok(res)
1066 };
1067 Box::pin(fut)
1068 }
1069 "/harmos.plugin.v1.Instance/Invoke" => {
1070 #[allow(non_camel_case_types)]
1071 struct InvokeSvc<T: Instance>(pub Arc<T>);
1072 impl<
1073 T: Instance,
1074 > tonic::server::StreamingService<super::InstanceInvokeRequest>
1075 for InvokeSvc<T> {
1076 type Response = super::InstanceInvokeResponse;
1077 type ResponseStream = T::InvokeStream;
1078 type Future = BoxFuture<
1079 tonic::Response<Self::ResponseStream>,
1080 tonic::Status,
1081 >;
1082 fn call(
1083 &mut self,
1084 request: tonic::Request<
1085 tonic::Streaming<super::InstanceInvokeRequest>,
1086 >,
1087 ) -> Self::Future {
1088 let inner = Arc::clone(&self.0);
1089 let fut = async move {
1090 <T as Instance>::invoke(&inner, request).await
1091 };
1092 Box::pin(fut)
1093 }
1094 }
1095 let accept_compression_encodings = self.accept_compression_encodings;
1096 let send_compression_encodings = self.send_compression_encodings;
1097 let max_decoding_message_size = self.max_decoding_message_size;
1098 let max_encoding_message_size = self.max_encoding_message_size;
1099 let inner = self.inner.clone();
1100 let fut = async move {
1101 let method = InvokeSvc(inner);
1102 let codec = tonic_prost::ProstCodec::default();
1103 let mut grpc = tonic::server::Grpc::new(codec)
1104 .apply_compression_config(
1105 accept_compression_encodings,
1106 send_compression_encodings,
1107 )
1108 .apply_max_message_size_config(
1109 max_decoding_message_size,
1110 max_encoding_message_size,
1111 );
1112 let res = grpc.streaming(method, req).await;
1113 Ok(res)
1114 };
1115 Box::pin(fut)
1116 }
1117 "/harmos.plugin.v1.Instance/Samples" => {
1118 #[allow(non_camel_case_types)]
1119 struct SamplesSvc<T: Instance>(pub Arc<T>);
1120 impl<
1121 T: Instance,
1122 > tonic::server::StreamingService<super::InstanceSamplesRequest>
1123 for SamplesSvc<T> {
1124 type Response = super::InstanceSamplesResponse;
1125 type ResponseStream = T::SamplesStream;
1126 type Future = BoxFuture<
1127 tonic::Response<Self::ResponseStream>,
1128 tonic::Status,
1129 >;
1130 fn call(
1131 &mut self,
1132 request: tonic::Request<
1133 tonic::Streaming<super::InstanceSamplesRequest>,
1134 >,
1135 ) -> Self::Future {
1136 let inner = Arc::clone(&self.0);
1137 let fut = async move {
1138 <T as Instance>::samples(&inner, request).await
1139 };
1140 Box::pin(fut)
1141 }
1142 }
1143 let accept_compression_encodings = self.accept_compression_encodings;
1144 let send_compression_encodings = self.send_compression_encodings;
1145 let max_decoding_message_size = self.max_decoding_message_size;
1146 let max_encoding_message_size = self.max_encoding_message_size;
1147 let inner = self.inner.clone();
1148 let fut = async move {
1149 let method = SamplesSvc(inner);
1150 let codec = tonic_prost::ProstCodec::default();
1151 let mut grpc = tonic::server::Grpc::new(codec)
1152 .apply_compression_config(
1153 accept_compression_encodings,
1154 send_compression_encodings,
1155 )
1156 .apply_max_message_size_config(
1157 max_decoding_message_size,
1158 max_encoding_message_size,
1159 );
1160 let res = grpc.streaming(method, req).await;
1161 Ok(res)
1162 };
1163 Box::pin(fut)
1164 }
1165 "/harmos.plugin.v1.Instance/Stop" => {
1166 #[allow(non_camel_case_types)]
1167 struct StopSvc<T: Instance>(pub Arc<T>);
1168 impl<
1169 T: Instance,
1170 > tonic::server::UnaryService<super::InstanceStopRequest>
1171 for StopSvc<T> {
1172 type Response = super::InstanceStopResponse;
1173 type Future = BoxFuture<
1174 tonic::Response<Self::Response>,
1175 tonic::Status,
1176 >;
1177 fn call(
1178 &mut self,
1179 request: tonic::Request<super::InstanceStopRequest>,
1180 ) -> Self::Future {
1181 let inner = Arc::clone(&self.0);
1182 let fut = async move {
1183 <T as Instance>::stop(&inner, request).await
1184 };
1185 Box::pin(fut)
1186 }
1187 }
1188 let accept_compression_encodings = self.accept_compression_encodings;
1189 let send_compression_encodings = self.send_compression_encodings;
1190 let max_decoding_message_size = self.max_decoding_message_size;
1191 let max_encoding_message_size = self.max_encoding_message_size;
1192 let inner = self.inner.clone();
1193 let fut = async move {
1194 let method = StopSvc(inner);
1195 let codec = tonic_prost::ProstCodec::default();
1196 let mut grpc = tonic::server::Grpc::new(codec)
1197 .apply_compression_config(
1198 accept_compression_encodings,
1199 send_compression_encodings,
1200 )
1201 .apply_max_message_size_config(
1202 max_decoding_message_size,
1203 max_encoding_message_size,
1204 );
1205 let res = grpc.unary(method, req).await;
1206 Ok(res)
1207 };
1208 Box::pin(fut)
1209 }
1210 _ => {
1211 Box::pin(async move {
1212 let mut response = http::Response::new(
1213 tonic::body::Body::default(),
1214 );
1215 let headers = response.headers_mut();
1216 headers
1217 .insert(
1218 tonic::Status::GRPC_STATUS,
1219 (tonic::Code::Unimplemented as i32).into(),
1220 );
1221 headers
1222 .insert(
1223 http::header::CONTENT_TYPE,
1224 tonic::metadata::GRPC_CONTENT_TYPE,
1225 );
1226 Ok(response)
1227 })
1228 }
1229 }
1230 }
1231 }
1232 impl<T> Clone for InstanceServer<T> {
1233 fn clone(&self) -> Self {
1234 let inner = self.inner.clone();
1235 Self {
1236 inner,
1237 accept_compression_encodings: self.accept_compression_encodings,
1238 send_compression_encodings: self.send_compression_encodings,
1239 max_decoding_message_size: self.max_decoding_message_size,
1240 max_encoding_message_size: self.max_encoding_message_size,
1241 }
1242 }
1243 }
1244 pub const SERVICE_NAME: &str = "harmos.plugin.v1.Instance";
1246 impl<T> tonic::server::NamedService for InstanceServer<T> {
1247 const NAME: &'static str = SERVICE_NAME;
1248 }
1249}
1250#[cfg(not(target_arch = "wasm32"))]
1252pub mod invocations_client {
1253 #![allow(
1254 unused_variables,
1255 dead_code,
1256 missing_docs,
1257 clippy::wildcard_imports,
1258 clippy::let_unit_value,
1259 )]
1260 use tonic::codegen::*;
1261 use tonic::codegen::http::Uri;
1262 #[derive(Debug, Clone)]
1264 pub struct InvocationsClient<T> {
1265 inner: tonic::client::Grpc<T>,
1266 }
1267 impl InvocationsClient<tonic::transport::Channel> {
1268 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1270 where
1271 D: TryInto<tonic::transport::Endpoint>,
1272 D::Error: Into<StdError>,
1273 {
1274 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1275 Ok(Self::new(conn))
1276 }
1277 }
1278 impl<T> InvocationsClient<T>
1279 where
1280 T: tonic::client::GrpcService<tonic::body::Body>,
1281 T::Error: Into<StdError>,
1282 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1283 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1284 {
1285 pub fn new(inner: T) -> Self {
1286 let inner = tonic::client::Grpc::new(inner);
1287 Self { inner }
1288 }
1289 pub fn with_origin(inner: T, origin: Uri) -> Self {
1290 let inner = tonic::client::Grpc::with_origin(inner, origin);
1291 Self { inner }
1292 }
1293 pub fn with_interceptor<F>(
1294 inner: T,
1295 interceptor: F,
1296 ) -> InvocationsClient<InterceptedService<T, F>>
1297 where
1298 F: tonic::service::Interceptor,
1299 T::ResponseBody: Default,
1300 T: tonic::codegen::Service<
1301 http::Request<tonic::body::Body>,
1302 Response = http::Response<
1303 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1304 >,
1305 >,
1306 <T as tonic::codegen::Service<
1307 http::Request<tonic::body::Body>,
1308 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1309 {
1310 InvocationsClient::new(InterceptedService::new(inner, interceptor))
1311 }
1312 #[must_use]
1317 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1318 self.inner = self.inner.send_compressed(encoding);
1319 self
1320 }
1321 #[must_use]
1323 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1324 self.inner = self.inner.accept_compressed(encoding);
1325 self
1326 }
1327 #[must_use]
1331 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1332 self.inner = self.inner.max_decoding_message_size(limit);
1333 self
1334 }
1335 #[must_use]
1339 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1340 self.inner = self.inner.max_encoding_message_size(limit);
1341 self
1342 }
1343 pub async fn get(
1345 &mut self,
1346 request: impl tonic::IntoRequest<crate::host::InvocationsGetRequest>,
1347 ) -> std::result::Result<
1348 tonic::Response<crate::host::InvocationsGetResponse>,
1349 tonic::Status,
1350 > {
1351 self.inner
1352 .ready()
1353 .await
1354 .map_err(|e| {
1355 tonic::Status::unknown(
1356 format!("Service was not ready: {}", e.into()),
1357 )
1358 })?;
1359 let codec = tonic_prost::ProstCodec::default();
1360 let path = http::uri::PathAndQuery::from_static(
1361 "/harmos.plugin.v1.Invocations/Get",
1362 );
1363 let mut req = request.into_request();
1364 req.extensions_mut()
1365 .insert(GrpcMethod::new("harmos.plugin.v1.Invocations", "Get"));
1366 self.inner.unary(req, path, codec).await
1367 }
1368 pub async fn cancel(
1370 &mut self,
1371 request: impl tonic::IntoRequest<crate::host::InvocationsCancelRequest>,
1372 ) -> std::result::Result<
1373 tonic::Response<crate::host::InvocationsCancelResponse>,
1374 tonic::Status,
1375 > {
1376 self.inner
1377 .ready()
1378 .await
1379 .map_err(|e| {
1380 tonic::Status::unknown(
1381 format!("Service was not ready: {}", e.into()),
1382 )
1383 })?;
1384 let codec = tonic_prost::ProstCodec::default();
1385 let path = http::uri::PathAndQuery::from_static(
1386 "/harmos.plugin.v1.Invocations/Cancel",
1387 );
1388 let mut req = request.into_request();
1389 req.extensions_mut()
1390 .insert(GrpcMethod::new("harmos.plugin.v1.Invocations", "Cancel"));
1391 self.inner.unary(req, path, codec).await
1392 }
1393 pub async fn watch(
1395 &mut self,
1396 request: impl tonic::IntoRequest<crate::host::InvocationsWatchRequest>,
1397 ) -> std::result::Result<
1398 tonic::Response<
1399 tonic::codec::Streaming<crate::host::InvocationsWatchResponse>,
1400 >,
1401 tonic::Status,
1402 > {
1403 self.inner
1404 .ready()
1405 .await
1406 .map_err(|e| {
1407 tonic::Status::unknown(
1408 format!("Service was not ready: {}", e.into()),
1409 )
1410 })?;
1411 let codec = tonic_prost::ProstCodec::default();
1412 let path = http::uri::PathAndQuery::from_static(
1413 "/harmos.plugin.v1.Invocations/Watch",
1414 );
1415 let mut req = request.into_request();
1416 req.extensions_mut()
1417 .insert(GrpcMethod::new("harmos.plugin.v1.Invocations", "Watch"));
1418 self.inner.server_streaming(req, path, codec).await
1419 }
1420 }
1421}
1422#[cfg(not(target_arch = "wasm32"))]
1424pub mod invocations_server {
1425 #![allow(
1426 unused_variables,
1427 dead_code,
1428 missing_docs,
1429 clippy::wildcard_imports,
1430 clippy::let_unit_value,
1431 )]
1432 use tonic::codegen::*;
1433 #[async_trait]
1435 pub trait Invocations: std::marker::Send + std::marker::Sync + 'static {
1436 async fn get(
1438 &self,
1439 request: tonic::Request<crate::host::InvocationsGetRequest>,
1440 ) -> std::result::Result<
1441 tonic::Response<crate::host::InvocationsGetResponse>,
1442 tonic::Status,
1443 >;
1444 async fn cancel(
1446 &self,
1447 request: tonic::Request<crate::host::InvocationsCancelRequest>,
1448 ) -> std::result::Result<
1449 tonic::Response<crate::host::InvocationsCancelResponse>,
1450 tonic::Status,
1451 >;
1452 type WatchStream: tonic::codegen::tokio_stream::Stream<
1454 Item = std::result::Result<
1455 crate::host::InvocationsWatchResponse,
1456 tonic::Status,
1457 >,
1458 >
1459 + std::marker::Send
1460 + 'static;
1461 async fn watch(
1463 &self,
1464 request: tonic::Request<crate::host::InvocationsWatchRequest>,
1465 ) -> std::result::Result<tonic::Response<Self::WatchStream>, tonic::Status>;
1466 }
1467 #[derive(Debug)]
1469 pub struct InvocationsServer<T> {
1470 inner: Arc<T>,
1471 accept_compression_encodings: EnabledCompressionEncodings,
1472 send_compression_encodings: EnabledCompressionEncodings,
1473 max_decoding_message_size: Option<usize>,
1474 max_encoding_message_size: Option<usize>,
1475 }
1476 impl<T> InvocationsServer<T> {
1477 pub fn new(inner: T) -> Self {
1478 Self::from_arc(Arc::new(inner))
1479 }
1480 pub fn from_arc(inner: Arc<T>) -> Self {
1481 Self {
1482 inner,
1483 accept_compression_encodings: Default::default(),
1484 send_compression_encodings: Default::default(),
1485 max_decoding_message_size: None,
1486 max_encoding_message_size: None,
1487 }
1488 }
1489 pub fn with_interceptor<F>(
1490 inner: T,
1491 interceptor: F,
1492 ) -> InterceptedService<Self, F>
1493 where
1494 F: tonic::service::Interceptor,
1495 {
1496 InterceptedService::new(Self::new(inner), interceptor)
1497 }
1498 #[must_use]
1500 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1501 self.accept_compression_encodings.enable(encoding);
1502 self
1503 }
1504 #[must_use]
1506 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1507 self.send_compression_encodings.enable(encoding);
1508 self
1509 }
1510 #[must_use]
1514 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1515 self.max_decoding_message_size = Some(limit);
1516 self
1517 }
1518 #[must_use]
1522 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1523 self.max_encoding_message_size = Some(limit);
1524 self
1525 }
1526 }
1527 impl<T, B> tonic::codegen::Service<http::Request<B>> for InvocationsServer<T>
1528 where
1529 T: Invocations,
1530 B: Body + std::marker::Send + 'static,
1531 B::Error: Into<StdError> + std::marker::Send + 'static,
1532 {
1533 type Response = http::Response<tonic::body::Body>;
1534 type Error = std::convert::Infallible;
1535 type Future = BoxFuture<Self::Response, Self::Error>;
1536 fn poll_ready(
1537 &mut self,
1538 _cx: &mut Context<'_>,
1539 ) -> Poll<std::result::Result<(), Self::Error>> {
1540 Poll::Ready(Ok(()))
1541 }
1542 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1543 match req.uri().path() {
1544 "/harmos.plugin.v1.Invocations/Get" => {
1545 #[allow(non_camel_case_types)]
1546 struct GetSvc<T: Invocations>(pub Arc<T>);
1547 impl<
1548 T: Invocations,
1549 > tonic::server::UnaryService<crate::host::InvocationsGetRequest>
1550 for GetSvc<T> {
1551 type Response = crate::host::InvocationsGetResponse;
1552 type Future = BoxFuture<
1553 tonic::Response<Self::Response>,
1554 tonic::Status,
1555 >;
1556 fn call(
1557 &mut self,
1558 request: tonic::Request<crate::host::InvocationsGetRequest>,
1559 ) -> Self::Future {
1560 let inner = Arc::clone(&self.0);
1561 let fut = async move {
1562 <T as Invocations>::get(&inner, request).await
1563 };
1564 Box::pin(fut)
1565 }
1566 }
1567 let accept_compression_encodings = self.accept_compression_encodings;
1568 let send_compression_encodings = self.send_compression_encodings;
1569 let max_decoding_message_size = self.max_decoding_message_size;
1570 let max_encoding_message_size = self.max_encoding_message_size;
1571 let inner = self.inner.clone();
1572 let fut = async move {
1573 let method = GetSvc(inner);
1574 let codec = tonic_prost::ProstCodec::default();
1575 let mut grpc = tonic::server::Grpc::new(codec)
1576 .apply_compression_config(
1577 accept_compression_encodings,
1578 send_compression_encodings,
1579 )
1580 .apply_max_message_size_config(
1581 max_decoding_message_size,
1582 max_encoding_message_size,
1583 );
1584 let res = grpc.unary(method, req).await;
1585 Ok(res)
1586 };
1587 Box::pin(fut)
1588 }
1589 "/harmos.plugin.v1.Invocations/Cancel" => {
1590 #[allow(non_camel_case_types)]
1591 struct CancelSvc<T: Invocations>(pub Arc<T>);
1592 impl<
1593 T: Invocations,
1594 > tonic::server::UnaryService<crate::host::InvocationsCancelRequest>
1595 for CancelSvc<T> {
1596 type Response = crate::host::InvocationsCancelResponse;
1597 type Future = BoxFuture<
1598 tonic::Response<Self::Response>,
1599 tonic::Status,
1600 >;
1601 fn call(
1602 &mut self,
1603 request: tonic::Request<
1604 crate::host::InvocationsCancelRequest,
1605 >,
1606 ) -> Self::Future {
1607 let inner = Arc::clone(&self.0);
1608 let fut = async move {
1609 <T as Invocations>::cancel(&inner, request).await
1610 };
1611 Box::pin(fut)
1612 }
1613 }
1614 let accept_compression_encodings = self.accept_compression_encodings;
1615 let send_compression_encodings = self.send_compression_encodings;
1616 let max_decoding_message_size = self.max_decoding_message_size;
1617 let max_encoding_message_size = self.max_encoding_message_size;
1618 let inner = self.inner.clone();
1619 let fut = async move {
1620 let method = CancelSvc(inner);
1621 let codec = tonic_prost::ProstCodec::default();
1622 let mut grpc = tonic::server::Grpc::new(codec)
1623 .apply_compression_config(
1624 accept_compression_encodings,
1625 send_compression_encodings,
1626 )
1627 .apply_max_message_size_config(
1628 max_decoding_message_size,
1629 max_encoding_message_size,
1630 );
1631 let res = grpc.unary(method, req).await;
1632 Ok(res)
1633 };
1634 Box::pin(fut)
1635 }
1636 "/harmos.plugin.v1.Invocations/Watch" => {
1637 #[allow(non_camel_case_types)]
1638 struct WatchSvc<T: Invocations>(pub Arc<T>);
1639 impl<
1640 T: Invocations,
1641 > tonic::server::ServerStreamingService<
1642 crate::host::InvocationsWatchRequest,
1643 > for WatchSvc<T> {
1644 type Response = crate::host::InvocationsWatchResponse;
1645 type ResponseStream = T::WatchStream;
1646 type Future = BoxFuture<
1647 tonic::Response<Self::ResponseStream>,
1648 tonic::Status,
1649 >;
1650 fn call(
1651 &mut self,
1652 request: tonic::Request<crate::host::InvocationsWatchRequest>,
1653 ) -> Self::Future {
1654 let inner = Arc::clone(&self.0);
1655 let fut = async move {
1656 <T as Invocations>::watch(&inner, request).await
1657 };
1658 Box::pin(fut)
1659 }
1660 }
1661 let accept_compression_encodings = self.accept_compression_encodings;
1662 let send_compression_encodings = self.send_compression_encodings;
1663 let max_decoding_message_size = self.max_decoding_message_size;
1664 let max_encoding_message_size = self.max_encoding_message_size;
1665 let inner = self.inner.clone();
1666 let fut = async move {
1667 let method = WatchSvc(inner);
1668 let codec = tonic_prost::ProstCodec::default();
1669 let mut grpc = tonic::server::Grpc::new(codec)
1670 .apply_compression_config(
1671 accept_compression_encodings,
1672 send_compression_encodings,
1673 )
1674 .apply_max_message_size_config(
1675 max_decoding_message_size,
1676 max_encoding_message_size,
1677 );
1678 let res = grpc.server_streaming(method, req).await;
1679 Ok(res)
1680 };
1681 Box::pin(fut)
1682 }
1683 _ => {
1684 Box::pin(async move {
1685 let mut response = http::Response::new(
1686 tonic::body::Body::default(),
1687 );
1688 let headers = response.headers_mut();
1689 headers
1690 .insert(
1691 tonic::Status::GRPC_STATUS,
1692 (tonic::Code::Unimplemented as i32).into(),
1693 );
1694 headers
1695 .insert(
1696 http::header::CONTENT_TYPE,
1697 tonic::metadata::GRPC_CONTENT_TYPE,
1698 );
1699 Ok(response)
1700 })
1701 }
1702 }
1703 }
1704 }
1705 impl<T> Clone for InvocationsServer<T> {
1706 fn clone(&self) -> Self {
1707 let inner = self.inner.clone();
1708 Self {
1709 inner,
1710 accept_compression_encodings: self.accept_compression_encodings,
1711 send_compression_encodings: self.send_compression_encodings,
1712 max_decoding_message_size: self.max_decoding_message_size,
1713 max_encoding_message_size: self.max_encoding_message_size,
1714 }
1715 }
1716 }
1717 pub const SERVICE_NAME: &str = "harmos.plugin.v1.Invocations";
1719 impl<T> tonic::server::NamedService for InvocationsServer<T> {
1720 const NAME: &'static str = SERVICE_NAME;
1721 }
1722}
1723#[allow(clippy::all)]
1725#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1726pub struct LaunchesAnnounceRequest {
1727 #[prost(string, tag = "1")]
1729 pub token: ::prost::alloc::string::String,
1730 #[prost(string, tag = "2")]
1732 pub address: ::prost::alloc::string::String,
1733}
1734#[allow(clippy::all)]
1736#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1737pub struct LaunchesAnnounceResponse {}
1738#[cfg(not(target_arch = "wasm32"))]
1740pub mod launches_client {
1741 #![allow(
1742 unused_variables,
1743 dead_code,
1744 missing_docs,
1745 clippy::wildcard_imports,
1746 clippy::let_unit_value,
1747 )]
1748 use tonic::codegen::*;
1749 use tonic::codegen::http::Uri;
1750 #[derive(Debug, Clone)]
1752 pub struct LaunchesClient<T> {
1753 inner: tonic::client::Grpc<T>,
1754 }
1755 impl LaunchesClient<tonic::transport::Channel> {
1756 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1758 where
1759 D: TryInto<tonic::transport::Endpoint>,
1760 D::Error: Into<StdError>,
1761 {
1762 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1763 Ok(Self::new(conn))
1764 }
1765 }
1766 impl<T> LaunchesClient<T>
1767 where
1768 T: tonic::client::GrpcService<tonic::body::Body>,
1769 T::Error: Into<StdError>,
1770 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1771 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1772 {
1773 pub fn new(inner: T) -> Self {
1774 let inner = tonic::client::Grpc::new(inner);
1775 Self { inner }
1776 }
1777 pub fn with_origin(inner: T, origin: Uri) -> Self {
1778 let inner = tonic::client::Grpc::with_origin(inner, origin);
1779 Self { inner }
1780 }
1781 pub fn with_interceptor<F>(
1782 inner: T,
1783 interceptor: F,
1784 ) -> LaunchesClient<InterceptedService<T, F>>
1785 where
1786 F: tonic::service::Interceptor,
1787 T::ResponseBody: Default,
1788 T: tonic::codegen::Service<
1789 http::Request<tonic::body::Body>,
1790 Response = http::Response<
1791 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1792 >,
1793 >,
1794 <T as tonic::codegen::Service<
1795 http::Request<tonic::body::Body>,
1796 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1797 {
1798 LaunchesClient::new(InterceptedService::new(inner, interceptor))
1799 }
1800 #[must_use]
1805 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1806 self.inner = self.inner.send_compressed(encoding);
1807 self
1808 }
1809 #[must_use]
1811 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1812 self.inner = self.inner.accept_compressed(encoding);
1813 self
1814 }
1815 #[must_use]
1819 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1820 self.inner = self.inner.max_decoding_message_size(limit);
1821 self
1822 }
1823 #[must_use]
1827 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1828 self.inner = self.inner.max_encoding_message_size(limit);
1829 self
1830 }
1831 pub async fn announce(
1833 &mut self,
1834 request: impl tonic::IntoRequest<super::LaunchesAnnounceRequest>,
1835 ) -> std::result::Result<
1836 tonic::Response<super::LaunchesAnnounceResponse>,
1837 tonic::Status,
1838 > {
1839 self.inner
1840 .ready()
1841 .await
1842 .map_err(|e| {
1843 tonic::Status::unknown(
1844 format!("Service was not ready: {}", e.into()),
1845 )
1846 })?;
1847 let codec = tonic_prost::ProstCodec::default();
1848 let path = http::uri::PathAndQuery::from_static(
1849 "/harmos.plugin.v1.Launches/Announce",
1850 );
1851 let mut req = request.into_request();
1852 req.extensions_mut()
1853 .insert(GrpcMethod::new("harmos.plugin.v1.Launches", "Announce"));
1854 self.inner.unary(req, path, codec).await
1855 }
1856 }
1857}
1858#[cfg(not(target_arch = "wasm32"))]
1860pub mod launches_server {
1861 #![allow(
1862 unused_variables,
1863 dead_code,
1864 missing_docs,
1865 clippy::wildcard_imports,
1866 clippy::let_unit_value,
1867 )]
1868 use tonic::codegen::*;
1869 #[async_trait]
1871 pub trait Launches: std::marker::Send + std::marker::Sync + 'static {
1872 async fn announce(
1874 &self,
1875 request: tonic::Request<super::LaunchesAnnounceRequest>,
1876 ) -> std::result::Result<
1877 tonic::Response<super::LaunchesAnnounceResponse>,
1878 tonic::Status,
1879 >;
1880 }
1881 #[derive(Debug)]
1883 pub struct LaunchesServer<T> {
1884 inner: Arc<T>,
1885 accept_compression_encodings: EnabledCompressionEncodings,
1886 send_compression_encodings: EnabledCompressionEncodings,
1887 max_decoding_message_size: Option<usize>,
1888 max_encoding_message_size: Option<usize>,
1889 }
1890 impl<T> LaunchesServer<T> {
1891 pub fn new(inner: T) -> Self {
1892 Self::from_arc(Arc::new(inner))
1893 }
1894 pub fn from_arc(inner: Arc<T>) -> Self {
1895 Self {
1896 inner,
1897 accept_compression_encodings: Default::default(),
1898 send_compression_encodings: Default::default(),
1899 max_decoding_message_size: None,
1900 max_encoding_message_size: None,
1901 }
1902 }
1903 pub fn with_interceptor<F>(
1904 inner: T,
1905 interceptor: F,
1906 ) -> InterceptedService<Self, F>
1907 where
1908 F: tonic::service::Interceptor,
1909 {
1910 InterceptedService::new(Self::new(inner), interceptor)
1911 }
1912 #[must_use]
1914 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1915 self.accept_compression_encodings.enable(encoding);
1916 self
1917 }
1918 #[must_use]
1920 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1921 self.send_compression_encodings.enable(encoding);
1922 self
1923 }
1924 #[must_use]
1928 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1929 self.max_decoding_message_size = Some(limit);
1930 self
1931 }
1932 #[must_use]
1936 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1937 self.max_encoding_message_size = Some(limit);
1938 self
1939 }
1940 }
1941 impl<T, B> tonic::codegen::Service<http::Request<B>> for LaunchesServer<T>
1942 where
1943 T: Launches,
1944 B: Body + std::marker::Send + 'static,
1945 B::Error: Into<StdError> + std::marker::Send + 'static,
1946 {
1947 type Response = http::Response<tonic::body::Body>;
1948 type Error = std::convert::Infallible;
1949 type Future = BoxFuture<Self::Response, Self::Error>;
1950 fn poll_ready(
1951 &mut self,
1952 _cx: &mut Context<'_>,
1953 ) -> Poll<std::result::Result<(), Self::Error>> {
1954 Poll::Ready(Ok(()))
1955 }
1956 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1957 match req.uri().path() {
1958 "/harmos.plugin.v1.Launches/Announce" => {
1959 #[allow(non_camel_case_types)]
1960 struct AnnounceSvc<T: Launches>(pub Arc<T>);
1961 impl<
1962 T: Launches,
1963 > tonic::server::UnaryService<super::LaunchesAnnounceRequest>
1964 for AnnounceSvc<T> {
1965 type Response = super::LaunchesAnnounceResponse;
1966 type Future = BoxFuture<
1967 tonic::Response<Self::Response>,
1968 tonic::Status,
1969 >;
1970 fn call(
1971 &mut self,
1972 request: tonic::Request<super::LaunchesAnnounceRequest>,
1973 ) -> Self::Future {
1974 let inner = Arc::clone(&self.0);
1975 let fut = async move {
1976 <T as Launches>::announce(&inner, request).await
1977 };
1978 Box::pin(fut)
1979 }
1980 }
1981 let accept_compression_encodings = self.accept_compression_encodings;
1982 let send_compression_encodings = self.send_compression_encodings;
1983 let max_decoding_message_size = self.max_decoding_message_size;
1984 let max_encoding_message_size = self.max_encoding_message_size;
1985 let inner = self.inner.clone();
1986 let fut = async move {
1987 let method = AnnounceSvc(inner);
1988 let codec = tonic_prost::ProstCodec::default();
1989 let mut grpc = tonic::server::Grpc::new(codec)
1990 .apply_compression_config(
1991 accept_compression_encodings,
1992 send_compression_encodings,
1993 )
1994 .apply_max_message_size_config(
1995 max_decoding_message_size,
1996 max_encoding_message_size,
1997 );
1998 let res = grpc.unary(method, req).await;
1999 Ok(res)
2000 };
2001 Box::pin(fut)
2002 }
2003 _ => {
2004 Box::pin(async move {
2005 let mut response = http::Response::new(
2006 tonic::body::Body::default(),
2007 );
2008 let headers = response.headers_mut();
2009 headers
2010 .insert(
2011 tonic::Status::GRPC_STATUS,
2012 (tonic::Code::Unimplemented as i32).into(),
2013 );
2014 headers
2015 .insert(
2016 http::header::CONTENT_TYPE,
2017 tonic::metadata::GRPC_CONTENT_TYPE,
2018 );
2019 Ok(response)
2020 })
2021 }
2022 }
2023 }
2024 }
2025 impl<T> Clone for LaunchesServer<T> {
2026 fn clone(&self) -> Self {
2027 let inner = self.inner.clone();
2028 Self {
2029 inner,
2030 accept_compression_encodings: self.accept_compression_encodings,
2031 send_compression_encodings: self.send_compression_encodings,
2032 max_decoding_message_size: self.max_decoding_message_size,
2033 max_encoding_message_size: self.max_encoding_message_size,
2034 }
2035 }
2036 }
2037 pub const SERVICE_NAME: &str = "harmos.plugin.v1.Launches";
2039 impl<T> tonic::server::NamedService for LaunchesServer<T> {
2040 const NAME: &'static str = SERVICE_NAME;
2041 }
2042}
2043#[cfg(not(target_arch = "wasm32"))]
2045pub mod operations_client {
2046 #![allow(
2047 unused_variables,
2048 dead_code,
2049 missing_docs,
2050 clippy::wildcard_imports,
2051 clippy::let_unit_value,
2052 )]
2053 use tonic::codegen::*;
2054 use tonic::codegen::http::Uri;
2055 #[derive(Debug, Clone)]
2057 pub struct OperationsClient<T> {
2058 inner: tonic::client::Grpc<T>,
2059 }
2060 impl OperationsClient<tonic::transport::Channel> {
2061 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2063 where
2064 D: TryInto<tonic::transport::Endpoint>,
2065 D::Error: Into<StdError>,
2066 {
2067 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2068 Ok(Self::new(conn))
2069 }
2070 }
2071 impl<T> OperationsClient<T>
2072 where
2073 T: tonic::client::GrpcService<tonic::body::Body>,
2074 T::Error: Into<StdError>,
2075 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2076 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2077 {
2078 pub fn new(inner: T) -> Self {
2079 let inner = tonic::client::Grpc::new(inner);
2080 Self { inner }
2081 }
2082 pub fn with_origin(inner: T, origin: Uri) -> Self {
2083 let inner = tonic::client::Grpc::with_origin(inner, origin);
2084 Self { inner }
2085 }
2086 pub fn with_interceptor<F>(
2087 inner: T,
2088 interceptor: F,
2089 ) -> OperationsClient<InterceptedService<T, F>>
2090 where
2091 F: tonic::service::Interceptor,
2092 T::ResponseBody: Default,
2093 T: tonic::codegen::Service<
2094 http::Request<tonic::body::Body>,
2095 Response = http::Response<
2096 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2097 >,
2098 >,
2099 <T as tonic::codegen::Service<
2100 http::Request<tonic::body::Body>,
2101 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2102 {
2103 OperationsClient::new(InterceptedService::new(inner, interceptor))
2104 }
2105 #[must_use]
2110 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2111 self.inner = self.inner.send_compressed(encoding);
2112 self
2113 }
2114 #[must_use]
2116 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2117 self.inner = self.inner.accept_compressed(encoding);
2118 self
2119 }
2120 #[must_use]
2124 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2125 self.inner = self.inner.max_decoding_message_size(limit);
2126 self
2127 }
2128 #[must_use]
2132 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2133 self.inner = self.inner.max_encoding_message_size(limit);
2134 self
2135 }
2136 pub async fn list(
2138 &mut self,
2139 request: impl tonic::IntoRequest<crate::host::OperationsListRequest>,
2140 ) -> std::result::Result<
2141 tonic::Response<crate::host::OperationsListResponse>,
2142 tonic::Status,
2143 > {
2144 self.inner
2145 .ready()
2146 .await
2147 .map_err(|e| {
2148 tonic::Status::unknown(
2149 format!("Service was not ready: {}", e.into()),
2150 )
2151 })?;
2152 let codec = tonic_prost::ProstCodec::default();
2153 let path = http::uri::PathAndQuery::from_static(
2154 "/harmos.plugin.v1.Operations/List",
2155 );
2156 let mut req = request.into_request();
2157 req.extensions_mut()
2158 .insert(GrpcMethod::new("harmos.plugin.v1.Operations", "List"));
2159 self.inner.unary(req, path, codec).await
2160 }
2161 pub async fn get(
2163 &mut self,
2164 request: impl tonic::IntoRequest<crate::host::OperationsGetRequest>,
2165 ) -> std::result::Result<
2166 tonic::Response<crate::host::OperationsGetResponse>,
2167 tonic::Status,
2168 > {
2169 self.inner
2170 .ready()
2171 .await
2172 .map_err(|e| {
2173 tonic::Status::unknown(
2174 format!("Service was not ready: {}", e.into()),
2175 )
2176 })?;
2177 let codec = tonic_prost::ProstCodec::default();
2178 let path = http::uri::PathAndQuery::from_static(
2179 "/harmos.plugin.v1.Operations/Get",
2180 );
2181 let mut req = request.into_request();
2182 req.extensions_mut()
2183 .insert(GrpcMethod::new("harmos.plugin.v1.Operations", "Get"));
2184 self.inner.unary(req, path, codec).await
2185 }
2186 }
2187}
2188#[cfg(not(target_arch = "wasm32"))]
2190pub mod operations_server {
2191 #![allow(
2192 unused_variables,
2193 dead_code,
2194 missing_docs,
2195 clippy::wildcard_imports,
2196 clippy::let_unit_value,
2197 )]
2198 use tonic::codegen::*;
2199 #[async_trait]
2201 pub trait Operations: std::marker::Send + std::marker::Sync + 'static {
2202 async fn list(
2204 &self,
2205 request: tonic::Request<crate::host::OperationsListRequest>,
2206 ) -> std::result::Result<
2207 tonic::Response<crate::host::OperationsListResponse>,
2208 tonic::Status,
2209 >;
2210 async fn get(
2212 &self,
2213 request: tonic::Request<crate::host::OperationsGetRequest>,
2214 ) -> std::result::Result<
2215 tonic::Response<crate::host::OperationsGetResponse>,
2216 tonic::Status,
2217 >;
2218 }
2219 #[derive(Debug)]
2221 pub struct OperationsServer<T> {
2222 inner: Arc<T>,
2223 accept_compression_encodings: EnabledCompressionEncodings,
2224 send_compression_encodings: EnabledCompressionEncodings,
2225 max_decoding_message_size: Option<usize>,
2226 max_encoding_message_size: Option<usize>,
2227 }
2228 impl<T> OperationsServer<T> {
2229 pub fn new(inner: T) -> Self {
2230 Self::from_arc(Arc::new(inner))
2231 }
2232 pub fn from_arc(inner: Arc<T>) -> Self {
2233 Self {
2234 inner,
2235 accept_compression_encodings: Default::default(),
2236 send_compression_encodings: Default::default(),
2237 max_decoding_message_size: None,
2238 max_encoding_message_size: None,
2239 }
2240 }
2241 pub fn with_interceptor<F>(
2242 inner: T,
2243 interceptor: F,
2244 ) -> InterceptedService<Self, F>
2245 where
2246 F: tonic::service::Interceptor,
2247 {
2248 InterceptedService::new(Self::new(inner), interceptor)
2249 }
2250 #[must_use]
2252 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2253 self.accept_compression_encodings.enable(encoding);
2254 self
2255 }
2256 #[must_use]
2258 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2259 self.send_compression_encodings.enable(encoding);
2260 self
2261 }
2262 #[must_use]
2266 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2267 self.max_decoding_message_size = Some(limit);
2268 self
2269 }
2270 #[must_use]
2274 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2275 self.max_encoding_message_size = Some(limit);
2276 self
2277 }
2278 }
2279 impl<T, B> tonic::codegen::Service<http::Request<B>> for OperationsServer<T>
2280 where
2281 T: Operations,
2282 B: Body + std::marker::Send + 'static,
2283 B::Error: Into<StdError> + std::marker::Send + 'static,
2284 {
2285 type Response = http::Response<tonic::body::Body>;
2286 type Error = std::convert::Infallible;
2287 type Future = BoxFuture<Self::Response, Self::Error>;
2288 fn poll_ready(
2289 &mut self,
2290 _cx: &mut Context<'_>,
2291 ) -> Poll<std::result::Result<(), Self::Error>> {
2292 Poll::Ready(Ok(()))
2293 }
2294 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2295 match req.uri().path() {
2296 "/harmos.plugin.v1.Operations/List" => {
2297 #[allow(non_camel_case_types)]
2298 struct ListSvc<T: Operations>(pub Arc<T>);
2299 impl<
2300 T: Operations,
2301 > tonic::server::UnaryService<crate::host::OperationsListRequest>
2302 for ListSvc<T> {
2303 type Response = crate::host::OperationsListResponse;
2304 type Future = BoxFuture<
2305 tonic::Response<Self::Response>,
2306 tonic::Status,
2307 >;
2308 fn call(
2309 &mut self,
2310 request: tonic::Request<crate::host::OperationsListRequest>,
2311 ) -> Self::Future {
2312 let inner = Arc::clone(&self.0);
2313 let fut = async move {
2314 <T as Operations>::list(&inner, request).await
2315 };
2316 Box::pin(fut)
2317 }
2318 }
2319 let accept_compression_encodings = self.accept_compression_encodings;
2320 let send_compression_encodings = self.send_compression_encodings;
2321 let max_decoding_message_size = self.max_decoding_message_size;
2322 let max_encoding_message_size = self.max_encoding_message_size;
2323 let inner = self.inner.clone();
2324 let fut = async move {
2325 let method = ListSvc(inner);
2326 let codec = tonic_prost::ProstCodec::default();
2327 let mut grpc = tonic::server::Grpc::new(codec)
2328 .apply_compression_config(
2329 accept_compression_encodings,
2330 send_compression_encodings,
2331 )
2332 .apply_max_message_size_config(
2333 max_decoding_message_size,
2334 max_encoding_message_size,
2335 );
2336 let res = grpc.unary(method, req).await;
2337 Ok(res)
2338 };
2339 Box::pin(fut)
2340 }
2341 "/harmos.plugin.v1.Operations/Get" => {
2342 #[allow(non_camel_case_types)]
2343 struct GetSvc<T: Operations>(pub Arc<T>);
2344 impl<
2345 T: Operations,
2346 > tonic::server::UnaryService<crate::host::OperationsGetRequest>
2347 for GetSvc<T> {
2348 type Response = crate::host::OperationsGetResponse;
2349 type Future = BoxFuture<
2350 tonic::Response<Self::Response>,
2351 tonic::Status,
2352 >;
2353 fn call(
2354 &mut self,
2355 request: tonic::Request<crate::host::OperationsGetRequest>,
2356 ) -> Self::Future {
2357 let inner = Arc::clone(&self.0);
2358 let fut = async move {
2359 <T as Operations>::get(&inner, request).await
2360 };
2361 Box::pin(fut)
2362 }
2363 }
2364 let accept_compression_encodings = self.accept_compression_encodings;
2365 let send_compression_encodings = self.send_compression_encodings;
2366 let max_decoding_message_size = self.max_decoding_message_size;
2367 let max_encoding_message_size = self.max_encoding_message_size;
2368 let inner = self.inner.clone();
2369 let fut = async move {
2370 let method = GetSvc(inner);
2371 let codec = tonic_prost::ProstCodec::default();
2372 let mut grpc = tonic::server::Grpc::new(codec)
2373 .apply_compression_config(
2374 accept_compression_encodings,
2375 send_compression_encodings,
2376 )
2377 .apply_max_message_size_config(
2378 max_decoding_message_size,
2379 max_encoding_message_size,
2380 );
2381 let res = grpc.unary(method, req).await;
2382 Ok(res)
2383 };
2384 Box::pin(fut)
2385 }
2386 _ => {
2387 Box::pin(async move {
2388 let mut response = http::Response::new(
2389 tonic::body::Body::default(),
2390 );
2391 let headers = response.headers_mut();
2392 headers
2393 .insert(
2394 tonic::Status::GRPC_STATUS,
2395 (tonic::Code::Unimplemented as i32).into(),
2396 );
2397 headers
2398 .insert(
2399 http::header::CONTENT_TYPE,
2400 tonic::metadata::GRPC_CONTENT_TYPE,
2401 );
2402 Ok(response)
2403 })
2404 }
2405 }
2406 }
2407 }
2408 impl<T> Clone for OperationsServer<T> {
2409 fn clone(&self) -> Self {
2410 let inner = self.inner.clone();
2411 Self {
2412 inner,
2413 accept_compression_encodings: self.accept_compression_encodings,
2414 send_compression_encodings: self.send_compression_encodings,
2415 max_decoding_message_size: self.max_decoding_message_size,
2416 max_encoding_message_size: self.max_encoding_message_size,
2417 }
2418 }
2419 }
2420 pub const SERVICE_NAME: &str = "harmos.plugin.v1.Operations";
2422 impl<T> tonic::server::NamedService for OperationsServer<T> {
2423 const NAME: &'static str = SERVICE_NAME;
2424 }
2425}
2426#[allow(clippy::all)]
2428#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2429pub struct SubscriptionsSubscribeRequest {
2430 #[prost(string, tag = "1")]
2431 pub stream: ::prost::alloc::string::String,
2432 #[prost(string, tag = "2")]
2433 pub row: ::prost::alloc::string::String,
2434 #[prost(bytes = "vec", tag = "3")]
2436 pub types: ::prost::alloc::vec::Vec<u8>,
2437}
2438#[allow(clippy::all)]
2440#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2441pub struct SubscriptionsSubscribeResponse {
2442 #[prost(oneof = "subscriptions_subscribe_response::Item", tags = "1, 2, 3")]
2443 pub item: ::core::option::Option<subscriptions_subscribe_response::Item>,
2444}
2445pub mod subscriptions_subscribe_response {
2447 #[allow(clippy::all)]
2448 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
2449 pub enum Item {
2450 #[prost(message, tag = "1")]
2451 Row(super::SubscriptionRow),
2452 #[prost(uint64, tag = "2")]
2453 Missed(u64),
2454 #[prost(bool, tag = "3")]
2456 Opened(bool),
2457 }
2458}
2459#[allow(clippy::all)]
2461#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2462pub struct SubscriptionRow {
2463 #[prost(bytes = "vec", tag = "1")]
2464 pub payload: ::prost::alloc::vec::Vec<u8>,
2465 #[prost(message, optional, tag = "2")]
2466 pub source: ::core::option::Option<::prost_types::Timestamp>,
2467 #[prost(message, optional, tag = "3")]
2468 pub received: ::core::option::Option<::prost_types::Timestamp>,
2469}
2470#[cfg(not(target_arch = "wasm32"))]
2472pub mod subscriptions_client {
2473 #![allow(
2474 unused_variables,
2475 dead_code,
2476 missing_docs,
2477 clippy::wildcard_imports,
2478 clippy::let_unit_value,
2479 )]
2480 use tonic::codegen::*;
2481 use tonic::codegen::http::Uri;
2482 #[derive(Debug, Clone)]
2484 pub struct SubscriptionsClient<T> {
2485 inner: tonic::client::Grpc<T>,
2486 }
2487 impl SubscriptionsClient<tonic::transport::Channel> {
2488 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2490 where
2491 D: TryInto<tonic::transport::Endpoint>,
2492 D::Error: Into<StdError>,
2493 {
2494 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2495 Ok(Self::new(conn))
2496 }
2497 }
2498 impl<T> SubscriptionsClient<T>
2499 where
2500 T: tonic::client::GrpcService<tonic::body::Body>,
2501 T::Error: Into<StdError>,
2502 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2503 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2504 {
2505 pub fn new(inner: T) -> Self {
2506 let inner = tonic::client::Grpc::new(inner);
2507 Self { inner }
2508 }
2509 pub fn with_origin(inner: T, origin: Uri) -> Self {
2510 let inner = tonic::client::Grpc::with_origin(inner, origin);
2511 Self { inner }
2512 }
2513 pub fn with_interceptor<F>(
2514 inner: T,
2515 interceptor: F,
2516 ) -> SubscriptionsClient<InterceptedService<T, F>>
2517 where
2518 F: tonic::service::Interceptor,
2519 T::ResponseBody: Default,
2520 T: tonic::codegen::Service<
2521 http::Request<tonic::body::Body>,
2522 Response = http::Response<
2523 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2524 >,
2525 >,
2526 <T as tonic::codegen::Service<
2527 http::Request<tonic::body::Body>,
2528 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2529 {
2530 SubscriptionsClient::new(InterceptedService::new(inner, interceptor))
2531 }
2532 #[must_use]
2537 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2538 self.inner = self.inner.send_compressed(encoding);
2539 self
2540 }
2541 #[must_use]
2543 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2544 self.inner = self.inner.accept_compressed(encoding);
2545 self
2546 }
2547 #[must_use]
2551 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2552 self.inner = self.inner.max_decoding_message_size(limit);
2553 self
2554 }
2555 #[must_use]
2559 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2560 self.inner = self.inner.max_encoding_message_size(limit);
2561 self
2562 }
2563 pub async fn subscribe(
2565 &mut self,
2566 request: impl tonic::IntoRequest<super::SubscriptionsSubscribeRequest>,
2567 ) -> std::result::Result<
2568 tonic::Response<
2569 tonic::codec::Streaming<super::SubscriptionsSubscribeResponse>,
2570 >,
2571 tonic::Status,
2572 > {
2573 self.inner
2574 .ready()
2575 .await
2576 .map_err(|e| {
2577 tonic::Status::unknown(
2578 format!("Service was not ready: {}", e.into()),
2579 )
2580 })?;
2581 let codec = tonic_prost::ProstCodec::default();
2582 let path = http::uri::PathAndQuery::from_static(
2583 "/harmos.plugin.v1.Subscriptions/Subscribe",
2584 );
2585 let mut req = request.into_request();
2586 req.extensions_mut()
2587 .insert(GrpcMethod::new("harmos.plugin.v1.Subscriptions", "Subscribe"));
2588 self.inner.server_streaming(req, path, codec).await
2589 }
2590 }
2591}
2592#[cfg(not(target_arch = "wasm32"))]
2594pub mod subscriptions_server {
2595 #![allow(
2596 unused_variables,
2597 dead_code,
2598 missing_docs,
2599 clippy::wildcard_imports,
2600 clippy::let_unit_value,
2601 )]
2602 use tonic::codegen::*;
2603 #[async_trait]
2605 pub trait Subscriptions: std::marker::Send + std::marker::Sync + 'static {
2606 type SubscribeStream: tonic::codegen::tokio_stream::Stream<
2608 Item = std::result::Result<
2609 super::SubscriptionsSubscribeResponse,
2610 tonic::Status,
2611 >,
2612 >
2613 + std::marker::Send
2614 + 'static;
2615 async fn subscribe(
2617 &self,
2618 request: tonic::Request<super::SubscriptionsSubscribeRequest>,
2619 ) -> std::result::Result<tonic::Response<Self::SubscribeStream>, tonic::Status>;
2620 }
2621 #[derive(Debug)]
2623 pub struct SubscriptionsServer<T> {
2624 inner: Arc<T>,
2625 accept_compression_encodings: EnabledCompressionEncodings,
2626 send_compression_encodings: EnabledCompressionEncodings,
2627 max_decoding_message_size: Option<usize>,
2628 max_encoding_message_size: Option<usize>,
2629 }
2630 impl<T> SubscriptionsServer<T> {
2631 pub fn new(inner: T) -> Self {
2632 Self::from_arc(Arc::new(inner))
2633 }
2634 pub fn from_arc(inner: Arc<T>) -> Self {
2635 Self {
2636 inner,
2637 accept_compression_encodings: Default::default(),
2638 send_compression_encodings: Default::default(),
2639 max_decoding_message_size: None,
2640 max_encoding_message_size: None,
2641 }
2642 }
2643 pub fn with_interceptor<F>(
2644 inner: T,
2645 interceptor: F,
2646 ) -> InterceptedService<Self, F>
2647 where
2648 F: tonic::service::Interceptor,
2649 {
2650 InterceptedService::new(Self::new(inner), interceptor)
2651 }
2652 #[must_use]
2654 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2655 self.accept_compression_encodings.enable(encoding);
2656 self
2657 }
2658 #[must_use]
2660 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2661 self.send_compression_encodings.enable(encoding);
2662 self
2663 }
2664 #[must_use]
2668 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2669 self.max_decoding_message_size = Some(limit);
2670 self
2671 }
2672 #[must_use]
2676 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2677 self.max_encoding_message_size = Some(limit);
2678 self
2679 }
2680 }
2681 impl<T, B> tonic::codegen::Service<http::Request<B>> for SubscriptionsServer<T>
2682 where
2683 T: Subscriptions,
2684 B: Body + std::marker::Send + 'static,
2685 B::Error: Into<StdError> + std::marker::Send + 'static,
2686 {
2687 type Response = http::Response<tonic::body::Body>;
2688 type Error = std::convert::Infallible;
2689 type Future = BoxFuture<Self::Response, Self::Error>;
2690 fn poll_ready(
2691 &mut self,
2692 _cx: &mut Context<'_>,
2693 ) -> Poll<std::result::Result<(), Self::Error>> {
2694 Poll::Ready(Ok(()))
2695 }
2696 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2697 match req.uri().path() {
2698 "/harmos.plugin.v1.Subscriptions/Subscribe" => {
2699 #[allow(non_camel_case_types)]
2700 struct SubscribeSvc<T: Subscriptions>(pub Arc<T>);
2701 impl<
2702 T: Subscriptions,
2703 > tonic::server::ServerStreamingService<
2704 super::SubscriptionsSubscribeRequest,
2705 > for SubscribeSvc<T> {
2706 type Response = super::SubscriptionsSubscribeResponse;
2707 type ResponseStream = T::SubscribeStream;
2708 type Future = BoxFuture<
2709 tonic::Response<Self::ResponseStream>,
2710 tonic::Status,
2711 >;
2712 fn call(
2713 &mut self,
2714 request: tonic::Request<super::SubscriptionsSubscribeRequest>,
2715 ) -> Self::Future {
2716 let inner = Arc::clone(&self.0);
2717 let fut = async move {
2718 <T as Subscriptions>::subscribe(&inner, request).await
2719 };
2720 Box::pin(fut)
2721 }
2722 }
2723 let accept_compression_encodings = self.accept_compression_encodings;
2724 let send_compression_encodings = self.send_compression_encodings;
2725 let max_decoding_message_size = self.max_decoding_message_size;
2726 let max_encoding_message_size = self.max_encoding_message_size;
2727 let inner = self.inner.clone();
2728 let fut = async move {
2729 let method = SubscribeSvc(inner);
2730 let codec = tonic_prost::ProstCodec::default();
2731 let mut grpc = tonic::server::Grpc::new(codec)
2732 .apply_compression_config(
2733 accept_compression_encodings,
2734 send_compression_encodings,
2735 )
2736 .apply_max_message_size_config(
2737 max_decoding_message_size,
2738 max_encoding_message_size,
2739 );
2740 let res = grpc.server_streaming(method, req).await;
2741 Ok(res)
2742 };
2743 Box::pin(fut)
2744 }
2745 _ => {
2746 Box::pin(async move {
2747 let mut response = http::Response::new(
2748 tonic::body::Body::default(),
2749 );
2750 let headers = response.headers_mut();
2751 headers
2752 .insert(
2753 tonic::Status::GRPC_STATUS,
2754 (tonic::Code::Unimplemented as i32).into(),
2755 );
2756 headers
2757 .insert(
2758 http::header::CONTENT_TYPE,
2759 tonic::metadata::GRPC_CONTENT_TYPE,
2760 );
2761 Ok(response)
2762 })
2763 }
2764 }
2765 }
2766 }
2767 impl<T> Clone for SubscriptionsServer<T> {
2768 fn clone(&self) -> Self {
2769 let inner = self.inner.clone();
2770 Self {
2771 inner,
2772 accept_compression_encodings: self.accept_compression_encodings,
2773 send_compression_encodings: self.send_compression_encodings,
2774 max_decoding_message_size: self.max_decoding_message_size,
2775 max_encoding_message_size: self.max_encoding_message_size,
2776 }
2777 }
2778 }
2779 pub const SERVICE_NAME: &str = "harmos.plugin.v1.Subscriptions";
2781 impl<T> tonic::server::NamedService for SubscriptionsServer<T> {
2782 const NAME: &'static str = SERVICE_NAME;
2783 }
2784}
2785#[cfg(not(target_arch = "wasm32"))]
2787pub mod time_client {
2788 #![allow(
2789 unused_variables,
2790 dead_code,
2791 missing_docs,
2792 clippy::wildcard_imports,
2793 clippy::let_unit_value,
2794 )]
2795 use tonic::codegen::*;
2796 use tonic::codegen::http::Uri;
2797 #[derive(Debug, Clone)]
2799 pub struct TimeClient<T> {
2800 inner: tonic::client::Grpc<T>,
2801 }
2802 impl TimeClient<tonic::transport::Channel> {
2803 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2805 where
2806 D: TryInto<tonic::transport::Endpoint>,
2807 D::Error: Into<StdError>,
2808 {
2809 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2810 Ok(Self::new(conn))
2811 }
2812 }
2813 impl<T> TimeClient<T>
2814 where
2815 T: tonic::client::GrpcService<tonic::body::Body>,
2816 T::Error: Into<StdError>,
2817 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2818 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2819 {
2820 pub fn new(inner: T) -> Self {
2821 let inner = tonic::client::Grpc::new(inner);
2822 Self { inner }
2823 }
2824 pub fn with_origin(inner: T, origin: Uri) -> Self {
2825 let inner = tonic::client::Grpc::with_origin(inner, origin);
2826 Self { inner }
2827 }
2828 pub fn with_interceptor<F>(
2829 inner: T,
2830 interceptor: F,
2831 ) -> TimeClient<InterceptedService<T, F>>
2832 where
2833 F: tonic::service::Interceptor,
2834 T::ResponseBody: Default,
2835 T: tonic::codegen::Service<
2836 http::Request<tonic::body::Body>,
2837 Response = http::Response<
2838 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2839 >,
2840 >,
2841 <T as tonic::codegen::Service<
2842 http::Request<tonic::body::Body>,
2843 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2844 {
2845 TimeClient::new(InterceptedService::new(inner, interceptor))
2846 }
2847 #[must_use]
2852 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2853 self.inner = self.inner.send_compressed(encoding);
2854 self
2855 }
2856 #[must_use]
2858 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2859 self.inner = self.inner.accept_compressed(encoding);
2860 self
2861 }
2862 #[must_use]
2866 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2867 self.inner = self.inner.max_decoding_message_size(limit);
2868 self
2869 }
2870 #[must_use]
2874 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2875 self.inner = self.inner.max_encoding_message_size(limit);
2876 self
2877 }
2878 pub async fn get(
2880 &mut self,
2881 request: impl tonic::IntoRequest<crate::host::TimeGetRequest>,
2882 ) -> std::result::Result<
2883 tonic::Response<crate::host::TimeGetResponse>,
2884 tonic::Status,
2885 > {
2886 self.inner
2887 .ready()
2888 .await
2889 .map_err(|e| {
2890 tonic::Status::unknown(
2891 format!("Service was not ready: {}", e.into()),
2892 )
2893 })?;
2894 let codec = tonic_prost::ProstCodec::default();
2895 let path = http::uri::PathAndQuery::from_static(
2896 "/harmos.plugin.v1.Time/Get",
2897 );
2898 let mut req = request.into_request();
2899 req.extensions_mut().insert(GrpcMethod::new("harmos.plugin.v1.Time", "Get"));
2900 self.inner.unary(req, path, codec).await
2901 }
2902 pub async fn sleep(
2904 &mut self,
2905 request: impl tonic::IntoRequest<crate::host::TimeSleepRequest>,
2906 ) -> std::result::Result<
2907 tonic::Response<crate::host::TimeSleepResponse>,
2908 tonic::Status,
2909 > {
2910 self.inner
2911 .ready()
2912 .await
2913 .map_err(|e| {
2914 tonic::Status::unknown(
2915 format!("Service was not ready: {}", e.into()),
2916 )
2917 })?;
2918 let codec = tonic_prost::ProstCodec::default();
2919 let path = http::uri::PathAndQuery::from_static(
2920 "/harmos.plugin.v1.Time/Sleep",
2921 );
2922 let mut req = request.into_request();
2923 req.extensions_mut()
2924 .insert(GrpcMethod::new("harmos.plugin.v1.Time", "Sleep"));
2925 self.inner.unary(req, path, codec).await
2926 }
2927 }
2928}
2929#[cfg(not(target_arch = "wasm32"))]
2931pub mod time_server {
2932 #![allow(
2933 unused_variables,
2934 dead_code,
2935 missing_docs,
2936 clippy::wildcard_imports,
2937 clippy::let_unit_value,
2938 )]
2939 use tonic::codegen::*;
2940 #[async_trait]
2942 pub trait Time: std::marker::Send + std::marker::Sync + 'static {
2943 async fn get(
2945 &self,
2946 request: tonic::Request<crate::host::TimeGetRequest>,
2947 ) -> std::result::Result<
2948 tonic::Response<crate::host::TimeGetResponse>,
2949 tonic::Status,
2950 >;
2951 async fn sleep(
2953 &self,
2954 request: tonic::Request<crate::host::TimeSleepRequest>,
2955 ) -> std::result::Result<
2956 tonic::Response<crate::host::TimeSleepResponse>,
2957 tonic::Status,
2958 >;
2959 }
2960 #[derive(Debug)]
2962 pub struct TimeServer<T> {
2963 inner: Arc<T>,
2964 accept_compression_encodings: EnabledCompressionEncodings,
2965 send_compression_encodings: EnabledCompressionEncodings,
2966 max_decoding_message_size: Option<usize>,
2967 max_encoding_message_size: Option<usize>,
2968 }
2969 impl<T> TimeServer<T> {
2970 pub fn new(inner: T) -> Self {
2971 Self::from_arc(Arc::new(inner))
2972 }
2973 pub fn from_arc(inner: Arc<T>) -> Self {
2974 Self {
2975 inner,
2976 accept_compression_encodings: Default::default(),
2977 send_compression_encodings: Default::default(),
2978 max_decoding_message_size: None,
2979 max_encoding_message_size: None,
2980 }
2981 }
2982 pub fn with_interceptor<F>(
2983 inner: T,
2984 interceptor: F,
2985 ) -> InterceptedService<Self, F>
2986 where
2987 F: tonic::service::Interceptor,
2988 {
2989 InterceptedService::new(Self::new(inner), interceptor)
2990 }
2991 #[must_use]
2993 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2994 self.accept_compression_encodings.enable(encoding);
2995 self
2996 }
2997 #[must_use]
2999 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3000 self.send_compression_encodings.enable(encoding);
3001 self
3002 }
3003 #[must_use]
3007 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3008 self.max_decoding_message_size = Some(limit);
3009 self
3010 }
3011 #[must_use]
3015 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3016 self.max_encoding_message_size = Some(limit);
3017 self
3018 }
3019 }
3020 impl<T, B> tonic::codegen::Service<http::Request<B>> for TimeServer<T>
3021 where
3022 T: Time,
3023 B: Body + std::marker::Send + 'static,
3024 B::Error: Into<StdError> + std::marker::Send + 'static,
3025 {
3026 type Response = http::Response<tonic::body::Body>;
3027 type Error = std::convert::Infallible;
3028 type Future = BoxFuture<Self::Response, Self::Error>;
3029 fn poll_ready(
3030 &mut self,
3031 _cx: &mut Context<'_>,
3032 ) -> Poll<std::result::Result<(), Self::Error>> {
3033 Poll::Ready(Ok(()))
3034 }
3035 fn call(&mut self, req: http::Request<B>) -> Self::Future {
3036 match req.uri().path() {
3037 "/harmos.plugin.v1.Time/Get" => {
3038 #[allow(non_camel_case_types)]
3039 struct GetSvc<T: Time>(pub Arc<T>);
3040 impl<
3041 T: Time,
3042 > tonic::server::UnaryService<crate::host::TimeGetRequest>
3043 for GetSvc<T> {
3044 type Response = crate::host::TimeGetResponse;
3045 type Future = BoxFuture<
3046 tonic::Response<Self::Response>,
3047 tonic::Status,
3048 >;
3049 fn call(
3050 &mut self,
3051 request: tonic::Request<crate::host::TimeGetRequest>,
3052 ) -> Self::Future {
3053 let inner = Arc::clone(&self.0);
3054 let fut = async move {
3055 <T as Time>::get(&inner, request).await
3056 };
3057 Box::pin(fut)
3058 }
3059 }
3060 let accept_compression_encodings = self.accept_compression_encodings;
3061 let send_compression_encodings = self.send_compression_encodings;
3062 let max_decoding_message_size = self.max_decoding_message_size;
3063 let max_encoding_message_size = self.max_encoding_message_size;
3064 let inner = self.inner.clone();
3065 let fut = async move {
3066 let method = GetSvc(inner);
3067 let codec = tonic_prost::ProstCodec::default();
3068 let mut grpc = tonic::server::Grpc::new(codec)
3069 .apply_compression_config(
3070 accept_compression_encodings,
3071 send_compression_encodings,
3072 )
3073 .apply_max_message_size_config(
3074 max_decoding_message_size,
3075 max_encoding_message_size,
3076 );
3077 let res = grpc.unary(method, req).await;
3078 Ok(res)
3079 };
3080 Box::pin(fut)
3081 }
3082 "/harmos.plugin.v1.Time/Sleep" => {
3083 #[allow(non_camel_case_types)]
3084 struct SleepSvc<T: Time>(pub Arc<T>);
3085 impl<
3086 T: Time,
3087 > tonic::server::UnaryService<crate::host::TimeSleepRequest>
3088 for SleepSvc<T> {
3089 type Response = crate::host::TimeSleepResponse;
3090 type Future = BoxFuture<
3091 tonic::Response<Self::Response>,
3092 tonic::Status,
3093 >;
3094 fn call(
3095 &mut self,
3096 request: tonic::Request<crate::host::TimeSleepRequest>,
3097 ) -> Self::Future {
3098 let inner = Arc::clone(&self.0);
3099 let fut = async move {
3100 <T as Time>::sleep(&inner, request).await
3101 };
3102 Box::pin(fut)
3103 }
3104 }
3105 let accept_compression_encodings = self.accept_compression_encodings;
3106 let send_compression_encodings = self.send_compression_encodings;
3107 let max_decoding_message_size = self.max_decoding_message_size;
3108 let max_encoding_message_size = self.max_encoding_message_size;
3109 let inner = self.inner.clone();
3110 let fut = async move {
3111 let method = SleepSvc(inner);
3112 let codec = tonic_prost::ProstCodec::default();
3113 let mut grpc = tonic::server::Grpc::new(codec)
3114 .apply_compression_config(
3115 accept_compression_encodings,
3116 send_compression_encodings,
3117 )
3118 .apply_max_message_size_config(
3119 max_decoding_message_size,
3120 max_encoding_message_size,
3121 );
3122 let res = grpc.unary(method, req).await;
3123 Ok(res)
3124 };
3125 Box::pin(fut)
3126 }
3127 _ => {
3128 Box::pin(async move {
3129 let mut response = http::Response::new(
3130 tonic::body::Body::default(),
3131 );
3132 let headers = response.headers_mut();
3133 headers
3134 .insert(
3135 tonic::Status::GRPC_STATUS,
3136 (tonic::Code::Unimplemented as i32).into(),
3137 );
3138 headers
3139 .insert(
3140 http::header::CONTENT_TYPE,
3141 tonic::metadata::GRPC_CONTENT_TYPE,
3142 );
3143 Ok(response)
3144 })
3145 }
3146 }
3147 }
3148 }
3149 impl<T> Clone for TimeServer<T> {
3150 fn clone(&self) -> Self {
3151 let inner = self.inner.clone();
3152 Self {
3153 inner,
3154 accept_compression_encodings: self.accept_compression_encodings,
3155 send_compression_encodings: self.send_compression_encodings,
3156 max_decoding_message_size: self.max_decoding_message_size,
3157 max_encoding_message_size: self.max_encoding_message_size,
3158 }
3159 }
3160 }
3161 pub const SERVICE_NAME: &str = "harmos.plugin.v1.Time";
3163 impl<T> tonic::server::NamedService for TimeServer<T> {
3164 const NAME: &'static str = SERVICE_NAME;
3165 }
3166}
3167
3168pub mod plugins;