reckon_db_stream_id (reckon_db v2.3.5)
View SourceStream-id format validator.
Single source of truth for what "a valid stream id" means in reckon-db. Used by reckon_db_streams:append/4 to reject malformed ids at write time so the store never accumulates polluted paths.
Accepted formats
- **User stream:**
<prefix>-<hex>, where:<prefix>is[A-Za-z]+— one or more ASCII letters, no digits, no hyphens, no$.-is a single mandatory separator.<hex>is[A-Fa-f0-9]+— one or more hex digits, typically a UUIDv7 with dashes stripped.
account-018f6a7b8c9d4abc8901234567890abc,order-deadbeef. - **System stream:**
$<namespace>:<name>, where:$is a mandatory prefix.<namespace>is[a-z][a-z0-9-]*— lowercase identifier, may contain hyphens (e.g.link-sub).:is a single mandatory separator.<name>is[A-Za-z0-9][A-Za-z0-9_.-]*— intentionally human-readable; the whole point of system streams is operational legibility.
$link:high-value-orders,$link-sub:revenue.
See guides/system_streams.md for the rationale.
Rejected (returns `{error, Reason}')
- Empty binary —
empty - Not a binary —
not_binary - Anything starting with
$that isn't a well-formed system id —malformed_system_id - Anything not starting with
$that isn't a well-formed user id —malformed_user_id
Rejected examples: test$basic-stream (mid-string $ in a user id), partition$XYZ (ditto), $weird (no :), MYAPP-abc (prefix is fine but abc starts compliant — and xyz isn't hex; g would be rejected), account- (empty hex), -deadbeef (empty prefix).
Summary
Functions
True if StreamId is in the system namespace (starts with $ and is well-formed). Note: $all is NOT a valid stream id — it's a subscription-selector sentinel only.
Boolean wrapper for use in guards / list-comprehensions.
Validate StreamId. Returns ok if it matches either accepted format, or {error, Reason}.
Types
Functions
True if StreamId is in the system namespace (starts with $ and is well-formed). Note: $all is NOT a valid stream id — it's a subscription-selector sentinel only.
Boolean wrapper for use in guards / list-comprehensions.
-spec validate(term()) -> ok | {error, validation_error()}.
Validate StreamId. Returns ok if it matches either accepted format, or {error, Reason}.