1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Request {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(string, tag = "4")]
    pub query: std::string::String,
    /// Support for GraphQL like variables.
    #[prost(map = "string, string", tag = "5")]
    pub vars: ::std::collections::HashMap<std::string::String, std::string::String>,
    #[prost(bool, tag = "6")]
    pub read_only: bool,
    #[prost(bool, tag = "7")]
    pub best_effort: bool,
    #[prost(message, repeated, tag = "12")]
    pub mutations: ::std::vec::Vec<Mutation>,
    #[prost(bool, tag = "13")]
    pub commit_now: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Response {
    #[prost(bytes, tag = "1")]
    pub json: std::vec::Vec<u8>,
    #[prost(message, optional, tag = "2")]
    pub txn: ::std::option::Option<TxnContext>,
    #[prost(message, optional, tag = "3")]
    pub latency: ::std::option::Option<Latency>,
    #[prost(map = "string, string", tag = "12")]
    pub uids: ::std::collections::HashMap<std::string::String, std::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Mutation {
    #[prost(bytes, tag = "1")]
    pub set_json: std::vec::Vec<u8>,
    #[prost(bytes, tag = "2")]
    pub delete_json: std::vec::Vec<u8>,
    #[prost(bytes, tag = "3")]
    pub set_nquads: std::vec::Vec<u8>,
    #[prost(bytes, tag = "4")]
    pub del_nquads: std::vec::Vec<u8>,
    #[prost(message, repeated, tag = "5")]
    pub set: ::std::vec::Vec<NQuad>,
    #[prost(message, repeated, tag = "6")]
    pub del: ::std::vec::Vec<NQuad>,
    /// This is being used for upserts.
    #[prost(string, tag = "9")]
    pub cond: std::string::String,
    /// This field is a duplicate of the one in Request and placed here for convenience.
    #[prost(bool, tag = "14")]
    pub commit_now: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Operation {
    #[prost(string, tag = "1")]
    pub schema: std::string::String,
    #[prost(string, tag = "2")]
    pub drop_attr: std::string::String,
    #[prost(bool, tag = "3")]
    pub drop_all: bool,
    #[prost(enumeration = "operation::DropOp", tag = "4")]
    pub drop_op: i32,
    /// If drop_op is ATTR or TYPE, drop_value holds the name of the predicate or
    /// type to delete.
    #[prost(string, tag = "5")]
    pub drop_value: std::string::String,
}
pub mod operation {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum DropOp {
        None = 0,
        All = 1,
        Data = 2,
        Attr = 3,
        Type = 4,
    }
}
/// Worker services.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Payload {
    #[prost(bytes, tag = "1")]
    pub data: std::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnContext {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(uint64, tag = "2")]
    pub commit_ts: u64,
    #[prost(bool, tag = "3")]
    pub aborted: bool,
    /// List of keys to be used for conflict detection.
    #[prost(string, repeated, tag = "4")]
    pub keys: ::std::vec::Vec<std::string::String>,
    /// List of predicates involved in this transaction.
    #[prost(string, repeated, tag = "5")]
    pub preds: ::std::vec::Vec<std::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Check {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Version {
    #[prost(string, tag = "1")]
    pub tag: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Latency {
    #[prost(uint64, tag = "1")]
    pub parsing_ns: u64,
    #[prost(uint64, tag = "2")]
    pub processing_ns: u64,
    #[prost(uint64, tag = "3")]
    pub encoding_ns: u64,
    #[prost(uint64, tag = "4")]
    pub assign_timestamp_ns: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NQuad {
    #[prost(string, tag = "1")]
    pub subject: std::string::String,
    #[prost(string, tag = "2")]
    pub predicate: std::string::String,
    #[prost(string, tag = "3")]
    pub object_id: std::string::String,
    #[prost(message, optional, tag = "4")]
    pub object_value: ::std::option::Option<Value>,
    #[prost(string, tag = "5")]
    pub label: std::string::String,
    #[prost(string, tag = "6")]
    pub lang: std::string::String,
    #[prost(message, repeated, tag = "7")]
    pub facets: ::std::vec::Vec<Facet>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Value {
    #[prost(oneof = "value::Val", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11")]
    pub val: ::std::option::Option<value::Val>,
}
pub mod value {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Val {
        #[prost(string, tag = "1")]
        DefaultVal(std::string::String),
        #[prost(bytes, tag = "2")]
        BytesVal(std::vec::Vec<u8>),
        #[prost(int64, tag = "3")]
        IntVal(i64),
        #[prost(bool, tag = "4")]
        BoolVal(bool),
        #[prost(string, tag = "5")]
        StrVal(std::string::String),
        #[prost(double, tag = "6")]
        DoubleVal(f64),
        /// Geo data in WKB format
        #[prost(bytes, tag = "7")]
        GeoVal(std::vec::Vec<u8>),
        #[prost(bytes, tag = "8")]
        DateVal(std::vec::Vec<u8>),
        #[prost(bytes, tag = "9")]
        DatetimeVal(std::vec::Vec<u8>),
        #[prost(string, tag = "10")]
        PasswordVal(std::string::String),
        #[prost(uint64, tag = "11")]
        UidVal(u64),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Facet {
    #[prost(string, tag = "1")]
    pub key: std::string::String,
    #[prost(bytes, tag = "2")]
    pub value: std::vec::Vec<u8>,
    #[prost(enumeration = "facet::ValType", tag = "3")]
    pub val_type: i32,
    /// tokens of value.
    #[prost(string, repeated, tag = "4")]
    pub tokens: ::std::vec::Vec<std::string::String>,
    /// not stored, only used for query.
    #[prost(string, tag = "5")]
    pub alias: std::string::String,
}
pub mod facet {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum ValType {
        String = 0,
        Int = 1,
        Float = 2,
        Bool = 3,
        Datetime = 4,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoginRequest {
    #[prost(string, tag = "1")]
    pub userid: std::string::String,
    #[prost(string, tag = "2")]
    pub password: std::string::String,
    #[prost(string, tag = "3")]
    pub refresh_token: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Jwt {
    #[prost(string, tag = "1")]
    pub access_jwt: std::string::String,
    #[prost(string, tag = "2")]
    pub refresh_jwt: std::string::String,
}
#[doc = r" Generated client implementations."]
pub mod dgraph_client {
    #![allow(unused_variables, dead_code, missing_docs)]
    use tonic::codegen::*;
    #[doc = " Graph response."]
    pub struct DgraphClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl DgraphClient<tonic::transport::Channel> {
        #[doc = r" Attempt to create a new client by connecting to a given endpoint."]
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: std::convert::TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> DgraphClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        T::ResponseBody: Body + HttpBody + Send + 'static,
        T::Error: Into<StdError>,
        <T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_interceptor(inner: T, interceptor: impl Into<tonic::Interceptor>) -> Self {
            let inner = tonic::client::Grpc::with_interceptor(inner, interceptor);
            Self { inner }
        }
        pub async fn login(
            &mut self,
            request: impl tonic::IntoRequest<super::LoginRequest>,
        ) -> Result<tonic::Response<super::Response>, tonic::Status> {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::new(
                    tonic::Code::Unknown,
                    format!("Service was not ready: {}", e.into()),
                )
            })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/api.Dgraph/Login");
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn query(
            &mut self,
            request: impl tonic::IntoRequest<super::Request>,
        ) -> Result<tonic::Response<super::Response>, tonic::Status> {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::new(
                    tonic::Code::Unknown,
                    format!("Service was not ready: {}", e.into()),
                )
            })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/api.Dgraph/Query");
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn alter(
            &mut self,
            request: impl tonic::IntoRequest<super::Operation>,
        ) -> Result<tonic::Response<super::Payload>, tonic::Status> {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::new(
                    tonic::Code::Unknown,
                    format!("Service was not ready: {}", e.into()),
                )
            })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/api.Dgraph/Alter");
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn commit_or_abort(
            &mut self,
            request: impl tonic::IntoRequest<super::TxnContext>,
        ) -> Result<tonic::Response<super::TxnContext>, tonic::Status> {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::new(
                    tonic::Code::Unknown,
                    format!("Service was not ready: {}", e.into()),
                )
            })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/api.Dgraph/CommitOrAbort");
            self.inner.unary(request.into_request(), path, codec).await
        }
        pub async fn check_version(
            &mut self,
            request: impl tonic::IntoRequest<super::Check>,
        ) -> Result<tonic::Response<super::Version>, tonic::Status> {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::new(
                    tonic::Code::Unknown,
                    format!("Service was not ready: {}", e.into()),
                )
            })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static("/api.Dgraph/CheckVersion");
            self.inner.unary(request.into_request(), path, codec).await
        }
    }
    impl<T: Clone> Clone for DgraphClient<T> {
        fn clone(&self) -> Self {
            Self {
                inner: self.inner.clone(),
            }
        }
    }
    impl<T> std::fmt::Debug for DgraphClient<T> {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
            write!(f, "DgraphClient {{ ... }}")
        }
    }
}