relations: Phase 4 federation (erel trust-gating, peer_rel/trust, fed-sx mock transport, revocation) + 22 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 39s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,47 +1,16 @@
|
||||
;; lib/relations/api.sx — relationship lifecycle + queries over lib/datalog/.
|
||||
;; lib/relations/api.sx — relationship lifecycle + current-db convenience layer.
|
||||
;;
|
||||
;; A relations db is a live Datalog db holding rel(Src,Dst,Kind) facts under the
|
||||
;; engine ruleset (lib/relations/engine.sx). Direct children/parents are plain
|
||||
;; queries on the rel relation; transitive reachability/roots/leaves/cycles come
|
||||
;; from the engine's recursive rules.
|
||||
;;
|
||||
;; Two surfaces: db-threading core fns (relations-children-of db ...) and a
|
||||
;; current-db convenience layer (relations/relate ...) for callers that load a
|
||||
;; fact base once and query without passing the db around. This mirrors lib/acl.
|
||||
;; A relations db is a live Datalog db holding rel(Src,Dst,Kind) facts (and, for
|
||||
;; federation, peer_rel/trust facts) under the engine ruleset
|
||||
;; (lib/relations/engine.sx). The query functions live in engine.sx; this module
|
||||
;; owns db construction, the assert/retract lifecycle, and a current-db
|
||||
;; convenience layer for callers that load a fact base once and query without
|
||||
;; threading the db around. This mirrors lib/acl/api.sx.
|
||||
|
||||
(define
|
||||
relations-build-db
|
||||
(fn (facts) (dl-program-data facts relations-rules)))
|
||||
|
||||
;; Direct children: every Dst with rel(node, Dst, kind).
|
||||
(define
|
||||
relations-children-of
|
||||
(fn
|
||||
(db node kind)
|
||||
(relations-pluck
|
||||
(dl-query db (list (quote rel) node (quote Dst) kind))
|
||||
:Dst)))
|
||||
|
||||
;; Direct parents: every Src with rel(Src, node, kind).
|
||||
(define
|
||||
relations-parents-of
|
||||
(fn
|
||||
(db node kind)
|
||||
(relations-pluck
|
||||
(dl-query db (list (quote rel) (quote Src) node kind))
|
||||
:Src)))
|
||||
|
||||
;; Directly related: neighbours in either direction under kind.
|
||||
(define
|
||||
relations-related
|
||||
(fn
|
||||
(db node kind)
|
||||
(append
|
||||
(relations-children-of db node kind)
|
||||
(relations-parents-of db node kind))))
|
||||
|
||||
;; --- current-db convenience layer ---
|
||||
|
||||
(define relations-current-db nil)
|
||||
|
||||
(define
|
||||
|
||||
Reference in New Issue
Block a user