check hero_db implementation and link to openrpc #18
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_db#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
the openrpc needs to have following functions
all functionality available
make a spec, then we implement differences in the openrpc as well as in the server
make sure its all very modular as submodules in hero_db_lib
Implementation Spec for Issue #18: hero_db OpenRPC Completeness
Objective
Audit hero_db, produce a comprehensive OpenRPC spec covering all functionality (CRUD on databases, auth/authz, Redis command alternatives, graph DB operations, ontology management, vector operations), and implement handler modules in
hero_db_server. The OpenRPC spec becomes the single source of truth; server handler dispatch and SDK client are updated to match.Current State
rpc.health,rpc.discover,auth.validate,redis.exec/info/database_list/select/keys/get/del/database_create,perf.batch/batch_native)redis.set— spec has get/del but no setImplementation Plan (10 Steps)
Step 1: Expand OpenRPC Specification
Rewrite
openrpc.jsonto cover ~70+ methods organized by domain:rpc.*(2),auth.*(5),database.*(5),redis.*(20+),stream.*(6)graph.node.*(6),graph.edge.*(5),graph.traverse/neighbors/path(3),graph.stats/clear(2)ontology.*(7),vector.*(12),perf.*(2)Step 2: Create
database.*Handler ModuleNew
handlers/database.rs— create, list, delete, info, selectStep 3: Add Missing Redis Data Handlers
Expand
handlers/redis.rs— set, mset, mget, exists, expire, ttl, type, incr, hset/hget/hgetall/hdel, lpush/rpush/lpop/rpop/lrange, sadd/srem/smembersStep 4: Create
graph.*Handler ModuleNew
handlers/graph.rs— node CRUD, edge CRUD, traverse, neighbors, path, stats, clearStep 5: Create
ontology.*Handler ModuleNew
handlers/ontology.rs— load, load_default, use, get, list, delete, strictStep 6: Create
vector.*Handler ModuleNew
handlers/vector.rs— create, add, add_multi, get, del, search, search_by_id, build, info, list, drop, clearStep 7: Create
auth.*Handler ModuleNew
handlers/auth.rs— user_create, user_delete, grant, revoke (+ existing validate)Step 8: Create
stream.*Handler ModuleNew
handlers/stream.rs— add, read, range, len, trim, infoStep 9: Verify SDK Compilation
openrpc_client!macro auto-generates from updated spec — verifycargo buildStep 10: Integration Tests
Test files for graph, vector, database, auth RPC methods
Acceptance Criteria
openrpc.jsoncontains 70+ method definitionscargo buildsucceeds for entire workspaceNotes
process_command()→ convert to JSON-RPC responseredis.execremains as escape hatch for any commandhero_db_ui/openrpc.jsonis separate concern (RESP protocol docs for UI)Test Results
Build
Full workspace builds successfully (
cargo build --workspace).SDK Generation
hero_db_sdkcompiles successfully with 80 OpenRPC methods auto-generated from the updated spec.Breakdown by crate
All 63 executable tests pass. The 10 ignored items are doc-tests marked
ignore(require a running server).Implementation Summary
Changes Made
OpenRPC Specification (
crates/hero_db_server/openrpc.json):New Handler Modules (in
crates/hero_db_server/src/handlers/):auth.rs— 5 methods: validate, user_create, user_delete, grant, revokedatabase.rs— 5 methods: create, list, delete, info, selectgraph.rs— 16 methods: node CRUD (6), edge CRUD (5), traversal (3), stats/clear (2)ontology.rs— 7 methods: load, load_default, use, get, list, delete, strictvector.rs— 12 methods: create, add, add_multi, get, del, search, search_by_id, build, info, list, drop, clearstream.rs— 5 methods: add, range, len, trim, infoEnhanced Redis Handlers (
redis.rs):Updated Dispatch (
mod.rs):SDK Auto-generation:
hero_db_sdkauto-generates typed client methods from the updated spec viaopenrpc_client!macroTest Results
Architecture
All handlers follow the same pattern: construct RESP commands →
process_command()→ convert to JSON-RPC response. This ensures OpenRPC and RESP behavior are identical with no logic duplication.Implementation committed:
b946a84Browse:
b946a84Implementation Summary
OpenRPC Expansion (80 → 125 methods)
All RESP commands now have JSON-RPC method aliases — everything is accessible via OpenRPC without using RESP directly.
New domains added:
server.*(9 methods): compact, shutdown, memory, ping, dbsize, flushdb, info, config_get, config_setadmin.*(3 methods): add, remove, listredis.*methods: mset, mget, append, strlen, getrange, setnx, incrby, decrby, decr, scan, hmset, hmget, hexists, hlen, hkeys, hvals, hincrby, llen, lindex, lset, lrem, scard, sismember, spop, sunion, sinter, sdiff, dbsize, flushdb, pingvector.exists,vector.lendatabase.publicHandler Fixes
graph.stats— returns proper JSON object instead of flat arrayvector.info— returns proper JSON object instead of flat arrayUI OpenRPC Spec
Integration Tests Rewritten
HeroDBServerClientfor OpenRPC,HeroDbClientfor RESP)Makefile Updated
hero_do scripts/*.rhai) with directhero_db --start/hero_db --stopFiles Changed
crates/hero_db_server/openrpc.json— expanded to 125 methodscrates/hero_db_server/openrpc.client.generated.rs— regenerated SDK clientcrates/hero_db_server/src/handlers/mod.rs— dispatch table for all 125 methodscrates/hero_db_server/src/handlers/redis.rs— 31 new handlerscrates/hero_db_server/src/handlers/server.rs— new, 9 server management handlerscrates/hero_db_server/src/handlers/admin.rs— new, 3 admin handlerscrates/hero_db_server/src/handlers/database.rs— added public_access handlercrates/hero_db_server/src/handlers/vector.rs— added exists/len, fixed info handlercrates/hero_db_server/src/handlers/graph.rs— fixed stats handlercrates/hero_db_server/tests/openrpc_methods.rs— new, 12 typed SDK integration testscrates/hero_db_ui/openrpc.json— replaced with server's JSON-RPC specMakefile— uses hero_db --start/--stop instead of Rhai scripts