diff --git a/Cargo.toml b/Cargo.toml index 843b32ae..a661d317 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,10 +43,6 @@ uuid = ["dep:uuid"] name = "query" required-features = ["serde"] -[[example]] -name = "deprecated_search" -required-features = ["serde"] - [package.metadata.docs.rs] features = ["download_snapshots", "serde"] no-default-features = true diff --git a/examples/deprecated_search.rs b/examples/deprecated_search.rs deleted file mode 100644 index 162332e7..00000000 --- a/examples/deprecated_search.rs +++ /dev/null @@ -1,120 +0,0 @@ -use anyhow::Result; -#[allow(deprecated)] -use qdrant_client::prelude::*; -use qdrant_client::qdrant::vectors_config::Config; -use qdrant_client::qdrant::{ - Condition, CreateCollection, Filter, SearchPoints, VectorParams, VectorsConfig, -}; -use serde_json::json; - -#[allow(deprecated)] -#[tokio::main] -async fn main() -> Result<()> { - // Example of top level client - // You may also use tonic-generated client from `src/qdrant.rs` - let config = QdrantClientConfig::from_url("http://localhost:6334"); - let client = QdrantClient::new(Some(config))?; - - let collections_list = client.list_collections().await?; - dbg!(collections_list); - // collections_list = ListCollectionsResponse { - // collections: [ - // CollectionDescription { - // name: "test", - // }, - // ], - // time: 1.78e-6, - // } - - let collection_name = "test"; - client.delete_collection(collection_name).await?; - - client - .create_collection(&CreateCollection { - collection_name: collection_name.into(), - vectors_config: Some(VectorsConfig { - config: Some(Config::Params(VectorParams { - size: 10, - distance: Distance::Cosine.into(), - ..Default::default() - })), - }), - ..Default::default() - }) - .await?; - - let collection_info = client.collection_info(collection_name).await?; - dbg!(collection_info); - - let payload: Payload = json!( - { - "foo": "Bar", - "bar": 12, - "baz": { - "qux": "quux" - } - } - ) - .try_into() - .unwrap(); - - let points = vec![PointStruct::new(0, vec![12.; 10], payload)]; - client - .upsert_points_blocking(collection_name, None, points, None) - .await?; - - let search_result = client - .search_points(&SearchPoints { - collection_name: collection_name.into(), - vector: vec![11.; 10], - filter: Some(Filter::all([Condition::matches("bar", 12)])), - limit: 10, - with_payload: Some(true.into()), - ..Default::default() - }) - .await?; - dbg!(&search_result); - // search_result = SearchResponse { - // result: [ - // ScoredPoint { - // id: Some( - // PointId { - // point_id_options: Some( - // Num( - // 0, - // ), - // ), - // }, - // ), - // payload: { - // "bar": Value { - // kind: Some( - // IntegerValue( - // 12, - // ), - // ), - // }, - // "foo": Value { - // kind: Some( - // StringValue( - // "Bar", - // ), - // ), - // }, - // }, - // score: 1.0000001, - // version: 0, - // vectors: None, - // }, - // ], - // time: 9.5394e-5, - // } - - let found_point = search_result.result.into_iter().next().unwrap(); - let mut payload = found_point.payload; - let baz_payload = payload.remove("baz").unwrap().into_json(); - println!("baz: {baz_payload}"); - // baz: {"qux":"quux"} - - Ok(()) -} diff --git a/src/client/collection.rs b/src/client/collection.rs deleted file mode 100644 index fb369181..00000000 --- a/src/client/collection.rs +++ /dev/null @@ -1,429 +0,0 @@ -use std::future::Future; - -use tonic::codegen::InterceptedService; -use tonic::transport::Channel; -use tonic::Status; - -use crate::auth::TokenInterceptor; -use crate::client::QdrantClient; -use crate::qdrant::alias_operations::Action; -use crate::qdrant::collections_client::CollectionsClient; -use crate::qdrant::update_collection_cluster_setup_request::Operation; -use crate::qdrant::{ - shard_key, AliasOperations, ChangeAliases, CollectionClusterInfoRequest, - CollectionClusterInfoResponse, CollectionExistsRequest, CollectionOperationResponse, - CollectionParamsDiff, CreateAlias, CreateCollection, CreateShardKey, CreateShardKeyRequest, - CreateShardKeyResponse, DeleteAlias, DeleteCollection, DeleteShardKey, DeleteShardKeyRequest, - DeleteShardKeyResponse, GetCollectionInfoRequest, GetCollectionInfoResponse, HnswConfigDiff, - ListAliasesRequest, ListAliasesResponse, ListCollectionAliasesRequest, ListCollectionsRequest, - ListCollectionsResponse, OptimizersConfigDiff, QuantizationConfigDiff, RenameAlias, ShardKey, - SparseVectorConfig, UpdateCollection, UpdateCollectionClusterSetupRequest, - UpdateCollectionClusterSetupResponse, VectorsConfigDiff, -}; - -impl QdrantClient { - // Access to raw collection API - pub async fn with_collections_client>>( - &self, - f: impl Fn(CollectionsClient>) -> O, - ) -> anyhow::Result { - self.channel - .with_channel( - |channel| { - let service = self.with_api_key(channel); - let mut client = - CollectionsClient::new(service).max_decoding_message_size(usize::MAX); - if let Some(compression) = self.cfg.compression { - client = client - .send_compressed(compression.into()) - .accept_compressed(compression.into()); - } - f(client) - }, - false, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::list_collections` instead" - )] - pub async fn list_collections(&self) -> anyhow::Result { - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api.list(ListCollectionsRequest {}).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.8.0", - note = "use new `qdrant_client::Qdrant::collection_exists` instead" - )] - pub async fn has_collection(&self, collection_name: impl ToString) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let response = self.list_collections().await?; - let result = response - .collections - .into_iter() - .any(|c| c.name == collection_name); - - Ok(result) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::collection_exists` instead" - )] - pub async fn collection_exists(&self, collection_name: impl ToString) -> anyhow::Result { - let collection_name_ref = &collection_name.to_string(); - Ok(self - .with_collections_client(|mut collection_api| async move { - let request = CollectionExistsRequest { - collection_name: collection_name_ref.clone(), - }; - let result = collection_api.collection_exists(request).await?; - Ok(result - .into_inner() - .result - .map(|r| r.exists) - .unwrap_or(false)) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_collection` instead" - )] - pub async fn create_collection( - &self, - details: &CreateCollection, - ) -> anyhow::Result { - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api.create(details.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[allow(clippy::too_many_arguments)] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_collection` instead" - )] - pub async fn update_collection( - &self, - collection_name: impl ToString, - optimizers_config: Option<&OptimizersConfigDiff>, - params: Option<&CollectionParamsDiff>, - sparse_vectors_config: Option<&SparseVectorConfig>, - hnsw_config: Option<&HnswConfigDiff>, - vectors_config: Option<&VectorsConfigDiff>, - quantization_config: Option<&QuantizationConfigDiff>, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .update(UpdateCollection { - collection_name: collection_name_ref.to_string(), - optimizers_config: optimizers_config.cloned(), - timeout: None, - params: params.cloned(), - sparse_vectors_config: sparse_vectors_config.cloned(), - hnsw_config: hnsw_config.cloned(), - vectors_config: vectors_config.cloned(), - quantization_config: quantization_config.cloned(), - strict_mode_config: None, - metadata: Default::default(), - }) - .await?; - - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_collection` instead" - )] - pub async fn delete_collection( - &self, - collection_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .delete(DeleteCollection { - collection_name: collection_name_ref.to_string(), - ..Default::default() - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::collection_info` instead" - )] - pub async fn collection_info( - &self, - collection_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .get(GetCollectionInfoRequest { - collection_name: collection_name_ref.to_string(), - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_alias` instead" - )] - pub async fn create_alias( - &self, - collection_name: impl ToString, - alias_name: impl ToString, - ) -> anyhow::Result { - let create_alias = CreateAlias { - collection_name: collection_name.to_string(), - alias_name: alias_name.to_string(), - }; - let change_aliases = ChangeAliases { - actions: vec![AliasOperations { - action: Some(Action::CreateAlias(create_alias)), - }], - timeout: None, - }; - self.update_aliases(change_aliases).await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_alias` instead" - )] - pub async fn delete_alias( - &self, - alias_name: impl ToString, - ) -> anyhow::Result { - let delete_alias = DeleteAlias { - alias_name: alias_name.to_string(), - }; - let change_aliases = ChangeAliases { - actions: vec![AliasOperations { - action: Some(Action::DeleteAlias(delete_alias)), - }], - timeout: None, - }; - self.update_aliases(change_aliases).await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::rename_alias` instead" - )] - pub async fn rename_alias( - &self, - old_alias_name: impl ToString, - new_alias_name: impl ToString, - ) -> anyhow::Result { - let rename_alias = RenameAlias { - old_alias_name: old_alias_name.to_string(), - new_alias_name: new_alias_name.to_string(), - }; - let change_aliases = ChangeAliases { - actions: vec![AliasOperations { - action: Some(Action::RenameAlias(rename_alias)), - }], - timeout: None, - }; - self.update_aliases(change_aliases).await - } - - // lower level API - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_alias`, `qdrant_client::Qdrant::rename_alias` or `qdrant_client::Qdrant::delete_alias` instead" - )] - pub async fn update_aliases( - &self, - change_aliases: ChangeAliases, - ) -> anyhow::Result { - let change_aliases = change_aliases.clone(); - let chang_aliases_ref = &change_aliases; - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .update_aliases(chang_aliases_ref.clone()) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::list_collection_aliases` instead" - )] - pub async fn list_collection_aliases( - &self, - collection_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .list_collection_aliases(ListCollectionAliasesRequest { - collection_name: collection_name_ref.to_string(), - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::list_aliases` instead" - )] - pub async fn list_aliases(&self) -> anyhow::Result { - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api.list_aliases(ListAliasesRequest {}).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::collection_cluster_info` instead" - )] - pub async fn collection_cluster_info( - &self, - collection_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - - Ok(self - .with_collections_client(|mut collection_api| async move { - let request = CollectionClusterInfoRequest { - collection_name: collection_name_ref.to_string(), - }; - let result = collection_api.collection_cluster_info(request).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_shard_key` instead" - )] - pub async fn create_shard_key( - &self, - collection_name: impl AsRef, - shard_key: &shard_key::Key, - shards_number: Option, - replication_factor: Option, - placement: &[u64], - ) -> anyhow::Result { - let collection_name = collection_name.as_ref(); - - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .create_shard_key(CreateShardKeyRequest { - collection_name: collection_name.to_string(), - request: Some(CreateShardKey { - shard_key: Some(ShardKey::from(shard_key.clone())), - shards_number, - replication_factor, - placement: placement.to_vec(), - initial_state: None, - }), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_shard_key` instead" - )] - pub async fn delete_shard_key( - &self, - collection_name: impl AsRef, - shard_key: &shard_key::Key, - ) -> anyhow::Result { - let collection_name = collection_name.as_ref(); - - Ok(self - .with_collections_client(|mut collection_api| async move { - let result = collection_api - .delete_shard_key(DeleteShardKeyRequest { - collection_name: collection_name.to_string(), - request: Some(DeleteShardKey { - shard_key: Some(ShardKey::from(shard_key.clone())), - }), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_collection_cluster_setup` instead" - )] - pub async fn update_collection_cluster_setup( - &self, - collection_name: impl ToString, - operation: Operation, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let operation_ref = &operation; - Ok(self - .with_collections_client(|mut collection_api| async move { - let request = UpdateCollectionClusterSetupRequest { - collection_name: collection_name_ref.to_string(), - timeout: None, - operation: Some(operation_ref.clone()), - }; - let result = collection_api - .update_collection_cluster_setup(request) - .await?; - Ok(result.into_inner()) - }) - .await?) - } -} diff --git a/src/client/config.rs b/src/client/config.rs deleted file mode 100644 index ad3fcd8c..00000000 --- a/src/client/config.rs +++ /dev/null @@ -1,212 +0,0 @@ -#![allow(deprecated)] - -use std::time::Duration; - -use crate::client::QdrantClient; - -#[deprecated( - since = "1.10.0", - note = "use new config at `qdrant_client::config::QdrantConfig` instead" -)] -pub struct QdrantClientConfig { - pub uri: String, - pub timeout: Duration, - pub connect_timeout: Duration, - pub keep_alive_while_idle: bool, - pub api_key: Option, - pub compression: Option, -} - -impl QdrantClientConfig { - pub fn from_url(url: &str) -> Self { - QdrantClientConfig { - uri: url.to_string(), - ..Self::default() - } - } - - /// Sets the API key or token - pub fn set_api_key(&mut self, api_key: &str) { - self.api_key = Some(api_key.to_string()); - } - - pub fn set_timeout(&mut self, timeout: Duration) { - self.timeout = timeout; - } - - pub fn set_connect_timeout(&mut self, connect_timeout: Duration) { - self.connect_timeout = connect_timeout; - } - - pub fn set_keep_alive_while_idle(&mut self, keep_alive_while_idle: bool) { - self.keep_alive_while_idle = keep_alive_while_idle; - } - - pub fn set_compression(&mut self, compression: Option) { - self.compression = compression; - } - - /// set the API key, builder-like. The API key argument can be any of - /// `&str`, `String`, `Option<&str>`, `Option` or `Result`. - /// - /// # Examples: - /// - /// A typical use case might be getting the key from an env var: - /// ```rust, no_run - /// use qdrant_client::prelude::*; - /// - /// let client = QdrantClient::from_url("localhost:6334") - /// .with_api_key(std::env::var("QDRANT_API_KEY")) - /// .build(); - /// ``` - /// Another possibility might be getting it out of some config - /// ```rust, no_run - /// use qdrant_client::prelude::*; - ///# use std::collections::HashMap; - ///# let config: HashMap<&str, String> = HashMap::new(); - /// let client = QdrantClientConfig::from_url("localhost:6334") - /// .with_api_key(config.get("api_key")) - /// .build(); - /// ``` - #[deprecated( - since = "1.10.0", - note = "use `qdrant_client::config::QdrantConfig::api_key` instead" - )] - pub fn with_api_key(mut self, api_key: impl MaybeApiKey) -> Self { - self.api_key = api_key.maybe_key(); - self - } - - /// Configure the service to keep the connection alive while idle - pub fn keep_alive_while_idle(mut self) -> Self { - self.keep_alive_while_idle = true; - self - } - - /// Set the timeout for this client - #[deprecated( - since = "1.10.0", - note = "use `qdrant_client::config::QdrantConfig::timeout` instead" - )] - pub fn with_timeout(mut self, timeout: impl AsTimeout) -> Self { - self.timeout = timeout.timeout(); - self - } - - /// Set the connect timeout for this client - #[deprecated( - since = "1.10.0", - note = "use `qdrant_client::config::QdrantConfig::connect_timeout` instead" - )] - pub fn with_connect_timeout(mut self, timeout: impl AsTimeout) -> Self { - self.connect_timeout = timeout.timeout(); - self - } - - /// Set the compression to use for this client - #[deprecated( - since = "1.10.0", - note = "use `qdrant_client::config::QdrantConfig::compression` instead" - )] - pub fn with_compression(mut self, compression: Option) -> Self { - self.compression = compression; - self - } - - /// Build the QdrantClient - pub fn build(self) -> anyhow::Result { - QdrantClient::new(Some(self)) - } -} - -impl Default for QdrantClientConfig { - fn default() -> Self { - Self { - uri: String::from("http://localhost:6334"), - timeout: Duration::from_secs(5), - connect_timeout: Duration::from_secs(5), - keep_alive_while_idle: true, - api_key: None, - compression: None, - } - } -} - -/// The type of compression to use for requests. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum CompressionEncoding { - Gzip, -} - -impl From for tonic::codec::CompressionEncoding { - fn from(encoding: CompressionEncoding) -> Self { - match encoding { - CompressionEncoding::Gzip => tonic::codec::CompressionEncoding::Gzip, - } - } -} - -#[deprecated( - since = "1.10.0", - note = "use `qdrant_client::config::AsTimeout` instead" -)] -pub trait AsTimeout { - fn timeout(self) -> Duration; -} - -impl AsTimeout for Duration { - fn timeout(self) -> Duration { - self - } -} - -impl AsTimeout for u64 { - fn timeout(self) -> Duration { - Duration::from_secs(self) - } -} - -/// Helper type to allow setting an API key from various types -#[deprecated( - since = "1.10.0", - note = "use `qdrant_client::config::AsOptionApiKey` instead" -)] -pub trait MaybeApiKey { - fn maybe_key(self) -> Option; -} - -impl MaybeApiKey for &str { - fn maybe_key(self) -> Option { - Some(self.to_string()) - } -} - -impl MaybeApiKey for String { - fn maybe_key(self) -> Option { - Some(self) - } -} - -impl MaybeApiKey for Option { - fn maybe_key(self) -> Option { - self - } -} - -impl MaybeApiKey for Option<&String> { - fn maybe_key(self) -> Option { - self.map(ToOwned::to_owned) - } -} - -impl MaybeApiKey for Option<&str> { - fn maybe_key(self) -> Option { - self.map(ToOwned::to_owned) - } -} - -impl MaybeApiKey for Result { - fn maybe_key(self) -> Option { - self.ok() - } -} diff --git a/src/client/mod.rs b/src/client/mod.rs deleted file mode 100644 index eeb45b38..00000000 --- a/src/client/mod.rs +++ /dev/null @@ -1,117 +0,0 @@ -#![allow(deprecated)] - -pub mod collection; -#[deprecated( - since = "1.10.0", - note = "use new config types at `qdrant_client::config` instead" -)] -mod config; -pub mod points; -pub mod snapshot; - -use std::future::Future; - -use anyhow::Result; -pub use config::{AsTimeout, CompressionEncoding, MaybeApiKey, QdrantClientConfig}; -use tonic::codegen::InterceptedService; -use tonic::transport::{Channel, Uri}; -use tonic::Status; - -pub use crate::auth::TokenInterceptor; -use crate::channel_pool::ChannelPool; -pub use crate::payload::Payload; -use crate::qdrant::{qdrant_client, HealthCheckReply, HealthCheckRequest}; - -/// A builder for `QdrantClient`s -#[deprecated(since = "1.10.0", note = "use `qdrant_client::QdrantBuilder` instead")] -pub type QdrantClientBuilder = QdrantClientConfig; - -/// Deprecated Qdrant client -/// -/// # Deprecated -/// -/// This client is deprecated. -/// -/// Please switch to the new [`Qdrant`](crate::Qdrant) client. It is easier to use and provides a -/// more robust interface. -/// -/// See examples at the [crate root](crate) or at each individual [`Qdrant`](crate::Qdrant) -/// operation. -#[deprecated(since = "1.10.0", note = "use `qdrant_client::Qdrant` instead")] -pub struct QdrantClient { - pub channel: ChannelPool, - pub cfg: QdrantClientConfig, -} - -impl QdrantClient { - /// Create a builder to setup the client - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::from_url` instead" - )] - pub fn from_url(url: &str) -> QdrantClientBuilder { - QdrantClientBuilder::from_url(url) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::new` instead" - )] - pub fn new(cfg: Option) -> Result { - let cfg = cfg.unwrap_or_default(); - - let channel = ChannelPool::new( - cfg.uri.parse::()?, - cfg.timeout, - cfg.connect_timeout, - cfg.keep_alive_while_idle, - 1, - ); - - let client = Self { channel, cfg }; - - Ok(client) - } - - /// Wraps a channel with a token interceptor - fn with_api_key(&self, channel: Channel) -> InterceptedService { - let interceptor = TokenInterceptor::new(self.cfg.api_key.clone()); - InterceptedService::new(channel, interceptor) - } - - // Access to raw root qdrant API - pub async fn with_root_qdrant_client>>( - &self, - f: impl Fn(qdrant_client::QdrantClient>) -> O, - ) -> Result { - self.channel - .with_channel( - |channel| { - let service = self.with_api_key(channel); - let mut client = qdrant_client::QdrantClient::new(service) - .max_decoding_message_size(usize::MAX); - if let Some(compression) = self.cfg.compression { - client = client - .send_compressed(compression.into()) - .accept_compressed(compression.into()); - } - f(client) - }, - true, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::health_check` instead" - )] - pub async fn health_check(&self) -> Result { - Ok(self - .with_root_qdrant_client(|mut qdrant_api| async move { - let result = qdrant_api.health_check(HealthCheckRequest {}).await?; - Ok(result.into_inner()) - }) - .await?) - } -} diff --git a/src/client/points.rs b/src/client/points.rs deleted file mode 100644 index 87794ce7..00000000 --- a/src/client/points.rs +++ /dev/null @@ -1,1258 +0,0 @@ -use std::future::Future; - -use tonic::codegen::InterceptedService; -use tonic::transport::Channel; -use tonic::Status; - -use crate::auth::TokenInterceptor; -use crate::client::{Payload, QdrantClient}; -use crate::prelude::{PointStruct, SearchPoints}; -use crate::qdrant::points_client::PointsClient; -use crate::qdrant::{ - shard_key, ClearPayloadPoints, CountPoints, CountResponse, CreateFieldIndexCollection, - DeleteFieldIndexCollection, DeletePayloadPoints, DeletePointVectors, DeletePoints, - DiscoverBatchPoints, DiscoverBatchResponse, DiscoverPoints, DiscoverResponse, FieldType, - GetPoints, GetResponse, PayloadIndexParams, PointId, PointVectors, PointsOperationResponse, - PointsSelector, PointsUpdateOperation, ReadConsistency, RecommendBatchPoints, - RecommendBatchResponse, RecommendGroupsResponse, RecommendPointGroups, RecommendPoints, - RecommendResponse, ScrollPoints, ScrollResponse, SearchBatchPoints, SearchBatchResponse, - SearchGroupsResponse, SearchPointGroups, SearchResponse, SetPayloadPoints, ShardKeySelector, - UpdateBatchPoints, UpdateBatchResponse, UpdatePointVectors, UpsertPoints, Usage, - VectorsSelector, WithPayloadSelector, WithVectorsSelector, WriteOrdering, -}; - -impl QdrantClient { - // Access to raw points API - pub async fn with_points_client>>( - &self, - f: impl Fn(PointsClient>) -> O, - ) -> anyhow::Result { - self.channel - .with_channel( - |channel| { - let service = self.with_api_key(channel); - let mut client = - PointsClient::new(service).max_decoding_message_size(usize::MAX); - if let Some(compression) = self.cfg.compression { - client = client - .send_compressed(compression.into()) - .accept_compressed(compression.into()); - } - f(client) - }, - true, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_points_batch` instead" - )] - async fn _batch_updates( - &self, - collection_name: impl ToString, - operations: &[PointsUpdateOperation], - ordering: Option, - wait: bool, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - Ok(self - .with_points_client(|mut points_api| async move { - Ok(points_api - .update_batch(UpdateBatchPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(wait), - operations: operations.to_vec(), - ordering: ordering_ref.cloned(), - timeout: None, - }) - .await? - .into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_points_batch` instead" - )] - pub async fn batch_updates( - &self, - collection_name: impl ToString, - operations: &[PointsUpdateOperation], - ordering: Option, - ) -> anyhow::Result { - self._batch_updates(collection_name, operations, ordering, false) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_points_batch` instead" - )] - pub async fn batch_updates_blocking( - &self, - collection_name: impl ToString, - operations: &[PointsUpdateOperation], - ordering: Option, - ) -> anyhow::Result { - self._batch_updates(collection_name, operations, ordering, true) - .await - } - - /// Insert or update points into the collection. - /// If points with given ID already exist, they will be overwritten. - /// This method does *not* wait for completion of the operation, use - /// [`upsert_points_blocking`](Self::upsert_points_blocking) for that. - /// Also this method does not split the points to insert to avoid timeouts, - /// look at [`upsert_points_batch`](Self::upsert_points_batch) for that. - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::upsert_points` instead" - )] - pub async fn upsert_points( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: Vec, - ordering: Option, - ) -> anyhow::Result { - self._upsert_points( - collection_name, - shard_key_selector, - &points, - false, - ordering, - ) - .await - } - - /// Insert or update points into the collection, wait for completion. - /// If points with given ID already exist, they will be overwritten. - /// This method does not split the points to insert to avoid timeouts, - /// look at [`upsert_points_batch`](Self::upsert_points_batch) for that. - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::upsert_points` instead" - )] - pub async fn upsert_points_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: Vec, - ordering: Option, - ) -> anyhow::Result { - self._upsert_points(collection_name, shard_key_selector, &points, true, ordering) - .await - } - - #[inline] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::upsert_points` instead" - )] - async fn _upsert_points( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &[PointStruct], - block: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - Ok(self - .with_points_client(|mut points_api| async move { - Ok(points_api - .upsert(UpsertPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(block), - points: points.to_vec(), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - update_filter: None, - timeout: None, - update_mode: None, - }) - .await? - .into_inner()) - }) - .await?) - } - - /// Insert or update points into the collection, splitting in chunks. - /// If points with given ID already exist, they will be overwritten. - /// This method does *not* wait for completion of the operation, use - /// [`upsert_points_batch_blocking`](Self::upsert_points_batch_blocking) for that. - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::upsert_points_batch` instead" - )] - pub async fn upsert_points_batch( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: Vec, - ordering: Option, - chunk_size: usize, - ) -> anyhow::Result { - self._upsert_points_batch( - collection_name, - shard_key_selector, - &points, - false, - ordering, - chunk_size, - ) - .await - } - - /// Insert or update points into the collection, splitting in chunks and - /// waiting for completion of each. - /// If points with given ID already exist, they will be overwritten. - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::upsert_points_batch` instead" - )] - pub async fn upsert_points_batch_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: Vec, - ordering: Option, - chunk_size: usize, - ) -> anyhow::Result { - self._upsert_points_batch( - collection_name, - shard_key_selector, - &points, - true, - ordering, - chunk_size, - ) - .await - } - - #[inline] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::upsert_points_batch` instead" - )] - async fn _upsert_points_batch( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &[PointStruct], - block: bool, - ordering: Option, - chunk_size: usize, - ) -> anyhow::Result { - if points.len() < chunk_size { - return self - ._upsert_points(collection_name, shard_key_selector, points, block, ordering) - .await; - } - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - Ok(self - .with_points_client(|mut points_api| async move { - let mut resp = PointsOperationResponse { - result: None, - time: 0.0, - usage: None, - }; - for chunk in points.chunks(chunk_size) { - let PointsOperationResponse { - result, - time, - usage, - } = points_api - .upsert(UpsertPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(block), - points: chunk.to_vec(), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - update_filter: None, - timeout: None, - update_mode: None, - }) - .await? - .into_inner(); - resp.result = result; - resp.time += time; - resp.usage = Usage::aggregate_opts(resp.usage, usage); - } - Ok(resp) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::set_payload` instead" - )] - pub async fn set_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - payload: Payload, - payload_key: Option, - ordering: Option, - ) -> anyhow::Result { - self._set_payload( - collection_name, - shard_key_selector, - points, - &payload, - payload_key, - false, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::set_payload` instead" - )] - pub async fn set_payload_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - payload: Payload, - payload_key: Option, - ordering: Option, - ) -> anyhow::Result { - self._set_payload( - collection_name, - shard_key_selector, - points, - &payload, - payload_key, - true, - ordering, - ) - .await - } - - #[inline] - #[allow(clippy::too_many_arguments)] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::set_payload` instead" - )] - async fn _set_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - payload: &Payload, - payload_key: Option, - block: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - let payload_key_ref = payload_key.as_ref(); - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .set_payload(SetPayloadPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(block), - payload: payload.0.clone(), - points_selector: Some(points.clone()), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - key: payload_key_ref.cloned(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::overwrite_payload` instead" - )] - pub async fn overwrite_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - payload: Payload, - payload_key: Option, - ordering: Option, - ) -> anyhow::Result { - self._overwrite_payload( - collection_name, - shard_key_selector, - points, - &payload, - payload_key, - false, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::overwrite_payload` instead" - )] - pub async fn overwrite_payload_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - payload: Payload, - payload_key: Option, - ordering: Option, - ) -> anyhow::Result { - self._overwrite_payload( - collection_name, - shard_key_selector, - points, - &payload, - payload_key, - true, - ordering, - ) - .await - } - - #[inline] - #[allow(clippy::too_many_arguments)] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::overwrite_payload` instead" - )] - async fn _overwrite_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - payload: &Payload, - payload_key: Option, - block: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - let payload_key_ref = payload_key.as_ref(); - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .overwrite_payload(SetPayloadPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(block), - payload: payload.0.clone(), - points_selector: Some(points.clone()), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - key: payload_key_ref.cloned(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_payload` instead" - )] - pub async fn delete_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - keys: Vec, - ordering: Option, - ) -> anyhow::Result { - self._delete_payload( - collection_name, - shard_key_selector, - points, - &keys, - false, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_payload` instead" - )] - pub async fn delete_payload_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - keys: Vec, - ordering: Option, - ) -> anyhow::Result { - self._delete_payload( - collection_name, - shard_key_selector, - points, - &keys, - true, - ordering, - ) - .await - } - - #[inline] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_payload` instead" - )] - async fn _delete_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - keys: &[String], - block: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .delete_payload(DeletePayloadPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(block), - keys: keys.to_owned(), - points_selector: Some(points.clone()), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::clear_payload` instead" - )] - pub async fn clear_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points_selector: Option, - ordering: Option, - ) -> anyhow::Result { - self._clear_payload( - collection_name, - shard_key_selector, - points_selector.as_ref(), - false, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::clear_payload` instead" - )] - pub async fn clear_payload_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points_selector: Option, - ordering: Option, - ) -> anyhow::Result { - self._clear_payload( - collection_name, - shard_key_selector, - points_selector.as_ref(), - true, - ordering, - ) - .await - } - - #[inline] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::clear_payload` instead" - )] - async fn _clear_payload( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points_selector: Option<&PointsSelector>, - block: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .clear_payload(ClearPayloadPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(block), - points: points_selector.cloned(), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::get_points` instead" - )] - pub async fn get_points( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &[PointId], - with_vectors: Option>, - with_payload: Option>, - read_consistency: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - - let with_vectors = with_vectors.map(|v| v.into()); - let with_payload = with_payload.map(|v| v.into()); - - let with_vectors_ref = with_vectors.as_ref(); - let with_payload_ref = with_payload.as_ref(); - let read_consistency_ref = read_consistency.as_ref(); - - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .get(GetPoints { - collection_name: collection_name_ref.to_string(), - ids: points.to_owned(), - with_payload: with_payload_ref.cloned(), - with_vectors: with_vectors_ref.cloned(), - read_consistency: read_consistency_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - timeout: None, - }) - .await?; - - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::search_points` instead" - )] - pub async fn search_points(&self, request: &SearchPoints) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.search(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::search_batch_points` instead" - )] - pub async fn search_batch_points( - &self, - request: &SearchBatchPoints, - ) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.search_batch(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::search_groups` instead" - )] - pub async fn search_groups( - &self, - request: &SearchPointGroups, - ) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.search_groups(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_points` instead" - )] - pub async fn delete_points( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - ordering: Option, - ) -> anyhow::Result { - self._delete_points(collection_name, shard_key_selector, false, points, ordering) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_points` instead" - )] - pub async fn delete_points_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &PointsSelector, - ordering: Option, - ) -> anyhow::Result { - self._delete_points(collection_name, shard_key_selector, true, points, ordering) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_points` instead" - )] - async fn _delete_points( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - blocking: bool, - points: &PointsSelector, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .delete(DeletePoints { - collection_name: collection_name_ref.to_string(), - wait: Some(blocking), - points: Some(points.clone()), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_vectors` instead" - )] - pub async fn delete_vectors( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points_selector: &PointsSelector, - vector_selector: &VectorsSelector, - ordering: Option, - ) -> anyhow::Result { - self._delete_vectors( - collection_name, - shard_key_selector, - false, - points_selector, - vector_selector, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_vectors` instead" - )] - pub async fn delete_vectors_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points_selector: &PointsSelector, - vector_selector: &VectorsSelector, - ordering: Option, - ) -> anyhow::Result { - self._delete_vectors( - collection_name, - shard_key_selector, - true, - points_selector, - vector_selector, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_vectors` instead" - )] - async fn _delete_vectors( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - blocking: bool, - points_selector: &PointsSelector, - vector_selector: &VectorsSelector, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .delete_vectors(DeletePointVectors { - collection_name: collection_name_ref.to_string(), - wait: Some(blocking), - points_selector: Some(points_selector.clone()), - vectors: Some(vector_selector.clone()), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_vectors` instead" - )] - pub async fn update_vectors( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &[PointVectors], - ordering: Option, - ) -> anyhow::Result { - self._update_vectors(collection_name, shard_key_selector, false, points, ordering) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_vectors` instead" - )] - pub async fn update_vectors_blocking( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - points: &[PointVectors], - ordering: Option, - ) -> anyhow::Result { - self._update_vectors(collection_name, shard_key_selector, true, points, ordering) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_vectors` instead" - )] - async fn _update_vectors( - &self, - collection_name: impl ToString, - shard_key_selector: Option>, - blocking: bool, - points: &[PointVectors], - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - let shard_keys = shard_key_selector.map(ShardKeySelector::from); - let shard_keys_ref = &shard_keys; - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .update_vectors(UpdatePointVectors { - collection_name: collection_name_ref.to_string(), - wait: Some(blocking), - points: points.to_owned(), - ordering: ordering_ref.cloned(), - shard_key_selector: shard_keys_ref.clone(), - update_filter: None, - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::scroll` instead" - )] - pub async fn scroll(&self, request: &ScrollPoints) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.scroll(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::recommend` instead" - )] - pub async fn recommend(&self, request: &RecommendPoints) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.recommend(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::recommend_batch` instead" - )] - pub async fn recommend_batch( - &self, - request: &RecommendBatchPoints, - ) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.recommend_batch(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::recommend_groups` instead" - )] - pub async fn recommend_groups( - &self, - request: &RecommendPointGroups, - ) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.recommend_groups(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::discover` instead" - )] - pub async fn discover(&self, request: &DiscoverPoints) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.discover(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::discover_batch` instead" - )] - pub async fn discover_batch( - &self, - request: &DiscoverBatchPoints, - ) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.discover_batch(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::count` instead" - )] - pub async fn count(&self, request: &CountPoints) -> anyhow::Result { - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api.count(request.clone()).await?; - Ok(result.into_inner()) - }) - .await?) - } - - /// Perform multiple point, vector and payload insert, update and delete operations in one request. - /// This method does *not* wait for completion of the operation, use - /// [`update_batch_points_blocking`](Self::update_batch_points_blocking) for that. - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_points_batch` instead" - )] - pub async fn update_batch_points( - &self, - collection_name: impl ToString, - operations: &[PointsUpdateOperation], - ordering: Option, - ) -> anyhow::Result { - self._update_batch_points(collection_name, false, operations, ordering) - .await - } - - /// Perform multiple point, vector and payload insert, update and delete operations in one request. - /// This method waits for completion on each operation. - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_points_batch` instead" - )] - pub async fn update_batch_points_blocking( - &self, - collection_name: impl ToString, - operations: &[PointsUpdateOperation], - ordering: Option, - ) -> anyhow::Result { - self._update_batch_points(collection_name, true, operations, ordering) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::update_points_batch` instead" - )] - async fn _update_batch_points( - &self, - collection_name: impl ToString, - blocking: bool, - operations: &[PointsUpdateOperation], - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let ordering_ref = ordering.as_ref(); - - Ok(self - .with_points_client(|mut points_api| async move { - let result = points_api - .update_batch(UpdateBatchPoints { - collection_name: collection_name_ref.to_string(), - wait: Some(blocking), - operations: operations.to_owned(), - ordering: ordering_ref.cloned(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - /// Create index for a payload field - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_field_index` instead" - )] - pub async fn _create_field_index( - &self, - collection_name: impl ToString, - field_name: impl ToString, - field_type: FieldType, - field_index_params: Option<&PayloadIndexParams>, - wait: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let field_name = field_name.to_string(); - let field_name_ref = field_name.as_str(); - let ordering_ref = ordering.as_ref(); - - Ok(self - .with_points_client(|mut client| async move { - let result = client - .create_field_index(CreateFieldIndexCollection { - collection_name: collection_name_ref.to_string(), - wait: Some(wait), - field_name: field_name_ref.to_string(), - field_type: Some(field_type.into()), - field_index_params: field_index_params.cloned(), - ordering: ordering_ref.cloned(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_field_index` instead" - )] - pub async fn create_field_index( - &self, - collection_name: impl ToString, - field_name: impl ToString, - field_type: FieldType, - field_index_params: Option<&PayloadIndexParams>, - ordering: Option, - ) -> anyhow::Result { - self._create_field_index( - collection_name, - field_name, - field_type, - field_index_params, - false, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_field_index` instead" - )] - pub async fn create_field_index_blocking( - &self, - collection_name: impl ToString, - field_name: impl ToString, - field_type: FieldType, - field_index_params: Option<&PayloadIndexParams>, - ordering: Option, - ) -> anyhow::Result { - self._create_field_index( - collection_name, - field_name, - field_type, - field_index_params, - true, - ordering, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_field_index` instead" - )] - pub async fn _delete_field_index( - &self, - collection_name: impl ToString, - field_name: impl ToString, - wait: bool, - ordering: Option, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let field_name = field_name.to_string(); - let field_name_ref = field_name.as_str(); - let ordering_ref = ordering.as_ref(); - - Ok(self - .with_points_client(|mut client| async move { - let result = client - .delete_field_index(DeleteFieldIndexCollection { - collection_name: collection_name_ref.to_string(), - wait: Some(wait), - field_name: field_name_ref.to_string(), - ordering: ordering_ref.cloned(), - timeout: None, - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_field_index` instead" - )] - pub async fn delete_field_index( - &self, - collection_name: impl ToString, - field_name: impl ToString, - ordering: Option, - ) -> anyhow::Result { - self._delete_field_index(collection_name, field_name, false, ordering) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_field_index` instead" - )] - pub async fn delete_field_index_blocking( - &self, - collection_name: impl ToString, - field_name: impl ToString, - ordering: Option, - ) -> anyhow::Result { - self._delete_field_index(collection_name, field_name, true, ordering) - .await - } -} diff --git a/src/client/snapshot.rs b/src/client/snapshot.rs deleted file mode 100644 index b595d208..00000000 --- a/src/client/snapshot.rs +++ /dev/null @@ -1,220 +0,0 @@ -use std::future::Future; -#[cfg(feature = "download_snapshots")] -use std::path::PathBuf; - -use tonic::codegen::InterceptedService; -use tonic::transport::Channel; -use tonic::Status; - -use crate::auth::TokenInterceptor; -use crate::client::QdrantClient; -use crate::qdrant::snapshots_client::SnapshotsClient; -use crate::qdrant::{ - CreateFullSnapshotRequest, CreateSnapshotRequest, CreateSnapshotResponse, - DeleteFullSnapshotRequest, DeleteSnapshotRequest, DeleteSnapshotResponse, - ListFullSnapshotsRequest, ListSnapshotsRequest, ListSnapshotsResponse, -}; - -impl QdrantClient { - pub async fn with_snapshot_client>>( - &self, - f: impl Fn(SnapshotsClient>) -> O, - ) -> anyhow::Result { - self.channel - .with_channel( - |channel| { - let service = self.with_api_key(channel); - let mut client = - SnapshotsClient::new(service).max_decoding_message_size(usize::MAX); - if let Some(compression) = self.cfg.compression { - client = client - .send_compressed(compression.into()) - .accept_compressed(compression.into()); - } - f(client) - }, - false, - ) - .await - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_snapshot` instead" - )] - pub async fn create_snapshot( - &self, - collection_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - Ok(self - .with_snapshot_client(|mut client| async move { - let result = client - .create(CreateSnapshotRequest { - collection_name: collection_name_ref.to_string(), - }) - .await?; - - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::list_snapshot` instead" - )] - pub async fn list_snapshots( - &self, - collection_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - Ok(self - .with_snapshot_client(|mut client| async move { - let result = client - .list(ListSnapshotsRequest { - collection_name: collection_name_ref.to_string(), - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_snapshot` instead" - )] - pub async fn delete_snapshot( - &self, - collection_name: impl ToString, - snapshot_name: impl ToString, - ) -> anyhow::Result { - let collection_name = collection_name.to_string(); - let collection_name_ref = collection_name.as_str(); - let snapshot_name = snapshot_name.to_string(); - let snapshot_name_ref = snapshot_name.as_str(); - Ok(self - .with_snapshot_client(|mut client| async move { - let result = client - .delete(DeleteSnapshotRequest { - collection_name: collection_name_ref.to_string(), - snapshot_name: snapshot_name_ref.to_string(), - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::create_full_snapshot` instead" - )] - pub async fn create_full_snapshot(&self) -> anyhow::Result { - Ok(self - .with_snapshot_client(|mut client| async move { - let result = client.create_full(CreateFullSnapshotRequest {}).await?; - - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::list_full_snapshots` instead" - )] - pub async fn list_full_snapshots(&self) -> anyhow::Result { - Ok(self - .with_snapshot_client(|mut client| async move { - let result = client.list_full(ListFullSnapshotsRequest {}).await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::delete_full_snapshot` instead" - )] - pub async fn delete_full_snapshot( - &self, - snapshot_name: impl ToString, - ) -> anyhow::Result { - let snapshot_name = snapshot_name.to_string(); - let snapshot_name_ref = snapshot_name.as_str(); - Ok(self - .with_snapshot_client(|mut client| async move { - let result = client - .delete_full(DeleteFullSnapshotRequest { - snapshot_name: snapshot_name_ref.to_string(), - }) - .await?; - Ok(result.into_inner()) - }) - .await?) - } - - #[cfg(feature = "download_snapshots")] - #[deprecated( - since = "1.10.0", - note = "use new `qdrant_client::Qdrant::download_snapshot` instead" - )] - pub async fn download_snapshot( - &self, - out_path: impl Into, - collection_name: T, - snapshot_name: Option, - rest_api_uri: Option, - ) -> anyhow::Result<()> - where - T: ToString + Clone, - { - use std::io::Write; - - use futures_util::StreamExt; - - let snapshot_name = match snapshot_name { - Some(sn) => sn.to_string(), - _ => match self - .list_snapshots(collection_name.clone()) - .await? - .snapshot_descriptions - .first() - { - Some(sn) => sn.name.clone(), - _ => anyhow::bail!( - "No snapshots found for collection {}", - collection_name.to_string() - ), - }, - }; - - let mut stream = reqwest::get(format!( - "{}/collections/{}/snapshots/{}", - rest_api_uri - .map(|uri| uri.to_string()) - .unwrap_or_else(|| String::from("http://localhost:6333")), - collection_name.to_string(), - snapshot_name - )) - .await? - .bytes_stream(); - - let out_path = out_path.into(); - let _ = std::fs::remove_file(&out_path); - let mut file = std::fs::OpenOptions::new() - .write(true) - .create_new(true) - .open(out_path)?; - - while let Some(chunk) = stream.next().await { - let _written = file.write(&chunk?)?; - } - - Ok(()) - } -} diff --git a/src/error.rs b/src/error.rs deleted file mode 100644 index 962f2b31..00000000 --- a/src/error.rs +++ /dev/null @@ -1,158 +0,0 @@ -#![allow(deprecated)] - -use std::error::Error; -use std::fmt::{Debug, Display, Formatter}; -use std::marker::PhantomData; - -use crate::qdrant::value::Kind::*; -use crate::qdrant::{ListValue, Struct, Value}; - -/// An error for failed conversions (e.g. calling [`String::try_from(v)`](String::try_from) on an -/// integer [`Value`]) -#[deprecated(since = "1.10.0", note = "new functions don't use this type anymore")] -pub struct NotA { - marker: PhantomData, -} - -impl Default for NotA { - fn default() -> Self { - NotA { - marker: PhantomData, - } - } -} -impl Error for NotA {} - -impl Debug for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{self}") - } -} - -impl Display for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str("not a Struct") - } -} - -impl Error for NotA {} - -impl Debug for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{self}") - } -} - -impl Display for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str("not a ListValue") - } -} - -// Error + Conversion impl for bool -impl Error for NotA {} - -impl Debug for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{self}") - } -} - -impl Display for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str("not a bool") - } -} - -impl TryFrom for bool { - type Error = NotA; - - fn try_from(v: Value) -> Result> { - if let Some(BoolValue(t)) = v.kind { - Ok(t) - } else { - Err(NotA::default()) - } - } -} - -// Error + Conversion impl for i64 -impl Error for NotA {} - -impl Debug for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{self}") - } -} - -impl Display for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str("not an i64") - } -} - -impl TryFrom for i64 { - type Error = NotA; - - fn try_from(v: Value) -> Result> { - if let Some(IntegerValue(t)) = v.kind { - Ok(t) - } else { - Err(NotA::default()) - } - } -} - -// Error + Conversion impl for f64 -impl Error for NotA {} - -impl Debug for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{self}") - } -} - -impl Display for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str("not a f64") - } -} - -impl TryFrom for f64 { - type Error = NotA; - - fn try_from(v: Value) -> Result> { - if let Some(DoubleValue(t)) = v.kind { - Ok(t) - } else { - Err(NotA::default()) - } - } -} - -// Error + Conversion impl for string -impl Error for NotA {} - -impl Debug for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{self}") - } -} - -impl Display for NotA { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str("not a String") - } -} - -impl TryFrom for String { - type Error = NotA; - - fn try_from(v: Value) -> Result> { - if let Some(StringValue(t)) = v.kind { - Ok(t) - } else { - Err(NotA::default()) - } - } -} diff --git a/src/grpc_conversions/extensions.rs b/src/grpc_conversions/extensions.rs index 6e34b7ed..a7abdfc2 100644 --- a/src/grpc_conversions/extensions.rs +++ b/src/grpc_conversions/extensions.rs @@ -4,16 +4,13 @@ use std::hash::{Hash, Hasher}; #[cfg(feature = "uuid")] use uuid::Uuid; -use crate::client::Payload; -#[allow(deprecated)] -use crate::error::NotA; -use crate::prelude::{PointStruct, Value}; +use crate::payload::Payload; #[cfg(feature = "uuid")] use crate::qdrant::point_id::PointIdOptions; use crate::qdrant::value::Kind; use crate::qdrant::{ - HardwareUsage, InferenceUsage, ListValue, ModelUsage, PointId, RetrievedPoint, ScoredPoint, - Struct, Usage, Vectors, + HardwareUsage, InferenceUsage, ListValue, ModelUsage, PointId, PointStruct, RetrievedPoint, + ScoredPoint, Struct, Usage, Value, Vectors, }; /// Null value @@ -161,8 +158,7 @@ impl Value { /// /// ``` /// use serde_json::json; - /// use qdrant_client::prelude::*; - /// use qdrant_client::qdrant::{value::Kind::*, Struct}; + /// use qdrant_client::qdrant::{value::Kind::*, Struct, Value}; /// let value = Value { kind: Some(StructValue(Struct { /// fields: [ /// ("text".into(), Value { kind: Some(StringValue("Hi Qdrant!".into())) }), @@ -245,17 +241,6 @@ impl Value { } } - /// Try to get an iterator over the items of the contained list value, if any - #[deprecated(since = "1.10.0", note = "use `try_list_iter` instead")] - #[allow(deprecated)] - pub fn iter_list(&self) -> Result, NotA> { - if let Some(Kind::ListValue(values)) = &self.kind { - Ok(values.iter()) - } else { - Err(NotA::default()) - } - } - /// Get a value from a struct field /// /// Returns `None` if this is not a struct type or if the field is not present. @@ -266,17 +251,6 @@ impl Value { None } } - - /// Try to get a field from the struct if this value contains one - #[deprecated(since = "1.10.0", note = "use `get_value` instead")] - #[allow(deprecated)] - pub fn get_struct(&self, key: &str) -> Result<&Value, NotA> { - if let Some(Kind::StructValue(Struct { fields })) = &self.kind { - Ok(fields.get(key).unwrap_or(&NULL_VALUE)) - } else { - Err(NotA::default()) - } - } } impl std::ops::Deref for ListValue { diff --git a/src/grpc_conversions/mod.rs b/src/grpc_conversions/mod.rs index c4c1075d..43ba09cf 100644 --- a/src/grpc_conversions/mod.rs +++ b/src/grpc_conversions/mod.rs @@ -3,7 +3,7 @@ pub mod metadata; mod primitives; pub mod vectors; -use crate::client::Payload; +use crate::payload::Payload; use crate::qdrant::point_id::PointIdOptions; use crate::qdrant::points_selector::PointsSelectorOneOf; use crate::qdrant::value::Kind; diff --git a/src/grpc_conversions/primitives.rs b/src/grpc_conversions/primitives.rs index c37abbeb..4df69492 100644 --- a/src/grpc_conversions/primitives.rs +++ b/src/grpc_conversions/primitives.rs @@ -1,16 +1,15 @@ use std::collections::HashMap; -use crate::prelude::point_id::PointIdOptions; -use crate::prelude::{DeleteCollection, Value}; +use crate::qdrant::point_id::PointIdOptions; use crate::qdrant::value::Kind; use crate::qdrant::{ shard_key, with_payload_selector, with_vectors_selector, CollectionClusterInfoRequest, - CollectionExistsRequest, CreateSnapshotRequest, DeleteAlias, DeleteCollectionBuilder, - DeleteFullSnapshotRequest, GetCollectionInfoRequest, IsEmptyCondition, IsNullCondition, - ListCollectionAliasesRequest, ListShardKeysRequest, ListSnapshotsRequest, + CollectionExistsRequest, CreateSnapshotRequest, DeleteAlias, DeleteCollection, + DeleteCollectionBuilder, DeleteFullSnapshotRequest, GetCollectionInfoRequest, IsEmptyCondition, + IsNullCondition, ListCollectionAliasesRequest, ListShardKeysRequest, ListSnapshotsRequest, PayloadExcludeSelector, PayloadIncludeSelector, PointId, RepeatedIntegers, RepeatedStrings, ShardKey, ShardKeySelector, SparseIndices, SparseVectorConfig, SparseVectorParams, Struct, - VectorParams, VectorParamsDiff, VectorParamsDiffMap, VectorParamsMap, VectorsSelector, + Value, VectorParams, VectorParamsDiff, VectorParamsDiffMap, VectorParamsMap, VectorsSelector, WithPayloadSelector, WithVectorsSelector, }; diff --git a/src/lib.rs b/src/lib.rs index d2008004..b0cc2de7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -144,30 +144,8 @@ mod grpc_macros; mod manual_builder; mod payload; mod qdrant_client; -// Deprecated modules -/// Deprecated Qdrant client -#[deprecated( - since = "1.10.0", - note = "use new client at `qdrant_client::Qdrant` instead" -)] -#[doc(hidden)] -pub mod client; -/// Deprecated error type -#[deprecated( - since = "1.10.0", - note = "use new error type at `qdrant_client::Error` instead" -)] -#[doc(hidden)] -pub mod error; -/// Deprecated prelude -#[deprecated(since = "1.10.0", note = "use types directly")] -#[doc(hidden)] -pub mod prelude; -/// Deprecated serde helper #[cfg(feature = "serde")] -#[deprecated(since = "1.10.0", note = "use `Payload::try_from` instead")] -#[doc(hidden)] -pub mod serde; +mod serde_impl; #[cfg(feature = "serde")] pub mod serde_deser; diff --git a/src/payload.rs b/src/payload.rs index 75bdb088..c510e353 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -68,12 +68,6 @@ impl Payload { Self(HashMap::with_capacity(capacity)) } - /// Construct a payload object from the given hash map - #[deprecated(since = "1.10.0", note = "use `Payload::from` instead")] - pub fn new_from_hashmap(payload: HashMap) -> Self { - Self(payload) - } - /// Insert a payload value at the given key, replacing any existing value pub fn insert(&mut self, key: impl ToString, val: impl Into) { self.0.insert(key.to_string(), val.into()); @@ -244,8 +238,7 @@ impl From for Value { mod tests { use serde_json::json; - use super::*; - use crate::client::Payload; + use super::{Payload, *}; #[test] fn json_payload_round_trip() { diff --git a/src/prelude.rs b/src/prelude.rs deleted file mode 100644 index 912408ba..00000000 --- a/src/prelude.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![allow(deprecated)] - -pub use crate::client::*; -pub use crate::qdrant::{ - point_id, CreateCollection, DeleteCollection, Distance, PointStruct, SearchPoints, Value, -}; diff --git a/src/serde.rs b/src/serde_impl.rs similarity index 86% rename from src/serde.rs rename to src/serde_impl.rs index e5ee228f..b759e2de 100644 --- a/src/serde.rs +++ b/src/serde_impl.rs @@ -1,7 +1,4 @@ -#![allow(deprecated)] - use std::collections::HashMap; -use std::fmt::{Display, Formatter}; use serde::ser::{SerializeMap, SerializeSeq}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -9,24 +6,6 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use crate::qdrant::value::Kind; use crate::qdrant::{ListValue, Struct, Value}; -#[derive(Debug)] -#[deprecated( - since = "1.10.0", - note = "use `qdrant_client::Error::JsonToPayload` error variant instead" -)] -#[allow(dead_code)] -pub struct PayloadConversionError(serde_json::Value); - -impl Display for PayloadConversionError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!( - f, - "Failed to convert json {} to payload: expected object at the top level", - self.0 - ) - } -} - impl Serialize for Value { fn serialize(&self, serializer: S) -> Result where