GWP
A standalone, pure Rust gRPC wire protocol for GQL (ISO/IEC 39075) - the international standard query language for property graphs.
Any GQL-compatible database engine can plug in via the GqlBackend trait. GWP handles gRPC transport, session management, transactions, and the full GQL type system over the wire.
Features
- Spec-faithful: Full GQL type system, GQLSTATUS codes, session/transaction semantics
- Pure Rust: No C/C++ dependencies,
#![forbid(unsafe_code)] - Lightweight: Minimal deps: tonic, prost, tokio
- Fast: Streaming results via server-side gRPC streaming
- Embeddable: Library-first design, usable by any Rust project
- TLS: Optional TLS via
tlsfeature flag (rustls) - Auth: Pluggable authentication via
AuthValidatortrait - Health checks: Standard
grpc.health.v1.Healthservice - Observability: Structured tracing on all gRPC methods via
tracingcrate - Graceful shutdown: Drain connections on signal with
.shutdown()
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
Implementing a Backend
Implement the GqlBackend trait to connect your database:
use ;
use GqlError;
Starting the Server
use GqlServer;
use Duration;
async
Or use the builder for full control:
builder
.idle_timeout
.max_sessions
.shutdown
.serve
.await?;
Using the Client
use GqlConnection;
use HashMap;
async
Architecture
Application (GQL statements, parameters, results)
|
v
gRPC Services
- SessionService: handshake, configure, reset, close, ping
- GqlService: execute, begin_transaction, commit, rollback
- DatabaseService: list, create, delete, get_info
- HealthService: grpc.health.v1.Health (check, watch)
|
v
Protocol Buffers (prost)
- Full GQL type system: Value, Node, Edge, Path, Record
- GQLSTATUS codes for structured error reporting
|
v
GqlBackend trait (your database plugs in here)
GQL Type Support
| GQL Type | Wire Representation |
|---|---|
NULL, BOOLEAN, INTEGER, FLOAT, STRING, BYTES |
Native protobuf types |
DATE, TIME, DATETIME, DURATION |
Custom messages |
LIST, MAP |
Recursive Value containers |
NODE |
ID + labels + properties |
EDGE |
ID + type + endpoints + properties |
PATH |
Alternating nodes and edges |
BIGINTEGER, BIGFLOAT, DECIMAL |
String-encoded precision types |
Modules
| Module | Description |
|---|---|
proto |
Generated protobuf types and gRPC stubs |
types |
Ergonomic Rust wrappers over proto types |
server |
GqlBackend trait, session/transaction management, gRPC server |
client |
GqlConnection, GqlSession, ResultCursor, Transaction, DatabaseClient |
error |
GqlError enum |
status |
GQLSTATUS code constants and helpers |
Client Bindings
| Language | Package | Install |
|---|---|---|
| Python | gwp-py | pip install gwp-py |
| JavaScript/TypeScript | gwp-js | npm install gwp-js |
| Go | github.com/GrafeoDB/gwp/go |
go get github.com/GrafeoDB/gwp/go |
| Java | dev.grafeo:gwp |
Maven Central |
All bindings include GqlConnection, GqlSession, Transaction, ResultCursor, and DatabaseClient.
Requirements
- Rust 1.85.0+ (edition 2024)
protoc(Protocol Buffers compiler) - required at build time
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.