persist: stream catalog — enumerate streams + 10 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 30s
New backend op :streams (from seq high-water marks, so compacted streams still list), threaded through mem-backend + durable serve/io-backend. catalog.sx: persist/streams, stream-count, stream-exists?, total-events. 143/143. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
lib/persist/catalog.sx
Normal file
20
lib/persist/catalog.sx
Normal file
@@ -0,0 +1,20 @@
|
||||
; persist/catalog — enumerate the streams a backend holds. The catalog is the
|
||||
; set of streams ever appended to (from the seq high-water marks), so a stream
|
||||
; whose log has been fully compacted still appears. For admin, global ops, and
|
||||
; cross-stream tooling. Requires: lib/persist/backend.sx, lib/persist/log.sx.
|
||||
|
||||
(define persist/streams (fn (b) (persist/backend-streams b)))
|
||||
(define persist/stream-count (fn (b) (len (persist/streams b))))
|
||||
(define
|
||||
persist/stream-exists?
|
||||
(fn (b stream) (contains? (persist/streams b) stream)))
|
||||
|
||||
; total logical events across all streams (sum of high-water marks)
|
||||
(define
|
||||
persist/total-events
|
||||
(fn
|
||||
(b)
|
||||
(reduce
|
||||
(fn (acc s) (+ acc (persist/last-seq b s)))
|
||||
0
|
||||
(persist/streams b))))
|
||||
Reference in New Issue
Block a user