Skip to main content

sochdb_grpc/
lib.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2// SochDB - LLM-Optimized Embedded Database
3// Copyright (C) 2026 Sushanth Reddy Vanagala (https://github.com/sushanthpy)
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Affero General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Affero General Public License for more details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18//! SochDB gRPC Services
19//!
20//! This crate provides a comprehensive gRPC interface for SochDB operations.
21//! It implements a "Thick Server / Thin Client" architecture where all business
22//! logic lives in the Rust server, enabling thin SDK wrappers in any language.
23//!
24//! ## Services
25//!
26//! - **VectorIndexService**: HNSW vector operations
27//! - **GraphService**: Graph overlay for agent memory
28//! - **PolicyService**: Policy evaluation and enforcement
29//! - **ContextService**: LLM context assembly with token budgets
30//! - **CollectionService**: Collection management
31//! - **NamespaceService**: Multi-tenant namespace management
32//! - **SemanticCacheService**: Semantic caching for LLM queries
33//! - **TraceService**: Trace/span management
34//! - **CheckpointService**: State checkpoint and restore
35//! - **McpService**: MCP tool routing
36//! - **KvService**: Basic key-value operations
37//!
38//! ## Usage
39//!
40//! ```bash
41//! # Start the gRPC server
42//! sochdb-grpc-server --port 50051
43//!
44//! # From Python client
45//! import grpc
46//! from sochdb.proto import sochdb_pb2, sochdb_pb2_grpc
47//!
48//! channel = grpc.insecure_channel('localhost:50051')
49//! stub = sochdb_pb2_grpc.VectorIndexServiceStub(channel)
50//! ```
51
52pub mod proto {
53    // Include generated protobuf code
54    tonic::include_proto!("sochdb.v1");
55}
56
57pub mod server;
58pub mod error;
59
60// Service implementations
61pub mod graph_server;
62pub mod policy_server;
63pub mod context_server;
64pub mod collection_server;
65pub mod namespace_server;
66pub mod semantic_cache_server;
67pub mod trace_server;
68pub mod checkpoint_server;
69pub mod mcp_server;
70pub mod kv_server;
71
72pub use server::VectorIndexServer;
73pub use error::GrpcError;