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