r/golang
2d ago
u/ayywheyyy_
One Name for Schema, Hierarchy and Access Control on a Replicated Log: 225ns in-process evaluation in Go over NATS JetStream and PostgreSQL (Paper + Benchmark Repo)
show & tell
I just published a formal systems paper and standalone Go benchmark repository ( primbench ) detailing the deterministic state primitive we run in production over NATS JetStream and PostgreSQL.
The core invariant binds our compiled JSON Schema registry, JetStream stream routing, identity permissions, and Postgres RLS row policies to a single five token subject key:
tenant.<tenant>.dag.<family>.<id>
Instead of making network hops out to Valkey/Redis, an HTTP schema registry, and a separate authorization service on every write, the Go writer and projector evaluate all three relations in process on the five token name:
Kind(schema_id) resolves the family from a lock free copy on write map seeded at boot and updated live from a JetStream schema stream (3.8ns, 0 allocs).
Grant matching walks the…