dgraph_rs/protos/
api_grpc.rs

1// This file is generated. Do not edit
2// @generated
3
4// https://github.com/Manishearth/rust-clippy/issues/702
5#![allow(unknown_lints)]
6#![allow(clippy::all)]
7
8#![cfg_attr(rustfmt, rustfmt_skip)]
9
10#![allow(box_pointers)]
11#![allow(dead_code)]
12#![allow(missing_docs)]
13#![allow(non_camel_case_types)]
14#![allow(non_snake_case)]
15#![allow(non_upper_case_globals)]
16#![allow(trivial_casts)]
17#![allow(unsafe_code)]
18#![allow(unused_imports)]
19#![allow(unused_results)]
20
21
22// interface
23
24pub trait Dgraph {
25    fn login(&self, o: ::grpc::RequestOptions, p: super::api::LoginRequest) -> ::grpc::SingleResponse<super::api::Response>;
26
27    fn query(&self, o: ::grpc::RequestOptions, p: super::api::Request) -> ::grpc::SingleResponse<super::api::Response>;
28
29    fn alter(&self, o: ::grpc::RequestOptions, p: super::api::Operation) -> ::grpc::SingleResponse<super::api::Payload>;
30
31    fn commit_or_abort(&self, o: ::grpc::RequestOptions, p: super::api::TxnContext) -> ::grpc::SingleResponse<super::api::TxnContext>;
32
33    fn check_version(&self, o: ::grpc::RequestOptions, p: super::api::Check) -> ::grpc::SingleResponse<super::api::Version>;
34}
35
36// client
37
38pub struct DgraphClient {
39    grpc_client: ::std::sync::Arc<::grpc::Client>,
40    method_Login: ::std::sync::Arc<::grpc::rt::MethodDescriptor<super::api::LoginRequest, super::api::Response>>,
41    method_Query: ::std::sync::Arc<::grpc::rt::MethodDescriptor<super::api::Request, super::api::Response>>,
42    method_Alter: ::std::sync::Arc<::grpc::rt::MethodDescriptor<super::api::Operation, super::api::Payload>>,
43    method_CommitOrAbort: ::std::sync::Arc<::grpc::rt::MethodDescriptor<super::api::TxnContext, super::api::TxnContext>>,
44    method_CheckVersion: ::std::sync::Arc<::grpc::rt::MethodDescriptor<super::api::Check, super::api::Version>>,
45}
46
47impl ::grpc::ClientStub for DgraphClient {
48    fn with_client(grpc_client: ::std::sync::Arc<::grpc::Client>) -> Self {
49        DgraphClient {
50            grpc_client: grpc_client,
51            method_Login: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
52                name: "/api.Dgraph/Login".to_string(),
53                streaming: ::grpc::rt::GrpcStreaming::Unary,
54                req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
55                resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
56            }),
57            method_Query: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
58                name: "/api.Dgraph/Query".to_string(),
59                streaming: ::grpc::rt::GrpcStreaming::Unary,
60                req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
61                resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
62            }),
63            method_Alter: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
64                name: "/api.Dgraph/Alter".to_string(),
65                streaming: ::grpc::rt::GrpcStreaming::Unary,
66                req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
67                resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
68            }),
69            method_CommitOrAbort: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
70                name: "/api.Dgraph/CommitOrAbort".to_string(),
71                streaming: ::grpc::rt::GrpcStreaming::Unary,
72                req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
73                resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
74            }),
75            method_CheckVersion: ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
76                name: "/api.Dgraph/CheckVersion".to_string(),
77                streaming: ::grpc::rt::GrpcStreaming::Unary,
78                req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
79                resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
80            }),
81        }
82    }
83}
84
85impl Dgraph for DgraphClient {
86    fn login(&self, o: ::grpc::RequestOptions, p: super::api::LoginRequest) -> ::grpc::SingleResponse<super::api::Response> {
87        self.grpc_client.call_unary(o, p, self.method_Login.clone())
88    }
89
90    fn query(&self, o: ::grpc::RequestOptions, p: super::api::Request) -> ::grpc::SingleResponse<super::api::Response> {
91        self.grpc_client.call_unary(o, p, self.method_Query.clone())
92    }
93
94    fn alter(&self, o: ::grpc::RequestOptions, p: super::api::Operation) -> ::grpc::SingleResponse<super::api::Payload> {
95        self.grpc_client.call_unary(o, p, self.method_Alter.clone())
96    }
97
98    fn commit_or_abort(&self, o: ::grpc::RequestOptions, p: super::api::TxnContext) -> ::grpc::SingleResponse<super::api::TxnContext> {
99        self.grpc_client.call_unary(o, p, self.method_CommitOrAbort.clone())
100    }
101
102    fn check_version(&self, o: ::grpc::RequestOptions, p: super::api::Check) -> ::grpc::SingleResponse<super::api::Version> {
103        self.grpc_client.call_unary(o, p, self.method_CheckVersion.clone())
104    }
105}
106
107// server
108
109pub struct DgraphServer;
110
111
112impl DgraphServer {
113    pub fn new_service_def<H : Dgraph + 'static + Sync + Send + 'static>(handler: H) -> ::grpc::rt::ServerServiceDefinition {
114        let handler_arc = ::std::sync::Arc::new(handler);
115        ::grpc::rt::ServerServiceDefinition::new("/api.Dgraph",
116            vec![
117                ::grpc::rt::ServerMethod::new(
118                    ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
119                        name: "/api.Dgraph/Login".to_string(),
120                        streaming: ::grpc::rt::GrpcStreaming::Unary,
121                        req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
122                        resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
123                    }),
124                    {
125                        let handler_copy = handler_arc.clone();
126                        ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.login(o, p))
127                    },
128                ),
129                ::grpc::rt::ServerMethod::new(
130                    ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
131                        name: "/api.Dgraph/Query".to_string(),
132                        streaming: ::grpc::rt::GrpcStreaming::Unary,
133                        req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
134                        resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
135                    }),
136                    {
137                        let handler_copy = handler_arc.clone();
138                        ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.query(o, p))
139                    },
140                ),
141                ::grpc::rt::ServerMethod::new(
142                    ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
143                        name: "/api.Dgraph/Alter".to_string(),
144                        streaming: ::grpc::rt::GrpcStreaming::Unary,
145                        req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
146                        resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
147                    }),
148                    {
149                        let handler_copy = handler_arc.clone();
150                        ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.alter(o, p))
151                    },
152                ),
153                ::grpc::rt::ServerMethod::new(
154                    ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
155                        name: "/api.Dgraph/CommitOrAbort".to_string(),
156                        streaming: ::grpc::rt::GrpcStreaming::Unary,
157                        req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
158                        resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
159                    }),
160                    {
161                        let handler_copy = handler_arc.clone();
162                        ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.commit_or_abort(o, p))
163                    },
164                ),
165                ::grpc::rt::ServerMethod::new(
166                    ::std::sync::Arc::new(::grpc::rt::MethodDescriptor {
167                        name: "/api.Dgraph/CheckVersion".to_string(),
168                        streaming: ::grpc::rt::GrpcStreaming::Unary,
169                        req_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
170                        resp_marshaller: Box::new(::grpc::protobuf::MarshallerProtobuf),
171                    }),
172                    {
173                        let handler_copy = handler_arc.clone();
174                        ::grpc::rt::MethodHandlerUnary::new(move |o, p| handler_copy.check_version(o, p))
175                    },
176                ),
177            ],
178        )
179    }
180}