Skip to main content

astraea_server/
lib.rs

1//! TCP and gRPC front-ends for AstraeaDB.
2//!
3//! `AstraeaServer` runs a newline-delimited JSON request loop over TCP
4//! (one `protocol::Request` per line, one `protocol::Response` per
5//! line); the `grpc::AstraeaGrpcService` provides a parallel tonic
6//! adapter. Both transports are thin and must route through a single
7//! `RequestHandler::handle(Request) -> Response` so feature parity is
8//! preserved. Cross-cutting concerns live in `AuthManager`,
9//! `ConnectionManager`, `ServerMetrics`, and `TlsConfig`.
10//!
11//! Invariants: `request_type_name` in `server.rs` must have an arm for
12//! every `Request` variant — it drives metrics and RBAC. Vector-aware
13//! requests (`VectorSearch`, `HybridSearch`, `SemanticNeighbors`,
14//! `SemanticWalk`, anchor-less `GraphRag`) require constructing the
15//! server with `Some(vector_index)`; otherwise they return an error
16//! rather than panic. `collect_graph_stats` and `resolve_node_ids(None,
17//! ...)` probe IDs `1..10_000` sequentially and silently truncate.
18
19pub mod auth;
20pub mod connection;
21pub mod grpc;
22pub mod handler;
23pub mod metrics;
24pub mod protocol;
25pub mod server;
26pub mod tls;
27
28pub use auth::{ApiKeyEntry, AuthManager, Role};
29pub use connection::{ConnectionConfig, ConnectionManager};
30pub use handler::RequestHandler;
31pub use metrics::ServerMetrics;
32pub use protocol::{Request, Response};
33pub use server::{AstraeaServer, ServerConfig};
34pub use tls::{TlsConfig, TlsError};