kyu-api
Database and Connection API for KyuGraph with Arrow Flight support.
This crate is the internal engine API. Most users should depend on kyu-graph instead, which re-exports the public surface from this crate.
Core Types
| Type | Description |
|---|---|
Database |
Top-level entry point owning catalog, storage, WAL, and transaction manager |
Connection |
Executes Cypher queries and DDL against a database |
NodeGroupStorage |
Columnar storage backed by NodeGroup/ColumnChunk |
Usage
use ;
// In-memory
let db = in_memory;
let conn = db.connect;
conn.query.unwrap;
conn.query.unwrap;
let result = conn.query.unwrap;
for row in result.iter_rows
Persistent Database
use Database;
let db = open.unwrap;
let conn = db.connect;
// Schema + data persisted to disk via WAL + checkpointing.
Parameterized Queries
use HashMap;
use TypedValue;
let mut params = new;
params.insert;
let result = conn.query_with_params.unwrap;
Full VM Execution (params + env)
use HashMap;
use TypedValue;
let params = new;
let env = new;
let result = conn.execute.unwrap;
Delta Fast Path
Conflict-free idempotent upserts bypassing OCC for high-throughput ingestion:
use ;
let batch = new
.upsert_node
.build;
let stats = conn.apply_delta.unwrap;
Extensions
use Database;
use Extension;
let mut db = in_memory;
// db.register_extension(Box::new(my_ext));
let conn = db.connect;
Arrow Flight Server
Expose KyuGraph as an Arrow Flight gRPC endpoint:
use Arc;
use ;
let db = new;
// serve_flight(db, "0.0.0.0", 50051).await.unwrap();
Convert query results to Arrow RecordBatch:
use to_record_batch;
let result = conn.query.unwrap;
if let Some = to_record_batch
Architecture
Application
│
▼
┌─────────┐ ┌────────────┐
│ Database │────▶│ Connection │ ← you are here (kyu-api)
└─────────┘ └────────────┘
│ │
▼ ▼
┌────────┐ ┌──────────────┐
│Catalog │ │ kyu-executor │
└────────┘ └──────────────┘
│ │
▼ ▼
┌──────────────────────────┐
│ kyu-storage (columnar) │
└──────────────────────────┘
│
▼
┌──────────────────────────┐
│ kyu-transaction (WAL) │
└──────────────────────────┘
Query Pipeline
- Parse —
kyu-parserlexes and parses Cypher into an AST - Bind —
kyu-binderresolves names against the catalog - Plan —
kyu-plannerbuilds and optimizes a logical plan - Execute —
kyu-executorruns the plan against storage - Commit —
kyu-transactionpersists via WAL + checkpoint
License
MIT