Skip to content

Commit

Permalink
Update v1.9.0 (#95)
Browse files Browse the repository at this point in the history
* update for v1.9

* update integration tests qdrant version
  • Loading branch information
coszio authored Apr 22, 2024
1 parent 73d7317 commit 3a889a8
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 9 deletions.
19 changes: 16 additions & 3 deletions proto/collections.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ syntax = "proto3";
package qdrant;
option csharp_namespace = "Qdrant.Client.Grpc";

enum Datatype {
Default = 0;
Float32 = 1;
Uint8 = 2;
}

message VectorParams {
uint64 size = 1; // Size of the vectors
Distance distance = 2; // Distance function used for comparing vectors
optional HnswConfigDiff hnsw_config = 3; // Configuration of vector HNSW graph. If omitted - the collection configuration will be used
optional QuantizationConfig quantization_config = 4; // Configuration of vector quantization config. If omitted - the collection configuration will be used
optional bool on_disk = 5; // If true - serve vectors from disk. If set to false, the vectors will be loaded in RAM.
optional Datatype datatype = 6; // Data type of the vectors
}

message VectorParamsDiff {
Expand Down Expand Up @@ -93,6 +100,7 @@ enum CollectionStatus {
Green = 1; // All segments are ready
Yellow = 2; // Optimization in process
Red = 3; // Something went wrong
Grey = 4; // Optimization is pending
}

enum PayloadSchemaType {
Expand Down Expand Up @@ -448,9 +456,8 @@ enum ReplicaState {
Partial = 2; // The shard is partially loaded and is currently receiving data from other shards
Initializing = 3; // Collection is being created
Listener = 4; // A shard which receives data, but is not used for search; Useful for backup shards
PartialSnapshot = 5; // Snapshot shard transfer is in progress; Updates should not be sent to (and are ignored by) the shard
PartialSnapshot = 5; // Deprecated: snapshot shard transfer is in progress; Updates should not be sent to (and are ignored by) the shard
Recovery = 6; // Shard is undergoing recovered by an external node; Normally rejects updates, accepts updates if force is true
// TODO(1.9): deprecate PartialSnapshot state
}

message ShardKey {
Expand Down Expand Up @@ -496,6 +503,12 @@ message MoveShard {
optional ShardTransferMethod method = 4;
}

message AbortShardTransfer {
uint32 shard_id = 1; // Local shard id
uint64 from_peer_id = 2;
uint64 to_peer_id = 3;
}

message RestartTransfer {
uint32 shard_id = 1; // Local shard id
uint64 from_peer_id = 2;
Expand Down Expand Up @@ -530,7 +543,7 @@ message UpdateCollectionClusterSetupRequest {
oneof operation {
MoveShard move_shard = 2;
MoveShard replicate_shard = 3;
MoveShard abort_transfer = 4;
AbortShardTransfer abort_transfer = 4;
Replica drop_replica = 5;
CreateShardKey create_shard_key = 7;
DeleteShardKey delete_shard_key = 8;
Expand Down
1 change: 1 addition & 0 deletions proto/points.proto
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ enum UpdateStatus {
UnknownUpdateStatus = 0;
Acknowledged = 1; // Update is received, but not processed yet
Completed = 2; // Update is applied and ready for search
ClockRejected = 3; // Internal: update is rejected due to an outdated clock
}

message ScoredPoint {
Expand Down
9 changes: 6 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub struct QdrantClientConfig {
pub timeout: Duration,
pub connect_timeout: Duration,
pub keep_alive_while_idle: bool,

/// API key or token to use for authorization
pub api_key: Option<String>,
}

Expand Down Expand Up @@ -124,6 +126,7 @@ impl QdrantClientConfig {
}
}

/// Sets the API key or token
pub fn set_api_key(&mut self, api_key: &str) {
self.api_key = Some(api_key.to_string());
}
Expand All @@ -140,8 +143,8 @@ impl QdrantClientConfig {
self.keep_alive_while_idle = keep_alive_while_idle;
}

/// set the API key, builder-like. The API key argument can be any of
/// `&str`, `String`, `Option<&str>``, `Option<String>` or `Result<String>`.`
/// Set the API key or token, builder-like. The API key argument can be any of
/// `&str`, `String`, `Option<&str>`, `Option<String>` or `Result<String>`.
///
/// # Examples:
///
Expand Down Expand Up @@ -356,7 +359,7 @@ impl Interceptor for TokenInterceptor {
req.metadata_mut().insert(
"api-key",
api_key.parse().map_err(|_| {
Status::invalid_argument(format!("Malformed API key: {}", api_key))
Status::invalid_argument(format!("Malformed API key or token: {}", api_key))
})?,
);
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ mod tests {
hnsw_config: None,
quantization_config: None,
on_disk: None,
datatype: None,
})),
}),
..Default::default()
Expand Down
55 changes: 53 additions & 2 deletions src/qdrant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub struct VectorParams {
/// 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>,
/// Data type of the vectors
#[prost(enumeration = "Datatype", optional, tag = "6")]
pub datatype: ::core::option::Option<i32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -792,6 +795,17 @@ pub struct MoveShard {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AbortShardTransfer {
/// 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 RestartTransfer {
/// Local shard id
#[prost(uint32, tag = "1")]
Expand Down Expand Up @@ -861,7 +875,7 @@ pub mod update_collection_cluster_setup_request {
#[prost(message, tag = "3")]
ReplicateShard(super::MoveShard),
#[prost(message, tag = "4")]
AbortTransfer(super::MoveShard),
AbortTransfer(super::AbortShardTransfer),
#[prost(message, tag = "5")]
DropReplica(super::Replica),
#[prost(message, tag = "7")]
Expand Down Expand Up @@ -918,6 +932,35 @@ pub struct DeleteShardKeyResponse {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Datatype {
Default = 0,
Float32 = 1,
Uint8 = 2,
}
impl Datatype {
/// 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 {
Datatype::Default => "Default",
Datatype::Float32 => "Float32",
Datatype::Uint8 => "Uint8",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Default" => Some(Self::Default),
"Float32" => Some(Self::Float32),
"Uint8" => Some(Self::Uint8),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Distance {
UnknownDistance = 0,
Cosine = 1,
Expand Down Expand Up @@ -961,6 +1004,8 @@ pub enum CollectionStatus {
Yellow = 2,
/// Something went wrong
Red = 3,
/// Optimization is pending
Grey = 4,
}
impl CollectionStatus {
/// String value of the enum field names used in the ProtoBuf definition.
Expand All @@ -973,6 +1018,7 @@ impl CollectionStatus {
CollectionStatus::Green => "Green",
CollectionStatus::Yellow => "Yellow",
CollectionStatus::Red => "Red",
CollectionStatus::Grey => "Grey",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -982,6 +1028,7 @@ impl CollectionStatus {
"Green" => Some(Self::Green),
"Yellow" => Some(Self::Yellow),
"Red" => Some(Self::Red),
"Grey" => Some(Self::Grey),
_ => None,
}
}
Expand Down Expand Up @@ -1167,7 +1214,7 @@ pub enum ReplicaState {
Initializing = 3,
/// A shard which receives data, but is not used for search; Useful for backup shards
Listener = 4,
/// Snapshot shard transfer is in progress; Updates should not be sent to (and are ignored by) the shard
/// Deprecated: snapshot shard transfer is in progress; Updates should not be sent to (and are ignored by) the shard
PartialSnapshot = 5,
/// Shard is undergoing recovered by an external node; Normally rejects updates, accepts updates if force is true
Recovery = 6,
Expand Down Expand Up @@ -4258,6 +4305,8 @@ pub enum UpdateStatus {
Acknowledged = 1,
/// Update is applied and ready for search
Completed = 2,
/// Internal: update is rejected due to an outdated clock
ClockRejected = 3,
}
impl UpdateStatus {
/// String value of the enum field names used in the ProtoBuf definition.
Expand All @@ -4269,6 +4318,7 @@ impl UpdateStatus {
UpdateStatus::UnknownUpdateStatus => "UnknownUpdateStatus",
UpdateStatus::Acknowledged => "Acknowledged",
UpdateStatus::Completed => "Completed",
UpdateStatus::ClockRejected => "ClockRejected",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -4277,6 +4327,7 @@ impl UpdateStatus {
"UnknownUpdateStatus" => Some(Self::UnknownUpdateStatus),
"Acknowledged" => Some(Self::Acknowledged),
"Completed" => Some(Self::Completed),
"ClockRejected" => Some(Self::ClockRejected),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function stop_docker()
# Ensure current path is project root
cd "$(dirname "$0")/../"

QDRANT_VERSION='v1.8.0'
QDRANT_VERSION='v1.9.0'

QDRANT_HOST='localhost:6333'

Expand Down

0 comments on commit 3a889a8

Please sign in to comment.