toondb_grpc/
lib.rs

1// Copyright 2025 Sushanth (https://github.com/sushanthpy)
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! ToonDB gRPC Services
16//!
17//! This crate provides a comprehensive gRPC interface for ToonDB operations.
18//! It implements a "Thick Server / Thin Client" architecture where all business
19//! logic lives in the Rust server, enabling thin SDK wrappers in any language.
20//!
21//! ## Services
22//!
23//! - **VectorIndexService**: HNSW vector operations
24//! - **GraphService**: Graph overlay for agent memory
25//! - **PolicyService**: Policy evaluation and enforcement
26//! - **ContextService**: LLM context assembly with token budgets
27//! - **CollectionService**: Collection management
28//! - **NamespaceService**: Multi-tenant namespace management
29//! - **SemanticCacheService**: Semantic caching for LLM queries
30//! - **TraceService**: Trace/span management
31//! - **CheckpointService**: State checkpoint and restore
32//! - **McpService**: MCP tool routing
33//! - **KvService**: Basic key-value operations
34//!
35//! ## Usage
36//!
37//! ```bash
38//! # Start the gRPC server
39//! toondb-grpc-server --port 50051
40//!
41//! # From Python client
42//! import grpc
43//! from toondb.proto import toondb_pb2, toondb_pb2_grpc
44//!
45//! channel = grpc.insecure_channel('localhost:50051')
46//! stub = toondb_pb2_grpc.VectorIndexServiceStub(channel)
47//! ```
48
49pub mod proto {
50    // Include generated protobuf code
51    tonic::include_proto!("toondb.v1");
52}
53
54pub mod server;
55pub mod error;
56
57// Service implementations
58pub mod graph_server;
59pub mod policy_server;
60pub mod context_server;
61pub mod collection_server;
62pub mod namespace_server;
63pub mod semantic_cache_server;
64pub mod trace_server;
65pub mod checkpoint_server;
66pub mod mcp_server;
67pub mod kv_server;
68
69pub use server::VectorIndexServer;
70pub use error::GrpcError;