apache_dubbo/protocol/
mod.rs1pub mod grpc;
19pub mod server_desc;
20pub mod triple;
21
22use async_trait::async_trait;
23
24use crate::common::url::Url;
25use crate::invocation::{Request, Response};
26use crate::utils::boxed_clone::BoxCloneService;
27
28#[async_trait]
29pub trait Protocol {
30 type Invoker;
31 type Exporter;
32
33 fn destroy(&self);
34 async fn export(self, url: Url) -> Self::Exporter;
35 async fn refer(self, url: Url) -> Self::Invoker;
36}
37
38pub trait Exporter {
39 type InvokerType: Invoker;
40
41 fn unexport(&self);
42 fn get_invoker(&self) -> Self::InvokerType;
43}
44
45pub trait Invoker {
46 fn invoke<M1>(&self, req: Request<M1>) -> Response<String>
47 where
48 M1: Send + 'static;
49 fn is_available(&self) -> bool;
50 fn destroy(&self);
51 fn get_url(&self) -> Url;
52}
53
54pub trait DubboGrpcService<T> {
55 fn set_proxy_impl(&mut self, invoker: T);
56 fn service_desc(&self) -> server_desc::ServiceDesc;
57}
58
59pub type GrpcBoxCloneService = BoxCloneService<
60 http::Request<hyper::Body>,
61 http::Response<hyper::Body>,
62 std::convert::Infallible,
63>;