Skip to main content

vectorizer_sdk/rpc/
mod.rs

1//! VectorizerRPC client — length-prefixed MessagePack over raw TCP.
2//!
3//! The wire spec at `docs/specs/VECTORIZER_RPC.md` (in the parent
4//! Vectorizer repo) is the byte-level contract. This module ports the
5//! server-side codec + types byte-for-byte so a v1 server can talk to
6//! a v1 SDK client without translation.
7//!
8//! ## Quick start
9//!
10//! ```no_run
11//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
12//! use vectorizer_sdk::rpc::{RpcClient, HelloPayload};
13//!
14//! let mut client = RpcClient::connect("127.0.0.1:15503").await?;
15//! client.hello(HelloPayload::new("vectorizer-sdk-rust/3.0.0")).await?;
16//! let pong = client.ping().await?;
17//! assert_eq!(pong, "PONG");
18//! # Ok(())
19//! # }
20//! ```
21//!
22//! ## Layout
23//!
24//! - [`codec`]    — frame encode/decode (`u32 LE len` + MessagePack body).
25//! - [`types`]    — `Request`, `Response`, `VectorizerValue` wire types.
26//! - [`client`]   — `RpcClient`: connect, hello, call, ping, close.
27//! - [`pool`]     — minimal `RpcPool<T>` for reusing connections.
28//! - [`endpoint`] — `parse_endpoint(url)` for the canonical
29//!   `vectorizer://host[:port]` URL scheme.
30
31pub mod client;
32pub mod codec;
33pub mod commands;
34pub mod endpoint;
35pub mod pool;
36pub mod types;
37
38pub use client::{HelloPayload, HelloResponse, RpcClient, RpcClientError};
39pub use commands::{CollectionInfo, SearchHit};
40pub use endpoint::{Endpoint, ParseError, parse_endpoint};
41pub use pool::RpcPool;
42pub use types::{Request, Response, VectorizerValue};