1#[allow(clippy::derive_partial_eq_without_eq)]
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Request {
4 #[prost(uint64, tag = "1")]
5 pub start_ts: u64,
6 #[prost(string, tag = "4")]
7 pub query: ::prost::alloc::string::String,
8 #[prost(map = "string, string", tag = "5")]
10 pub vars: ::std::collections::HashMap<
11 ::prost::alloc::string::String,
12 ::prost::alloc::string::String,
13 >,
14 #[prost(bool, tag = "6")]
15 pub read_only: bool,
16 #[prost(bool, tag = "7")]
17 pub best_effort: bool,
18 #[prost(message, repeated, tag = "12")]
19 pub mutations: ::prost::alloc::vec::Vec<Mutation>,
20 #[prost(bool, tag = "13")]
21 pub commit_now: bool,
22 #[prost(enumeration = "request::RespFormat", tag = "14")]
23 pub resp_format: i32,
24}
25pub mod request {
27 #[derive(
28 Clone,
29 Copy,
30 Debug,
31 PartialEq,
32 Eq,
33 Hash,
34 PartialOrd,
35 Ord,
36 ::prost::Enumeration
37 )]
38 #[repr(i32)]
39 pub enum RespFormat {
40 Json = 0,
41 Rdf = 1,
42 }
43 impl RespFormat {
44 pub fn as_str_name(&self) -> &'static str {
49 match self {
50 RespFormat::Json => "JSON",
51 RespFormat::Rdf => "RDF",
52 }
53 }
54 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
56 match value {
57 "JSON" => Some(Self::Json),
58 "RDF" => Some(Self::Rdf),
59 _ => None,
60 }
61 }
62 }
63}
64#[allow(clippy::derive_partial_eq_without_eq)]
65#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct Uids {
67 #[prost(string, repeated, tag = "1")]
68 pub uids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
69}
70#[allow(clippy::derive_partial_eq_without_eq)]
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct ListOfString {
73 #[prost(string, repeated, tag = "1")]
74 pub value: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
75}
76#[allow(clippy::derive_partial_eq_without_eq)]
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct Response {
79 #[prost(bytes = "vec", tag = "1")]
80 pub json: ::prost::alloc::vec::Vec<u8>,
81 #[prost(message, optional, tag = "2")]
82 pub txn: ::core::option::Option<TxnContext>,
83 #[prost(message, optional, tag = "3")]
84 pub latency: ::core::option::Option<Latency>,
85 #[prost(message, optional, tag = "4")]
87 pub metrics: ::core::option::Option<Metrics>,
88 #[prost(map = "string, string", tag = "12")]
91 pub uids: ::std::collections::HashMap<
92 ::prost::alloc::string::String,
93 ::prost::alloc::string::String,
94 >,
95 #[prost(bytes = "vec", tag = "13")]
96 pub rdf: ::prost::alloc::vec::Vec<u8>,
97 #[prost(map = "string, message", tag = "14")]
98 pub hdrs: ::std::collections::HashMap<::prost::alloc::string::String, ListOfString>,
99}
100#[allow(clippy::derive_partial_eq_without_eq)]
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct Mutation {
103 #[prost(bytes = "vec", tag = "1")]
104 pub set_json: ::prost::alloc::vec::Vec<u8>,
105 #[prost(bytes = "vec", tag = "2")]
106 pub delete_json: ::prost::alloc::vec::Vec<u8>,
107 #[prost(bytes = "vec", tag = "3")]
108 pub set_nquads: ::prost::alloc::vec::Vec<u8>,
109 #[prost(bytes = "vec", tag = "4")]
110 pub del_nquads: ::prost::alloc::vec::Vec<u8>,
111 #[prost(message, repeated, tag = "5")]
112 pub set: ::prost::alloc::vec::Vec<NQuad>,
113 #[prost(message, repeated, tag = "6")]
114 pub del: ::prost::alloc::vec::Vec<NQuad>,
115 #[prost(string, tag = "9")]
117 pub cond: ::prost::alloc::string::String,
118 #[prost(bool, tag = "14")]
120 pub commit_now: bool,
121}
122#[allow(clippy::derive_partial_eq_without_eq)]
123#[derive(Clone, PartialEq, ::prost::Message)]
124pub struct Operation {
125 #[prost(string, tag = "1")]
126 pub schema: ::prost::alloc::string::String,
127 #[prost(string, tag = "2")]
128 pub drop_attr: ::prost::alloc::string::String,
129 #[prost(bool, tag = "3")]
130 pub drop_all: bool,
131 #[prost(enumeration = "operation::DropOp", tag = "4")]
132 pub drop_op: i32,
133 #[prost(string, tag = "5")]
136 pub drop_value: ::prost::alloc::string::String,
137 #[prost(bool, tag = "6")]
139 pub run_in_background: bool,
140}
141pub mod operation {
143 #[derive(
144 Clone,
145 Copy,
146 Debug,
147 PartialEq,
148 Eq,
149 Hash,
150 PartialOrd,
151 Ord,
152 ::prost::Enumeration
153 )]
154 #[repr(i32)]
155 pub enum DropOp {
156 None = 0,
157 All = 1,
158 Data = 2,
159 Attr = 3,
160 Type = 4,
161 }
162 impl DropOp {
163 pub fn as_str_name(&self) -> &'static str {
168 match self {
169 DropOp::None => "NONE",
170 DropOp::All => "ALL",
171 DropOp::Data => "DATA",
172 DropOp::Attr => "ATTR",
173 DropOp::Type => "TYPE",
174 }
175 }
176 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
178 match value {
179 "NONE" => Some(Self::None),
180 "ALL" => Some(Self::All),
181 "DATA" => Some(Self::Data),
182 "ATTR" => Some(Self::Attr),
183 "TYPE" => Some(Self::Type),
184 _ => None,
185 }
186 }
187 }
188}
189#[allow(clippy::derive_partial_eq_without_eq)]
191#[derive(Clone, PartialEq, ::prost::Message)]
192pub struct Payload {
193 #[prost(bytes = "vec", tag = "1")]
194 pub data: ::prost::alloc::vec::Vec<u8>,
195}
196#[allow(clippy::derive_partial_eq_without_eq)]
197#[derive(Clone, PartialEq, ::prost::Message)]
198pub struct TxnContext {
199 #[prost(uint64, tag = "1")]
200 pub start_ts: u64,
201 #[prost(uint64, tag = "2")]
202 pub commit_ts: u64,
203 #[prost(bool, tag = "3")]
204 pub aborted: bool,
205 #[prost(string, repeated, tag = "4")]
207 pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
208 #[prost(string, repeated, tag = "5")]
210 pub preds: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
211}
212#[allow(clippy::derive_partial_eq_without_eq)]
213#[derive(Clone, PartialEq, ::prost::Message)]
214pub struct Check {}
215#[allow(clippy::derive_partial_eq_without_eq)]
216#[derive(Clone, PartialEq, ::prost::Message)]
217pub struct Version {
218 #[prost(string, tag = "1")]
219 pub tag: ::prost::alloc::string::String,
220}
221#[allow(clippy::derive_partial_eq_without_eq)]
222#[derive(Clone, PartialEq, ::prost::Message)]
223pub struct Latency {
224 #[prost(uint64, tag = "1")]
225 pub parsing_ns: u64,
226 #[prost(uint64, tag = "2")]
227 pub processing_ns: u64,
228 #[prost(uint64, tag = "3")]
229 pub encoding_ns: u64,
230 #[prost(uint64, tag = "4")]
231 pub assign_timestamp_ns: u64,
232 #[prost(uint64, tag = "5")]
233 pub total_ns: u64,
234}
235#[allow(clippy::derive_partial_eq_without_eq)]
236#[derive(Clone, PartialEq, ::prost::Message)]
237pub struct Metrics {
238 #[prost(map = "string, uint64", tag = "1")]
240 pub num_uids: ::std::collections::HashMap<::prost::alloc::string::String, u64>,
241}
242#[allow(clippy::derive_partial_eq_without_eq)]
243#[derive(Clone, PartialEq, ::prost::Message)]
244pub struct NQuad {
245 #[prost(string, tag = "1")]
246 pub subject: ::prost::alloc::string::String,
247 #[prost(string, tag = "2")]
248 pub predicate: ::prost::alloc::string::String,
249 #[prost(string, tag = "3")]
250 pub object_id: ::prost::alloc::string::String,
251 #[prost(message, optional, tag = "4")]
252 pub object_value: ::core::option::Option<Value>,
253 #[prost(string, tag = "5")]
254 pub label: ::prost::alloc::string::String,
255 #[prost(string, tag = "6")]
256 pub lang: ::prost::alloc::string::String,
257 #[prost(message, repeated, tag = "7")]
258 pub facets: ::prost::alloc::vec::Vec<Facet>,
259}
260#[allow(clippy::derive_partial_eq_without_eq)]
261#[derive(Clone, PartialEq, ::prost::Message)]
262pub struct Value {
263 #[prost(oneof = "value::Val", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11")]
264 pub val: ::core::option::Option<value::Val>,
265}
266pub mod value {
268 #[allow(clippy::derive_partial_eq_without_eq)]
269 #[derive(Clone, PartialEq, ::prost::Oneof)]
270 pub enum Val {
271 #[prost(string, tag = "1")]
272 DefaultVal(::prost::alloc::string::String),
273 #[prost(bytes, tag = "2")]
274 BytesVal(::prost::alloc::vec::Vec<u8>),
275 #[prost(int64, tag = "3")]
276 IntVal(i64),
277 #[prost(bool, tag = "4")]
278 BoolVal(bool),
279 #[prost(string, tag = "5")]
280 StrVal(::prost::alloc::string::String),
281 #[prost(double, tag = "6")]
282 DoubleVal(f64),
283 #[prost(bytes, tag = "7")]
285 GeoVal(::prost::alloc::vec::Vec<u8>),
286 #[prost(bytes, tag = "8")]
287 DateVal(::prost::alloc::vec::Vec<u8>),
288 #[prost(bytes, tag = "9")]
289 DatetimeVal(::prost::alloc::vec::Vec<u8>),
290 #[prost(string, tag = "10")]
291 PasswordVal(::prost::alloc::string::String),
292 #[prost(uint64, tag = "11")]
293 UidVal(u64),
294 }
295}
296#[allow(clippy::derive_partial_eq_without_eq)]
297#[derive(Clone, PartialEq, ::prost::Message)]
298pub struct Facet {
299 #[prost(string, tag = "1")]
300 pub key: ::prost::alloc::string::String,
301 #[prost(bytes = "vec", tag = "2")]
302 pub value: ::prost::alloc::vec::Vec<u8>,
303 #[prost(enumeration = "facet::ValType", tag = "3")]
304 pub val_type: i32,
305 #[prost(string, repeated, tag = "4")]
307 pub tokens: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
308 #[prost(string, tag = "5")]
310 pub alias: ::prost::alloc::string::String,
311}
312pub mod facet {
314 #[derive(
315 Clone,
316 Copy,
317 Debug,
318 PartialEq,
319 Eq,
320 Hash,
321 PartialOrd,
322 Ord,
323 ::prost::Enumeration
324 )]
325 #[repr(i32)]
326 pub enum ValType {
327 String = 0,
328 Int = 1,
329 Float = 2,
330 Bool = 3,
331 Datetime = 4,
332 }
333 impl ValType {
334 pub fn as_str_name(&self) -> &'static str {
339 match self {
340 ValType::String => "STRING",
341 ValType::Int => "INT",
342 ValType::Float => "FLOAT",
343 ValType::Bool => "BOOL",
344 ValType::Datetime => "DATETIME",
345 }
346 }
347 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
349 match value {
350 "STRING" => Some(Self::String),
351 "INT" => Some(Self::Int),
352 "FLOAT" => Some(Self::Float),
353 "BOOL" => Some(Self::Bool),
354 "DATETIME" => Some(Self::Datetime),
355 _ => None,
356 }
357 }
358 }
359}
360#[allow(clippy::derive_partial_eq_without_eq)]
361#[derive(Clone, PartialEq, ::prost::Message)]
362pub struct LoginRequest {
363 #[prost(string, tag = "1")]
364 pub userid: ::prost::alloc::string::String,
365 #[prost(string, tag = "2")]
366 pub password: ::prost::alloc::string::String,
367 #[prost(string, tag = "3")]
368 pub refresh_token: ::prost::alloc::string::String,
369}
370#[allow(clippy::derive_partial_eq_without_eq)]
371#[derive(Clone, PartialEq, ::prost::Message)]
372pub struct Jwt {
373 #[prost(string, tag = "1")]
374 pub access_jwt: ::prost::alloc::string::String,
375 #[prost(string, tag = "2")]
376 pub refresh_jwt: ::prost::alloc::string::String,
377}
378pub mod dgraph_client {
380 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
381 use tonic::codegen::*;
382 use tonic::codegen::http::Uri;
383 #[derive(Debug, Clone)]
385 pub struct DgraphClient<T> {
386 inner: tonic::client::Grpc<T>,
387 }
388 impl DgraphClient<tonic::transport::Channel> {
389 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
391 where
392 D: std::convert::TryInto<tonic::transport::Endpoint>,
393 D::Error: Into<StdError>,
394 {
395 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
396 Ok(Self::new(conn))
397 }
398 }
399 impl<T> DgraphClient<T>
400 where
401 T: tonic::client::GrpcService<tonic::body::BoxBody>,
402 T::Error: Into<StdError>,
403 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
404 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
405 {
406 pub fn new(inner: T) -> Self {
407 let inner = tonic::client::Grpc::new(inner);
408 Self { inner }
409 }
410 pub fn with_origin(inner: T, origin: Uri) -> Self {
411 let inner = tonic::client::Grpc::with_origin(inner, origin);
412 Self { inner }
413 }
414 pub fn with_interceptor<F>(
415 inner: T,
416 interceptor: F,
417 ) -> DgraphClient<InterceptedService<T, F>>
418 where
419 F: tonic::service::Interceptor,
420 T::ResponseBody: Default,
421 T: tonic::codegen::Service<
422 http::Request<tonic::body::BoxBody>,
423 Response = http::Response<
424 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
425 >,
426 >,
427 <T as tonic::codegen::Service<
428 http::Request<tonic::body::BoxBody>,
429 >>::Error: Into<StdError> + Send + Sync,
430 {
431 DgraphClient::new(InterceptedService::new(inner, interceptor))
432 }
433 #[must_use]
438 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
439 self.inner = self.inner.send_compressed(encoding);
440 self
441 }
442 #[must_use]
444 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
445 self.inner = self.inner.accept_compressed(encoding);
446 self
447 }
448 pub async fn login(
449 &mut self,
450 request: impl tonic::IntoRequest<super::LoginRequest>,
451 ) -> Result<tonic::Response<super::Response>, tonic::Status> {
452 self.inner
453 .ready()
454 .await
455 .map_err(|e| {
456 tonic::Status::new(
457 tonic::Code::Unknown,
458 format!("Service was not ready: {}", e.into()),
459 )
460 })?;
461 let codec = tonic::codec::ProstCodec::default();
462 let path = http::uri::PathAndQuery::from_static("/api.Dgraph/Login");
463 self.inner.unary(request.into_request(), path, codec).await
464 }
465 pub async fn query(
466 &mut self,
467 request: impl tonic::IntoRequest<super::Request>,
468 ) -> Result<tonic::Response<super::Response>, tonic::Status> {
469 self.inner
470 .ready()
471 .await
472 .map_err(|e| {
473 tonic::Status::new(
474 tonic::Code::Unknown,
475 format!("Service was not ready: {}", e.into()),
476 )
477 })?;
478 let codec = tonic::codec::ProstCodec::default();
479 let path = http::uri::PathAndQuery::from_static("/api.Dgraph/Query");
480 self.inner.unary(request.into_request(), path, codec).await
481 }
482 pub async fn alter(
483 &mut self,
484 request: impl tonic::IntoRequest<super::Operation>,
485 ) -> Result<tonic::Response<super::Payload>, tonic::Status> {
486 self.inner
487 .ready()
488 .await
489 .map_err(|e| {
490 tonic::Status::new(
491 tonic::Code::Unknown,
492 format!("Service was not ready: {}", e.into()),
493 )
494 })?;
495 let codec = tonic::codec::ProstCodec::default();
496 let path = http::uri::PathAndQuery::from_static("/api.Dgraph/Alter");
497 self.inner.unary(request.into_request(), path, codec).await
498 }
499 pub async fn commit_or_abort(
500 &mut self,
501 request: impl tonic::IntoRequest<super::TxnContext>,
502 ) -> Result<tonic::Response<super::TxnContext>, tonic::Status> {
503 self.inner
504 .ready()
505 .await
506 .map_err(|e| {
507 tonic::Status::new(
508 tonic::Code::Unknown,
509 format!("Service was not ready: {}", e.into()),
510 )
511 })?;
512 let codec = tonic::codec::ProstCodec::default();
513 let path = http::uri::PathAndQuery::from_static("/api.Dgraph/CommitOrAbort");
514 self.inner.unary(request.into_request(), path, codec).await
515 }
516 pub async fn check_version(
517 &mut self,
518 request: impl tonic::IntoRequest<super::Check>,
519 ) -> Result<tonic::Response<super::Version>, tonic::Status> {
520 self.inner
521 .ready()
522 .await
523 .map_err(|e| {
524 tonic::Status::new(
525 tonic::Code::Unknown,
526 format!("Service was not ready: {}", e.into()),
527 )
528 })?;
529 let codec = tonic::codec::ProstCodec::default();
530 let path = http::uri::PathAndQuery::from_static("/api.Dgraph/CheckVersion");
531 self.inner.unary(request.into_request(), path, codec).await
532 }
533 }
534}