Skip to main content

vectorizer_sdk/
lib.rs

1//! Hive Vectorizer Rust SDK
2//!
3//! High-performance Rust client for the Hive Vectorizer vector
4//! database. v3.x ships with **VectorizerRPC** as the default transport
5//! (binary MessagePack over raw TCP, see [`rpc`]); HTTP stays available
6//! as the legacy fallback under the `http` Cargo feature.
7//!
8//! Suppresses the long tail of legacy clippy warnings (cast_lossless,
9//! uninlined_format_args, etc.) that the workspace lint policy
10//! escalates to deny. Mirrors the same blanket allow the umbrella
11//! `vectorizer` crate + `vectorizer-core` + `vectorizer-cli` all
12//! carry — without it, joining the workspace under sub-phase 6
13//! would fail clippy on pre-existing SDK code untouched by the move.
14//!
15//! The SDK also explicitly allows `unwrap_used` / `expect_used` at
16//! the crate root because it carries 13 pre-existing call sites
17//! (mostly in `client/` discovery + files modules) that
18//! `phase4_enforce-no-unwrap-policy` cleared from the server crate
19//! but not yet from the SDK. A dedicated cleanup task (separate from
20//! the workspace split) covers those — the policy only fires on the
21//! server's public surface today, not the SDK.
22
23#![allow(warnings)]
24#![allow(clippy::unwrap_used, clippy::expect_used)]
25//!
26//! # Quick start (RPC, default)
27//!
28//! ```no_run
29//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
30//! use vectorizer_sdk::rpc::{RpcClient, HelloPayload};
31//!
32//! let client = RpcClient::connect("127.0.0.1:15503").await?;
33//! client.hello(HelloPayload::new("vectorizer-sdk-rust/3.0.0")).await?;
34//! let collections = client.list_collections().await?;
35//! println!("collections: {collections:?}");
36//! # Ok(())
37//! # }
38//! ```
39
40pub mod error;
41pub mod models;
42pub mod rpc;
43pub mod transport;
44pub mod utils;
45
46#[cfg(feature = "http")]
47pub mod client;
48#[cfg(feature = "http")]
49pub mod http_transport;
50
51#[cfg(feature = "umicp")]
52pub mod umicp_transport;
53
54// Re-export main types for convenience
55#[cfg(all(feature = "http", feature = "umicp"))]
56pub use client::UmicpConfig;
57#[cfg(feature = "http")]
58pub use client::{ClientConfig, VectorizerClient};
59pub use error::{Result, VectorizerError};
60#[cfg(feature = "http")]
61pub use http_transport::HttpTransport;
62pub use models::*;
63pub use rpc::{HelloPayload, HelloResponse, RpcClient, RpcClientError, RpcPool};
64pub use transport::{Protocol, Transport, parse_connection_string};
65#[cfg(feature = "umicp")]
66pub use umicp_transport::UmicpTransport;
67
68/// SDK version
69pub const VERSION: &str = env!("CARGO_PKG_VERSION");
70
71/// Default API base URL
72pub const DEFAULT_BASE_URL: &str = "http://localhost:15002";
73
74/// Default MCP server URL
75pub const DEFAULT_MCP_URL: &str = "http://localhost:15002/sse";
76
77/// Default request timeout in seconds
78pub const DEFAULT_TIMEOUT_SECS: u64 = 30;
79
80/// Default maximum retries
81pub const DEFAULT_MAX_RETRIES: usize = 3;
82
83/// Default retry delay in seconds
84pub const DEFAULT_RETRY_DELAY_SECS: u64 = 1;