pub struct QdrantConfig {
pub uri: String,
pub timeout: Duration,
pub connect_timeout: Duration,
pub keep_alive_while_idle: bool,
pub api_key: Option<String>,
pub compression: Option<CompressionEncoding>,
}
Expand description
Qdrant client configuration
The client is normally constructed through Qdrant::from_url
:
use qdrant_client::Qdrant;
use qdrant_client::config::CompressionEncoding;
let client = Qdrant::from_url("http://localhost:6334")
.api_key(std::env::var("QDRANT_API_KEY"))
.timeout(std::time::Duration::from_secs(10))
.compression(Some(CompressionEncoding::Gzip))
.build();
Fields§
§uri: String
Qdrant server URI to connect to
timeout: Duration
Timeout for API requests
connect_timeout: Duration
Timeout for connecting to the Qdrant server
keep_alive_while_idle: bool
Whether to keep idle connections active
api_key: Option<String>
Optional API key or token to use for authorization
compression: Option<CompressionEncoding>
Optional compression schema to use for API requests
Implementations§
source§impl QdrantConfig
impl QdrantConfig
sourcepub fn from_url(url: &str) -> Self
pub fn from_url(url: &str) -> Self
Start configuring a Qdrant client with an URL
let client = QdrantConfig::from_url("http://localhost:6334").build();
This is normally done through Qdrant::from_url
.
sourcepub fn api_key(self, api_key: impl AsOptionApiKey) -> Self
pub fn api_key(self, api_key: impl AsOptionApiKey) -> Self
Set an optional API key
§Examples
A typical use case might be getting the key from an environment variable:
use qdrant_client::Qdrant;
let client = Qdrant::from_url("http://localhost:6334")
.api_key(std::env::var("QDRANT_API_KEY"))
.build();
Or you might get it from some configuration:
let client = Qdrant::from_url("http://localhost:6334")
.api_key(config.get("api_key"))
.build();
sourcepub fn keep_alive_while_idle(self) -> Self
pub fn keep_alive_while_idle(self) -> Self
Keep the connection alive while idle
sourcepub fn timeout(self, timeout: impl AsTimeout) -> Self
pub fn timeout(self, timeout: impl AsTimeout) -> Self
Set the timeout for this client
use qdrant_client::Qdrant;
let client = Qdrant::from_url("http://localhost:6334")
.timeout(std::time::Duration::from_secs(10))
.build();
sourcepub fn connect_timeout(self, timeout: impl AsTimeout) -> Self
pub fn connect_timeout(self, timeout: impl AsTimeout) -> Self
Set the connect timeout for this client
use qdrant_client::Qdrant;
let client = Qdrant::from_url("http://localhost:6334")
.connect_timeout(std::time::Duration::from_secs(10))
.build();
sourcepub fn compression(self, compression: Option<CompressionEncoding>) -> Self
pub fn compression(self, compression: Option<CompressionEncoding>) -> Self
Set the compression to use for this client
use qdrant_client::Qdrant;
use qdrant_client::config::CompressionEncoding;
let client = Qdrant::from_url("http://localhost:6334")
.compression(Some(CompressionEncoding::Gzip))
.build();
sourcepub fn set_api_key(&mut self, api_key: &str)
pub fn set_api_key(&mut self, api_key: &str)
Set an API key
Also see api_key()
.
sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Set the timeout for this client
Also see timeout()
.
sourcepub fn set_connect_timeout(&mut self, connect_timeout: Duration)
pub fn set_connect_timeout(&mut self, connect_timeout: Duration)
Set the connection timeout for this client
Also see connect_timeout()
.
sourcepub fn set_keep_alive_while_idle(&mut self, keep_alive_while_idle: bool)
pub fn set_keep_alive_while_idle(&mut self, keep_alive_while_idle: bool)
Set whether to keep the connection alive when idle
Also see keep_alive_while_idle()
.
sourcepub fn set_compression(&mut self, compression: Option<CompressionEncoding>)
pub fn set_compression(&mut self, compression: Option<CompressionEncoding>)
Set the compression to use for this client
Also see compression()
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QdrantConfig
impl RefUnwindSafe for QdrantConfig
impl Send for QdrantConfig
impl Sync for QdrantConfig
impl Unpin for QdrantConfig
impl UnwindSafe for QdrantConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request