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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
/// A UUID.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Uuid {
    #[prost(bytes = "vec", tag = "1")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
/// An edge or vertex type.
///
/// Types must be less than 256 characters long, and can only contain letters,
/// numbers, dashes and underscores.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Type {
    #[prost(string, tag = "1")]
    pub value: ::prost::alloc::string::String,
}
/// A JSON value.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Json {
    #[prost(string, tag = "1")]
    pub value: ::prost::alloc::string::String,
}
/// An edge.
///
/// Edges are how you would represent a verb or a relationship in the
/// datastore. An example might be "liked" or "reviewed". Edges are typed and
/// directed.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Edge {
    /// The key to the edge.
    #[prost(message, optional, tag = "1")]
    pub key: ::core::option::Option<EdgeKey>,
    /// When the edge was created.
    #[prost(message, optional, tag = "2")]
    pub created_datetime: ::core::option::Option<::prost_types::Timestamp>,
}
/// Represents a uniquely identifiable key to an edge.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgeKey {
    /// The id of the outbound vertex.
    #[prost(message, optional, tag = "1")]
    pub outbound_id: ::core::option::Option<Uuid>,
    /// The type of the edge.
    #[prost(message, optional, tag = "2")]
    pub t: ::core::option::Option<Type>,
    /// The id of the inbound vertex.
    #[prost(message, optional, tag = "3")]
    pub inbound_id: ::core::option::Option<Uuid>,
}
/// A vertex.
///
/// Vertices are how you would represent nouns in the datastore. An example
/// might be a user, or a movie. All vertices have a unique ID and a type.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Vertex {
    /// The id of the vertex.
    #[prost(message, optional, tag = "1")]
    pub id: ::core::option::Option<Uuid>,
    /// The type of the vertex.
    #[prost(message, optional, tag = "2")]
    pub t: ::core::option::Option<Type>,
}
/// A query for vertices.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VertexQuery {
    #[prost(oneof = "vertex_query::Query", tags = "1, 2, 3")]
    pub query: ::core::option::Option<vertex_query::Query>,
}
/// Nested message and enum types in `VertexQuery`.
pub mod vertex_query {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Query {
        #[prost(message, tag = "1")]
        Range(super::RangeVertexQuery),
        #[prost(message, tag = "2")]
        Specific(super::SpecificVertexQuery),
        #[prost(message, tag = "3")]
        Pipe(::prost::alloc::boxed::Box<super::PipeVertexQuery>),
    }
}
/// Gets a range of vertices.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RangeVertexQuery {
    /// Limits the number of vertices to get.
    #[prost(uint32, tag = "1")]
    pub limit: u32,
    /// Filters the type of vertices returned.
    #[prost(message, optional, tag = "2")]
    pub t: ::core::option::Option<Type>,
    /// Sets the lowest vertex ID to return.
    #[prost(message, optional, tag = "3")]
    pub start_id: ::core::option::Option<Uuid>,
}
/// Gets a specific set of vertices.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpecificVertexQuery {
    /// The IDs of the vertices to get.
    #[prost(message, repeated, tag = "1")]
    pub ids: ::prost::alloc::vec::Vec<Uuid>,
}
/// Gets the vertices associated with edges.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PipeVertexQuery {
    /// The edge query to build off of.
    #[prost(message, optional, boxed, tag = "1")]
    pub inner: ::core::option::Option<::prost::alloc::boxed::Box<EdgeQuery>>,
    /// Whether to get outbound or inbound vertices on the edges.
    #[prost(enumeration = "EdgeDirection", tag = "2")]
    pub direction: i32,
    /// Limits the number of vertices to get.
    #[prost(uint32, tag = "3")]
    pub limit: u32,
    /// Filters the type of vertices returned.
    #[prost(message, optional, tag = "4")]
    pub t: ::core::option::Option<Type>,
}
/// Gets property values associated with vertices.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VertexPropertyQuery {
    /// The vertex query to build off of.
    #[prost(message, optional, tag = "1")]
    pub inner: ::core::option::Option<VertexQuery>,
    /// The name of the property to get.
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
/// A query for edges.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgeQuery {
    #[prost(oneof = "edge_query::Query", tags = "1, 2")]
    pub query: ::core::option::Option<edge_query::Query>,
}
/// Nested message and enum types in `EdgeQuery`.
pub mod edge_query {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Query {
        #[prost(message, tag = "1")]
        Specific(super::SpecificEdgeQuery),
        #[prost(message, tag = "2")]
        Pipe(::prost::alloc::boxed::Box<super::PipeEdgeQuery>),
    }
}
/// Gets a specific set of edges.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SpecificEdgeQuery {
    /// The keys of the edges to get.
    #[prost(message, repeated, tag = "1")]
    pub keys: ::prost::alloc::vec::Vec<EdgeKey>,
}
/// Gets the edges associated with vertices.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PipeEdgeQuery {
    /// The vertex query to build off of.
    #[prost(message, optional, boxed, tag = "1")]
    pub inner: ::core::option::Option<::prost::alloc::boxed::Box<VertexQuery>>,
    /// Whether to get outbound or inbound edges on the vertices.
    #[prost(enumeration = "EdgeDirection", tag = "2")]
    pub direction: i32,
    /// Filters the type of edges returned.
    #[prost(message, optional, tag = "3")]
    pub t: ::core::option::Option<Type>,
    /// Specifies the newest update datetime for returned edges.
    #[prost(message, optional, tag = "4")]
    pub high: ::core::option::Option<::prost_types::Timestamp>,
    /// Specifies the oldest update datetime for returned edges.
    #[prost(message, optional, tag = "5")]
    pub low: ::core::option::Option<::prost_types::Timestamp>,
    /// Limits the number of edges to get.
    #[prost(uint32, tag = "6")]
    pub limit: u32,
}
/// Gets property values associated with edges.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgePropertyQuery {
    /// The edge query to build off of.
    #[prost(message, optional, tag = "1")]
    pub inner: ::core::option::Option<EdgeQuery>,
    /// The name of the property to get.
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
/// A property.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NamedProperty {
    /// The id of the vertex.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// The property value.
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<Json>,
}
/// Represents a vertex property.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VertexProperty {
    /// The id of the vertex.
    #[prost(message, optional, tag = "1")]
    pub id: ::core::option::Option<Uuid>,
    /// The property value.
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<Json>,
}
/// A vertex with properties.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VertexProperties {
    /// The vertex.
    #[prost(message, optional, tag = "1")]
    pub vertex: ::core::option::Option<Vertex>,
    /// All of the vertex's properties.
    #[prost(message, repeated, tag = "2")]
    pub props: ::prost::alloc::vec::Vec<NamedProperty>,
}
/// Represents an edge property.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgeProperty {
    /// The key to the edge.
    #[prost(message, optional, tag = "1")]
    pub key: ::core::option::Option<EdgeKey>,
    /// The property value.
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<Json>,
}
/// An edge with properties.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgeProperties {
    /// The edge.
    #[prost(message, optional, tag = "1")]
    pub edge: ::core::option::Option<Edge>,
    /// All of the edge's properties.
    #[prost(message, repeated, tag = "2")]
    pub props: ::prost::alloc::vec::Vec<NamedProperty>,
}
/// An item to insert, as part of a bulk insert request.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BulkInsertItem {
    #[prost(oneof = "bulk_insert_item::Item", tags = "1, 2, 3, 4")]
    pub item: ::core::option::Option<bulk_insert_item::Item>,
}
/// Nested message and enum types in `BulkInsertItem`.
pub mod bulk_insert_item {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Item {
        #[prost(message, tag = "1")]
        Vertex(super::Vertex),
        #[prost(message, tag = "2")]
        Edge(super::EdgeKey),
        #[prost(message, tag = "3")]
        VertexProperty(super::VertexPropertyBulkInsertItem),
        #[prost(message, tag = "4")]
        EdgeProperty(super::EdgePropertyBulkInsertItem),
    }
}
/// A vertex property to insert.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VertexPropertyBulkInsertItem {
    #[prost(message, optional, tag = "1")]
    pub id: ::core::option::Option<Uuid>,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub value: ::core::option::Option<Json>,
}
/// An edge property to insert.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EdgePropertyBulkInsertItem {
    #[prost(message, optional, tag = "1")]
    pub key: ::core::option::Option<EdgeKey>,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub value: ::core::option::Option<Json>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetEdgeCountRequest {
    #[prost(message, optional, tag = "1")]
    pub id: ::core::option::Option<Uuid>,
    #[prost(message, optional, tag = "2")]
    pub t: ::core::option::Option<Type>,
    #[prost(enumeration = "EdgeDirection", tag = "3")]
    pub direction: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetVertexPropertiesRequest {
    #[prost(message, optional, tag = "1")]
    pub q: ::core::option::Option<VertexPropertyQuery>,
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<Json>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetEdgePropertiesRequest {
    #[prost(message, optional, tag = "1")]
    pub q: ::core::option::Option<EdgePropertyQuery>,
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<Json>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TransactionRequest {
    #[prost(uint32, tag = "1")]
    pub request_id: u32,
    #[prost(
        oneof = "transaction_request::Request",
        tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18"
    )]
    pub request: ::core::option::Option<transaction_request::Request>,
}
/// Nested message and enum types in `TransactionRequest`.
pub mod transaction_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Request {
        /// Creates a new vertex. Returns whether the vertex was successfully
        /// created - if this is false, it's because a vertex with the same UUID
        /// already exists.
        #[prost(message, tag = "2")]
        CreateVertex(super::Vertex),
        /// Creates a new vertex with just a type specification. As opposed to
        /// `CreateVertex`, this is used when you do not want to manually specify
        /// the vertex's UUID. Returns the new vertex's UUID.
        #[prost(message, tag = "3")]
        CreateVertexFromType(super::Type),
        /// Gets a range of vertices specified by a query.
        #[prost(message, tag = "4")]
        GetVertices(super::VertexQuery),
        /// Deletes existing vertices specified by a query.
        #[prost(message, tag = "5")]
        DeleteVertices(super::VertexQuery),
        /// Gets the number of vertices in the datastore.
        #[prost(message, tag = "6")]
        GetVertexCount(()),
        /// Creates a new edge. If the edge already exists, this will update it
        /// with a new update datetime. Returns whether the edge was successfully
        /// created - if this is false, it's because one of the specified vertices
        /// is missing.
        #[prost(message, tag = "7")]
        CreateEdge(super::EdgeKey),
        /// Gets a range of edges specified by a query.
        #[prost(message, tag = "8")]
        GetEdges(super::EdgeQuery),
        /// Deletes a set of edges specified by a query.
        #[prost(message, tag = "9")]
        DeleteEdges(super::EdgeQuery),
        /// Gets the number of edges associated with a vertex.
        #[prost(message, tag = "10")]
        GetEdgeCount(super::GetEdgeCountRequest),
        /// Gets vertex properties.
        #[prost(message, tag = "11")]
        GetVertexProperties(super::VertexPropertyQuery),
        /// Sets vertex properties.
        #[prost(message, tag = "12")]
        SetVertexProperties(super::SetVertexPropertiesRequest),
        /// Deletes vertex properties.
        #[prost(message, tag = "13")]
        DeleteVertexProperties(super::VertexPropertyQuery),
        /// Gets edge properties.
        #[prost(message, tag = "14")]
        GetEdgeProperties(super::EdgePropertyQuery),
        /// Sets edge properties.
        #[prost(message, tag = "15")]
        SetEdgeProperties(super::SetEdgePropertiesRequest),
        /// Deletes edge properties.
        #[prost(message, tag = "16")]
        DeleteEdgeProperties(super::EdgePropertyQuery),
        /// Gets vertexes and all properties for each vertex.
        #[prost(message, tag = "17")]
        GetAllVertexProperties(super::VertexQuery),
        /// Gets edges and all properties for each edge.
        #[prost(message, tag = "18")]
        GetAllEdgeProperties(super::EdgeQuery),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TransactionResponse {
    /// The ID of the request associated with this response.
    #[prost(uint32, tag = "1")]
    pub request_id: u32,
    #[prost(
        oneof = "transaction_response::Response",
        tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11"
    )]
    pub response: ::core::option::Option<transaction_response::Response>,
}
/// Nested message and enum types in `TransactionResponse`.
pub mod transaction_response {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Response {
        /// An empty response.
        #[prost(message, tag = "2")]
        Empty(()),
        /// An ok response, indicating whether or not it was successful.
        #[prost(bool, tag = "3")]
        Ok(bool),
        /// A response with a count.
        #[prost(uint64, tag = "4")]
        Count(u64),
        /// A response with a vertex ID.
        #[prost(message, tag = "5")]
        Id(super::Uuid),
        /// A response with a vertex.
        #[prost(message, tag = "6")]
        Vertex(super::Vertex),
        /// A response with an edge.
        #[prost(message, tag = "7")]
        Edge(super::Edge),
        /// A response with a vertex property.
        #[prost(message, tag = "8")]
        VertexProperty(super::VertexProperty),
        /// A response with vertex properties.
        #[prost(message, tag = "9")]
        VertexProperties(super::VertexProperties),
        /// A response with an edge property.
        #[prost(message, tag = "10")]
        EdgeProperty(super::EdgeProperty),
        /// A response with edge properties.
        #[prost(message, tag = "11")]
        EdgeProperties(super::EdgeProperties),
    }
}
/// Specifies what kind of items should be piped from one type of query to
/// another.
///
/// Edge and vertex queries can build off of one another via pipes - e.g. you
/// can get the outbound edges of a set of vertices by piping from a vertex
/// query to an edge query. `EdgeDirection`s are used to specify which
/// end of things you want to pipe - either the outbound items or the inbound
/// items.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EdgeDirection {
    Outbound = 0,
    Inbound = 1,
}
#[doc = r" Generated client implementations."]
pub mod indra_db_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    #[derive(Debug, Clone)]
    pub struct IndraDbClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl IndraDbClient<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> IndraDbClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        T::ResponseBody: Body + Send + Sync + 'static,
        T::Error: Into<StdError>,
        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> IndraDbClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T: tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
                Into<StdError> + Send + Sync,
        {
            IndraDbClient::new(InterceptedService::new(inner, interceptor))
        }
        #[doc = r" Compress requests with `gzip`."]
        #[doc = r""]
        #[doc = r" This requires the server to support it otherwise it might respond with an"]
        #[doc = r" error."]
        pub fn send_gzip(mut self) -> Self {
            self.inner = self.inner.send_gzip();
            self
        }
        #[doc = r" Enable decompressing responses with `gzip`."]
        pub fn accept_gzip(mut self) -> Self {
            self.inner = self.inner.accept_gzip();
            self
        }
        #[doc = " Pings the server."]
        pub async fn ping(
            &mut self,
            request: impl tonic::IntoRequest<()>,
        ) -> Result<tonic::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("/indradb.IndraDB/Ping");
            self.inner.unary(request.into_request(), path, codec).await
        }
        #[doc = " Syncs persisted content. Depending on the datastore implementation,"]
        #[doc = " this has different meanings - including potentially being a no-op."]
        pub async fn sync(
            &mut self,
            request: impl tonic::IntoRequest<()>,
        ) -> Result<tonic::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("/indradb.IndraDB/Sync");
            self.inner.unary(request.into_request(), path, codec).await
        }
        #[doc = " Bulk inserts many vertices, edges, and/or properties."]
        #[doc = ""]
        #[doc = " Note that datastores have discretion on how to approach safeguard vs"]
        #[doc = " performance tradeoffs. In particular:"]
        #[doc = " * If the datastore is disk-backed, it may or may not flush before"]
        #[doc = "   returning."]
        #[doc = " * The datastore might not verify for correctness; e.g., it might not"]
        #[doc = "   ensure that the relevant vertices exist before inserting an edge."]
        #[doc = " If you want maximum protection, use the equivalent functions in"]
        #[doc = " transactions, which will provide more safeguards."]
        pub async fn bulk_insert(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::BulkInsertItem>,
        ) -> Result<tonic::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("/indradb.IndraDB/BulkInsert");
            self.inner
                .client_streaming(request.into_streaming_request(), path, codec)
                .await
        }
        #[doc = " Runs a transaction."]
        pub async fn transaction(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::TransactionRequest>,
        ) -> Result<
            tonic::Response<tonic::codec::Streaming<super::TransactionResponse>>,
            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("/indradb.IndraDB/Transaction");
            self.inner
                .streaming(request.into_streaming_request(), path, codec)
                .await
        }
    }
}
#[doc = r" Generated server implementations."]
pub mod indra_db_server {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    #[doc = "Generated trait containing gRPC methods that should be implemented for use with IndraDbServer."]
    #[async_trait]
    pub trait IndraDb: Send + Sync + 'static {
        #[doc = " Pings the server."]
        async fn ping(
            &self,
            request: tonic::Request<()>,
        ) -> Result<tonic::Response<()>, tonic::Status>;
        #[doc = " Syncs persisted content. Depending on the datastore implementation,"]
        #[doc = " this has different meanings - including potentially being a no-op."]
        async fn sync(
            &self,
            request: tonic::Request<()>,
        ) -> Result<tonic::Response<()>, tonic::Status>;
        #[doc = " Bulk inserts many vertices, edges, and/or properties."]
        #[doc = ""]
        #[doc = " Note that datastores have discretion on how to approach safeguard vs"]
        #[doc = " performance tradeoffs. In particular:"]
        #[doc = " * If the datastore is disk-backed, it may or may not flush before"]
        #[doc = "   returning."]
        #[doc = " * The datastore might not verify for correctness; e.g., it might not"]
        #[doc = "   ensure that the relevant vertices exist before inserting an edge."]
        #[doc = " If you want maximum protection, use the equivalent functions in"]
        #[doc = " transactions, which will provide more safeguards."]
        async fn bulk_insert(
            &self,
            request: tonic::Request<tonic::Streaming<super::BulkInsertItem>>,
        ) -> Result<tonic::Response<()>, tonic::Status>;
        #[doc = "Server streaming response type for the Transaction method."]
        type TransactionStream: futures_core::Stream<Item = Result<super::TransactionResponse, tonic::Status>>
            + Send
            + Sync
            + 'static;
        #[doc = " Runs a transaction."]
        async fn transaction(
            &self,
            request: tonic::Request<tonic::Streaming<super::TransactionRequest>>,
        ) -> Result<tonic::Response<Self::TransactionStream>, tonic::Status>;
    }
    #[derive(Debug)]
    pub struct IndraDbServer<T: IndraDb> {
        inner: _Inner<T>,
        accept_compression_encodings: (),
        send_compression_encodings: (),
    }
    struct _Inner<T>(Arc<T>);
    impl<T: IndraDb> IndraDbServer<T> {
        pub fn new(inner: T) -> Self {
            let inner = Arc::new(inner);
            let inner = _Inner(inner);
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
            }
        }
        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for IndraDbServer<T>
    where
        T: IndraDb,
        B: Body + Send + Sync + 'static,
        B::Error: Into<StdError> + Send + 'static,
    {
        type Response = http::Response<tonic::body::BoxBody>;
        type Error = Never;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            let inner = self.inner.clone();
            match req.uri().path() {
                "/indradb.IndraDB/Ping" => {
                    #[allow(non_camel_case_types)]
                    struct PingSvc<T: IndraDb>(pub Arc<T>);
                    impl<T: IndraDb> tonic::server::UnaryService<()> for PingSvc<T> {
                        type Response = ();
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).ping(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = PingSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
                            accept_compression_encodings,
                            send_compression_encodings,
                        );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/indradb.IndraDB/Sync" => {
                    #[allow(non_camel_case_types)]
                    struct SyncSvc<T: IndraDb>(pub Arc<T>);
                    impl<T: IndraDb> tonic::server::UnaryService<()> for SyncSvc<T> {
                        type Response = ();
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).sync(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = SyncSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
                            accept_compression_encodings,
                            send_compression_encodings,
                        );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/indradb.IndraDB/BulkInsert" => {
                    #[allow(non_camel_case_types)]
                    struct BulkInsertSvc<T: IndraDb>(pub Arc<T>);
                    impl<T: IndraDb> tonic::server::ClientStreamingService<super::BulkInsertItem> for BulkInsertSvc<T> {
                        type Response = ();
                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<tonic::Streaming<super::BulkInsertItem>>,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).bulk_insert(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = BulkInsertSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
                            accept_compression_encodings,
                            send_compression_encodings,
                        );
                        let res = grpc.client_streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                "/indradb.IndraDB/Transaction" => {
                    #[allow(non_camel_case_types)]
                    struct TransactionSvc<T: IndraDb>(pub Arc<T>);
                    impl<T: IndraDb> tonic::server::StreamingService<super::TransactionRequest> for TransactionSvc<T> {
                        type Response = super::TransactionResponse;
                        type ResponseStream = T::TransactionStream;
                        type Future =
                            BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
                        fn call(
                            &mut self,
                            request: tonic::Request<tonic::Streaming<super::TransactionRequest>>,
                        ) -> Self::Future {
                            let inner = self.0.clone();
                            let fut = async move { (*inner).transaction(request).await };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let inner = inner.0;
                        let method = TransactionSvc(inner);
                        let codec = tonic::codec::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec).apply_compression_config(
                            accept_compression_encodings,
                            send_compression_encodings,
                        );
                        let res = grpc.streaming(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => Box::pin(async move {
                    Ok(http::Response::builder()
                        .status(200)
                        .header("grpc-status", "12")
                        .header("content-type", "application/grpc")
                        .body(empty_body())
                        .unwrap())
                }),
            }
        }
    }
    impl<T: IndraDb> Clone for IndraDbServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
            }
        }
    }
    impl<T: IndraDb> Clone for _Inner<T> {
        fn clone(&self) -> Self {
            Self(self.0.clone())
        }
    }
    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
            write!(f, "{:?}", self.0)
        }
    }
    impl<T: IndraDb> tonic::transport::NamedService for IndraDbServer<T> {
        const NAME: &'static str = "indradb.IndraDB";
    }
}