-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathqdrant.rs
5894 lines (5894 loc) · 247 KB
/
qdrant.rs
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
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VectorParams {
/// Size of the vectors
#[prost(uint64, tag = "1")]
pub size: u64,
/// Distance function used for comparing vectors
#[prost(enumeration = "Distance", tag = "2")]
pub distance: i32,
/// Configuration of vector HNSW graph. If omitted - the collection configuration will be used
#[prost(message, optional, tag = "3")]
pub hnsw_config: ::core::option::Option<HnswConfigDiff>,
/// Configuration of vector quantization config. If omitted - the collection configuration will be used
#[prost(message, optional, tag = "4")]
pub quantization_config: ::core::option::Option<QuantizationConfig>,
/// If true - serve vectors from disk. If set to false, the vectors will be loaded in RAM.
#[prost(bool, optional, tag = "5")]
pub on_disk: ::core::option::Option<bool>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VectorParamsMap {
#[prost(map = "string, message", tag = "1")]
pub map: ::std::collections::HashMap<::prost::alloc::string::String, VectorParams>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VectorsConfig {
#[prost(oneof = "vectors_config::Config", tags = "1, 2")]
pub config: ::core::option::Option<vectors_config::Config>,
}
/// Nested message and enum types in `VectorsConfig`.
pub mod vectors_config {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Config {
#[prost(message, tag = "1")]
Params(super::VectorParams),
#[prost(message, tag = "2")]
ParamsMap(super::VectorParamsMap),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCollectionInfoRequest {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCollectionsRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionDescription {
/// Name of the collection
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCollectionInfoResponse {
#[prost(message, optional, tag = "1")]
pub result: ::core::option::Option<CollectionInfo>,
/// Time spent to process
#[prost(double, tag = "2")]
pub time: f64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCollectionsResponse {
#[prost(message, repeated, tag = "1")]
pub collections: ::prost::alloc::vec::Vec<CollectionDescription>,
/// Time spent to process
#[prost(double, tag = "2")]
pub time: f64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OptimizerStatus {
#[prost(bool, tag = "1")]
pub ok: bool,
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HnswConfigDiff {
///
/// Number of edges per node in the index graph. Larger the value - more accurate the search, more space required.
#[prost(uint64, optional, tag = "1")]
pub m: ::core::option::Option<u64>,
///
/// Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build the index.
#[prost(uint64, optional, tag = "2")]
pub ef_construct: ::core::option::Option<u64>,
///
/// Minimal size (in KiloBytes) of vectors for additional payload-based indexing.
/// If the payload chunk is smaller than `full_scan_threshold` additional indexing won't be used -
/// in this case full-scan search should be preferred by query planner and additional indexing is not required.
/// Note: 1 Kb = 1 vector of size 256
#[prost(uint64, optional, tag = "3")]
pub full_scan_threshold: ::core::option::Option<u64>,
///
/// Number of parallel threads used for background index building. If 0 - auto selection.
#[prost(uint64, optional, tag = "4")]
pub max_indexing_threads: ::core::option::Option<u64>,
///
/// Store HNSW index on disk. If set to false, the index will be stored in RAM.
#[prost(bool, optional, tag = "5")]
pub on_disk: ::core::option::Option<bool>,
///
/// Number of additional payload-aware links per node in the index graph. If not set - regular M parameter will be used.
#[prost(uint64, optional, tag = "6")]
pub payload_m: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WalConfigDiff {
/// Size of a single WAL block file
#[prost(uint64, optional, tag = "1")]
pub wal_capacity_mb: ::core::option::Option<u64>,
/// Number of segments to create in advance
#[prost(uint64, optional, tag = "2")]
pub wal_segments_ahead: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OptimizersConfigDiff {
///
/// The minimal fraction of deleted vectors in a segment, required to perform segment optimization
#[prost(double, optional, tag = "1")]
pub deleted_threshold: ::core::option::Option<f64>,
///
/// The minimal number of vectors in a segment, required to perform segment optimization
#[prost(uint64, optional, tag = "2")]
pub vacuum_min_vector_number: ::core::option::Option<u64>,
///
/// Target amount of segments the optimizer will try to keep.
/// Real amount of segments may vary depending on multiple parameters:
///
/// - Amount of stored points.
/// - Current write RPS.
///
/// It is recommended to select the default number of segments as a factor of the number of search threads,
/// so that each segment would be handled evenly by one of the threads.
#[prost(uint64, optional, tag = "3")]
pub default_segment_number: ::core::option::Option<u64>,
///
/// Do not create segments larger this size (in kilobytes).
/// Large segments might require disproportionately long indexation times,
/// therefore it makes sense to limit the size of segments.
///
/// If indexing speed is more important - make this parameter lower.
/// If search speed is more important - make this parameter higher.
/// Note: 1Kb = 1 vector of size 256
/// If not set, will be automatically selected considering the number of available CPUs.
#[prost(uint64, optional, tag = "4")]
pub max_segment_size: ::core::option::Option<u64>,
///
/// Maximum size (in kilobytes) of vectors to store in-memory per segment.
/// Segments larger than this threshold will be stored as read-only memmaped file.
///
/// Memmap storage is disabled by default, to enable it, set this threshold to a reasonable value.
///
/// To disable memmap storage, set this to `0`.
///
/// Note: 1Kb = 1 vector of size 256
#[prost(uint64, optional, tag = "5")]
pub memmap_threshold: ::core::option::Option<u64>,
///
/// Maximum size (in kilobytes) of vectors allowed for plain index, exceeding this threshold will enable vector indexing
///
/// Default value is 20,000, based on <<https://github.com/google-research/google-research/blob/master/scann/docs/algorithms.md>.>
///
/// To disable vector indexing, set to `0`.
///
/// Note: 1kB = 1 vector of size 256.
#[prost(uint64, optional, tag = "6")]
pub indexing_threshold: ::core::option::Option<u64>,
///
/// Interval between forced flushes.
#[prost(uint64, optional, tag = "7")]
pub flush_interval_sec: ::core::option::Option<u64>,
///
/// Max number of threads, which can be used for optimization. If 0 - `NUM_CPU - 1` will be used
#[prost(uint64, optional, tag = "8")]
pub max_optimization_threads: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScalarQuantization {
/// Type of quantization
#[prost(enumeration = "QuantizationType", tag = "1")]
pub r#type: i32,
/// Number of bits to use for quantization
#[prost(float, optional, tag = "2")]
pub quantile: ::core::option::Option<f32>,
/// If true - quantized vectors always will be stored in RAM, ignoring the config of main storage
#[prost(bool, optional, tag = "3")]
pub always_ram: ::core::option::Option<bool>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProductQuantization {
/// Compression ratio
#[prost(enumeration = "CompressionRatio", tag = "1")]
pub compression: i32,
/// If true - quantized vectors always will be stored in RAM, ignoring the config of main storage
#[prost(bool, optional, tag = "2")]
pub always_ram: ::core::option::Option<bool>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuantizationConfig {
#[prost(oneof = "quantization_config::Quantization", tags = "1, 2")]
pub quantization: ::core::option::Option<quantization_config::Quantization>,
}
/// Nested message and enum types in `QuantizationConfig`.
pub mod quantization_config {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Quantization {
#[prost(message, tag = "1")]
Scalar(super::ScalarQuantization),
#[prost(message, tag = "2")]
Product(super::ProductQuantization),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCollection {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
/// Configuration of vector index
#[prost(message, optional, tag = "4")]
pub hnsw_config: ::core::option::Option<HnswConfigDiff>,
/// Configuration of the Write-Ahead-Log
#[prost(message, optional, tag = "5")]
pub wal_config: ::core::option::Option<WalConfigDiff>,
/// Configuration of the optimizers
#[prost(message, optional, tag = "6")]
pub optimizers_config: ::core::option::Option<OptimizersConfigDiff>,
/// Number of shards in the collection, default is 1 for standalone, otherwise equal to the number of nodes. Minimum is 1
#[prost(uint32, optional, tag = "7")]
pub shard_number: ::core::option::Option<u32>,
/// If true - point's payload will not be stored in memory
#[prost(bool, optional, tag = "8")]
pub on_disk_payload: ::core::option::Option<bool>,
/// Wait timeout for operation commit in seconds, if not specified - default value will be supplied
#[prost(uint64, optional, tag = "9")]
pub timeout: ::core::option::Option<u64>,
/// Configuration for vectors
#[prost(message, optional, tag = "10")]
pub vectors_config: ::core::option::Option<VectorsConfig>,
/// Number of replicas of each shard that network tries to maintain, default = 1
#[prost(uint32, optional, tag = "11")]
pub replication_factor: ::core::option::Option<u32>,
/// How many replicas should apply the operation for us to consider it successful, default = 1
#[prost(uint32, optional, tag = "12")]
pub write_consistency_factor: ::core::option::Option<u32>,
/// Specify name of the other collection to copy data from
#[prost(string, optional, tag = "13")]
pub init_from_collection: ::core::option::Option<::prost::alloc::string::String>,
/// Quantization configuration of vector
#[prost(message, optional, tag = "14")]
pub quantization_config: ::core::option::Option<QuantizationConfig>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCollection {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
/// New configuration parameters for the collection
#[prost(message, optional, tag = "2")]
pub optimizers_config: ::core::option::Option<OptimizersConfigDiff>,
/// Wait timeout for operation commit in seconds, if not specified - default value will be supplied
#[prost(uint64, optional, tag = "3")]
pub timeout: ::core::option::Option<u64>,
/// New configuration parameters for the collection
#[prost(message, optional, tag = "4")]
pub params: ::core::option::Option<CollectionParamsDiff>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCollection {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
/// Wait timeout for operation commit in seconds, if not specified - default value will be supplied
#[prost(uint64, optional, tag = "2")]
pub timeout: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionOperationResponse {
/// if operation made changes
#[prost(bool, tag = "1")]
pub result: bool,
/// Time spent to process
#[prost(double, tag = "2")]
pub time: f64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionParams {
/// Number of shards in collection
#[prost(uint32, tag = "3")]
pub shard_number: u32,
/// If true - point's payload will not be stored in memory
#[prost(bool, tag = "4")]
pub on_disk_payload: bool,
/// Configuration for vectors
#[prost(message, optional, tag = "5")]
pub vectors_config: ::core::option::Option<VectorsConfig>,
/// Number of replicas of each shard that network tries to maintain
#[prost(uint32, optional, tag = "6")]
pub replication_factor: ::core::option::Option<u32>,
/// How many replicas should apply the operation for us to consider it successful
#[prost(uint32, optional, tag = "7")]
pub write_consistency_factor: ::core::option::Option<u32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionParamsDiff {
/// Number of replicas of each shard that network tries to maintain
#[prost(uint32, optional, tag = "1")]
pub replication_factor: ::core::option::Option<u32>,
/// How many replicas should apply the operation for us to consider it successful
#[prost(uint32, optional, tag = "2")]
pub write_consistency_factor: ::core::option::Option<u32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionConfig {
/// Collection parameters
#[prost(message, optional, tag = "1")]
pub params: ::core::option::Option<CollectionParams>,
/// Configuration of vector index
#[prost(message, optional, tag = "2")]
pub hnsw_config: ::core::option::Option<HnswConfigDiff>,
/// Configuration of the optimizers
#[prost(message, optional, tag = "3")]
pub optimizer_config: ::core::option::Option<OptimizersConfigDiff>,
/// Configuration of the Write-Ahead-Log
#[prost(message, optional, tag = "4")]
pub wal_config: ::core::option::Option<WalConfigDiff>,
/// Configuration of the vector quantization
#[prost(message, optional, tag = "5")]
pub quantization_config: ::core::option::Option<QuantizationConfig>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextIndexParams {
/// Tokenizer type
#[prost(enumeration = "TokenizerType", tag = "1")]
pub tokenizer: i32,
/// If true - all tokens will be lowercase
#[prost(bool, optional, tag = "2")]
pub lowercase: ::core::option::Option<bool>,
/// Minimal token length
#[prost(uint64, optional, tag = "3")]
pub min_token_len: ::core::option::Option<u64>,
/// Maximal token length
#[prost(uint64, optional, tag = "4")]
pub max_token_len: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PayloadIndexParams {
#[prost(oneof = "payload_index_params::IndexParams", tags = "1")]
pub index_params: ::core::option::Option<payload_index_params::IndexParams>,
}
/// Nested message and enum types in `PayloadIndexParams`.
pub mod payload_index_params {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum IndexParams {
/// Parameters for text index
#[prost(message, tag = "1")]
TextIndexParams(super::TextIndexParams),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PayloadSchemaInfo {
/// Field data type
#[prost(enumeration = "PayloadSchemaType", tag = "1")]
pub data_type: i32,
/// Field index parameters
#[prost(message, optional, tag = "2")]
pub params: ::core::option::Option<PayloadIndexParams>,
/// Number of points indexed within this field indexed
#[prost(uint64, optional, tag = "3")]
pub points: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionInfo {
/// operating condition of the collection
#[prost(enumeration = "CollectionStatus", tag = "1")]
pub status: i32,
/// status of collection optimizers
#[prost(message, optional, tag = "2")]
pub optimizer_status: ::core::option::Option<OptimizerStatus>,
/// number of vectors in the collection
#[prost(uint64, tag = "3")]
pub vectors_count: u64,
/// Number of independent segments
#[prost(uint64, tag = "4")]
pub segments_count: u64,
/// Configuration
#[prost(message, optional, tag = "7")]
pub config: ::core::option::Option<CollectionConfig>,
/// Collection data types
#[prost(map = "string, message", tag = "8")]
pub payload_schema: ::std::collections::HashMap<
::prost::alloc::string::String,
PayloadSchemaInfo,
>,
/// number of points in the collection
#[prost(uint64, tag = "9")]
pub points_count: u64,
/// number of indexed vectors in the collection.
#[prost(uint64, optional, tag = "10")]
pub indexed_vectors_count: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChangeAliases {
/// List of actions
#[prost(message, repeated, tag = "1")]
pub actions: ::prost::alloc::vec::Vec<AliasOperations>,
/// Wait timeout for operation commit in seconds, if not specified - default value will be supplied
#[prost(uint64, optional, tag = "2")]
pub timeout: ::core::option::Option<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AliasOperations {
#[prost(oneof = "alias_operations::Action", tags = "1, 2, 3")]
pub action: ::core::option::Option<alias_operations::Action>,
}
/// Nested message and enum types in `AliasOperations`.
pub mod alias_operations {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Action {
#[prost(message, tag = "1")]
CreateAlias(super::CreateAlias),
#[prost(message, tag = "2")]
RenameAlias(super::RenameAlias),
#[prost(message, tag = "3")]
DeleteAlias(super::DeleteAlias),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateAlias {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
/// New name of the alias
#[prost(string, tag = "2")]
pub alias_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RenameAlias {
/// Name of the alias to rename
#[prost(string, tag = "1")]
pub old_alias_name: ::prost::alloc::string::String,
/// Name of the alias
#[prost(string, tag = "2")]
pub new_alias_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteAlias {
/// Name of the alias
#[prost(string, tag = "1")]
pub alias_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAliasesRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListCollectionAliasesRequest {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AliasDescription {
/// Name of the alias
#[prost(string, tag = "1")]
pub alias_name: ::prost::alloc::string::String,
/// Name of the collection
#[prost(string, tag = "2")]
pub collection_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAliasesResponse {
#[prost(message, repeated, tag = "1")]
pub aliases: ::prost::alloc::vec::Vec<AliasDescription>,
/// Time spent to process
#[prost(double, tag = "2")]
pub time: f64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionClusterInfoRequest {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocalShardInfo {
/// Local shard id
#[prost(uint32, tag = "1")]
pub shard_id: u32,
/// Number of points in the shard
#[prost(uint64, tag = "2")]
pub points_count: u64,
/// Is replica active
#[prost(enumeration = "ReplicaState", tag = "3")]
pub state: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoteShardInfo {
/// Local shard id
#[prost(uint32, tag = "1")]
pub shard_id: u32,
/// Remote peer id
#[prost(uint64, tag = "2")]
pub peer_id: u64,
/// Is replica active
#[prost(enumeration = "ReplicaState", tag = "3")]
pub state: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ShardTransferInfo {
/// Local shard id
#[prost(uint32, tag = "1")]
pub shard_id: u32,
#[prost(uint64, tag = "2")]
pub from: u64,
#[prost(uint64, tag = "3")]
pub to: u64,
/// If `true` transfer is a synchronization of a replicas; If `false` transfer is a moving of a shard from one peer to another
#[prost(bool, tag = "4")]
pub sync: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CollectionClusterInfoResponse {
/// ID of this peer
#[prost(uint64, tag = "1")]
pub peer_id: u64,
/// Total number of shards
#[prost(uint64, tag = "2")]
pub shard_count: u64,
/// Local shards
#[prost(message, repeated, tag = "3")]
pub local_shards: ::prost::alloc::vec::Vec<LocalShardInfo>,
/// Remote shards
#[prost(message, repeated, tag = "4")]
pub remote_shards: ::prost::alloc::vec::Vec<RemoteShardInfo>,
/// Shard transfers
#[prost(message, repeated, tag = "5")]
pub shard_transfers: ::prost::alloc::vec::Vec<ShardTransferInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MoveShard {
/// Local shard id
#[prost(uint32, tag = "1")]
pub shard_id: u32,
#[prost(uint64, tag = "2")]
pub from_peer_id: u64,
#[prost(uint64, tag = "3")]
pub to_peer_id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Replica {
#[prost(uint32, tag = "1")]
pub shard_id: u32,
#[prost(uint64, tag = "2")]
pub peer_id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCollectionClusterSetupRequest {
/// Name of the collection
#[prost(string, tag = "1")]
pub collection_name: ::prost::alloc::string::String,
/// Wait timeout for operation commit in seconds, if not specified - default value will be supplied
#[prost(uint64, optional, tag = "6")]
pub timeout: ::core::option::Option<u64>,
#[prost(
oneof = "update_collection_cluster_setup_request::Operation",
tags = "2, 3, 4, 5"
)]
pub operation: ::core::option::Option<
update_collection_cluster_setup_request::Operation,
>,
}
/// Nested message and enum types in `UpdateCollectionClusterSetupRequest`.
pub mod update_collection_cluster_setup_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Operation {
#[prost(message, tag = "2")]
MoveShard(super::MoveShard),
#[prost(message, tag = "3")]
ReplicateShard(super::MoveShard),
#[prost(message, tag = "4")]
AbortTransfer(super::MoveShard),
#[prost(message, tag = "5")]
DropReplica(super::Replica),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateCollectionClusterSetupResponse {
#[prost(bool, tag = "1")]
pub result: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Distance {
UnknownDistance = 0,
Cosine = 1,
Euclid = 2,
Dot = 3,
}
impl Distance {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Distance::UnknownDistance => "UnknownDistance",
Distance::Cosine => "Cosine",
Distance::Euclid => "Euclid",
Distance::Dot => "Dot",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UnknownDistance" => Some(Self::UnknownDistance),
"Cosine" => Some(Self::Cosine),
"Euclid" => Some(Self::Euclid),
"Dot" => Some(Self::Dot),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CollectionStatus {
UnknownCollectionStatus = 0,
/// All segments are ready
Green = 1,
/// Optimization in process
Yellow = 2,
/// Something went wrong
Red = 3,
}
impl CollectionStatus {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
CollectionStatus::UnknownCollectionStatus => "UnknownCollectionStatus",
CollectionStatus::Green => "Green",
CollectionStatus::Yellow => "Yellow",
CollectionStatus::Red => "Red",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UnknownCollectionStatus" => Some(Self::UnknownCollectionStatus),
"Green" => Some(Self::Green),
"Yellow" => Some(Self::Yellow),
"Red" => Some(Self::Red),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PayloadSchemaType {
UnknownType = 0,
Keyword = 1,
Integer = 2,
Float = 3,
Geo = 4,
Text = 5,
}
impl PayloadSchemaType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
PayloadSchemaType::UnknownType => "UnknownType",
PayloadSchemaType::Keyword => "Keyword",
PayloadSchemaType::Integer => "Integer",
PayloadSchemaType::Float => "Float",
PayloadSchemaType::Geo => "Geo",
PayloadSchemaType::Text => "Text",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UnknownType" => Some(Self::UnknownType),
"Keyword" => Some(Self::Keyword),
"Integer" => Some(Self::Integer),
"Float" => Some(Self::Float),
"Geo" => Some(Self::Geo),
"Text" => Some(Self::Text),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum QuantizationType {
UnknownQuantization = 0,
Int8 = 1,
}
impl QuantizationType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
QuantizationType::UnknownQuantization => "UnknownQuantization",
QuantizationType::Int8 => "Int8",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UnknownQuantization" => Some(Self::UnknownQuantization),
"Int8" => Some(Self::Int8),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CompressionRatio {
X4 = 0,
X8 = 1,
X16 = 2,
X32 = 3,
X64 = 4,
}
impl CompressionRatio {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
CompressionRatio::X4 => "x4",
CompressionRatio::X8 => "x8",
CompressionRatio::X16 => "x16",
CompressionRatio::X32 => "x32",
CompressionRatio::X64 => "x64",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"x4" => Some(Self::X4),
"x8" => Some(Self::X8),
"x16" => Some(Self::X16),
"x32" => Some(Self::X32),
"x64" => Some(Self::X64),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TokenizerType {
Unknown = 0,
Prefix = 1,
Whitespace = 2,
Word = 3,
}
impl TokenizerType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
TokenizerType::Unknown => "Unknown",
TokenizerType::Prefix => "Prefix",
TokenizerType::Whitespace => "Whitespace",
TokenizerType::Word => "Word",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Unknown" => Some(Self::Unknown),
"Prefix" => Some(Self::Prefix),
"Whitespace" => Some(Self::Whitespace),
"Word" => Some(Self::Word),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ReplicaState {
/// Active and sound
Active = 0,
/// Failed for some reason
Dead = 1,
/// The shard is partially loaded and is currently receiving data from other shards
Partial = 2,
/// Collection is being created
Initializing = 3,
/// A shard which receives data, but is not used for search; Useful for backup shards
Listener = 4,
}
impl ReplicaState {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ReplicaState::Active => "Active",
ReplicaState::Dead => "Dead",
ReplicaState::Partial => "Partial",
ReplicaState::Initializing => "Initializing",
ReplicaState::Listener => "Listener",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Active" => Some(Self::Active),
"Dead" => Some(Self::Dead),
"Partial" => Some(Self::Partial),
"Initializing" => Some(Self::Initializing),
"Listener" => Some(Self::Listener),
_ => None,
}
}
}
/// Generated client implementations.
pub mod collections_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct CollectionsClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CollectionsClient<tonic::transport::Channel> {
/// 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: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> CollectionsClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<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_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CollectionsClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
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,
{
CollectionsClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
///
/// Get detailed information about specified existing collection
pub async fn get(
&mut self,
request: impl tonic::IntoRequest<super::GetCollectionInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetCollectionInfoResponse>,
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("/qdrant.Collections/Get");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("qdrant.Collections", "Get"));
self.inner.unary(req, path, codec).await
}
///
/// Get list name of all existing collections
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListCollectionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListCollectionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),