Skip to content

Commit c3a957e

Browse files
committed
WIP
1 parent 509c5e8 commit c3a957e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/qdrant_client/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ pub struct QdrantConfig {
3434

3535
/// Optional compression schema to use for API requests
3636
pub compression: Option<CompressionEncoding>,
37+
38+
/// Whether to check compatibility between the client and server versions
39+
pub check_compatibility: bool,
40+
3741
}
3842

3943
impl QdrantConfig {
@@ -183,6 +187,7 @@ impl Default for QdrantConfig {
183187
keep_alive_while_idle: true,
184188
api_key: None,
185189
compression: None,
190+
check_compatibility: true,
186191
}
187192
}
188193
}

src/qdrant_client/mod.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ mod query;
1010
mod search;
1111
mod sharding_keys;
1212
mod snapshot;
13+
// mod version_check;
1314

1415
use std::future::Future;
15-
16+
// use tokio::runtime::Runtime;
1617
use tonic::codegen::InterceptedService;
1718
use tonic::transport::{Channel, Uri};
1819
use tonic::Status;
@@ -21,6 +22,7 @@ use crate::auth::TokenInterceptor;
2122
use crate::channel_pool::ChannelPool;
2223
use crate::qdrant::{qdrant_client, HealthCheckReply, HealthCheckRequest};
2324
use crate::qdrant_client::config::QdrantConfig;
25+
// use crate::qdrant_client::version_check::health_check_sync;
2426
use crate::QdrantError;
2527

2628
/// [`Qdrant`] client result
@@ -95,6 +97,7 @@ impl Qdrant {
9597
///
9698
/// Constructs the client and connects based on the given [`QdrantConfig`](config::QdrantConfig).
9799
pub fn new(config: QdrantConfig) -> QdrantResult<Self> {
100+
// let uri = config.uri.clone();
98101
let channel = ChannelPool::new(
99102
config.uri.parse::<Uri>()?,
100103
config.timeout,
@@ -104,6 +107,15 @@ impl Qdrant {
104107

105108
let client = Self { channel, config };
106109

110+
if client.config.check_compatibility {
111+
let client_version = env!("CARGO_PKG_VERSION").to_string();
112+
// let rt = Runtime::new()?;
113+
// let server_version = rt.block_on(client.health_check())?;
114+
let server_version = tokio::runtime::Handle::current().block_on(client.health_check())?;
115+
println!("Connected to Qdrant version: {}", server_version.version);
116+
println!("Qdrant client version: {}", client_version);
117+
}
118+
107119
Ok(client)
108120
}
109121

0 commit comments

Comments
 (0)