Documentation
¶
Overview ¶
Package ids is part of the GoFastr harness.
See docs/harness-architecture.md for the architecture this package implements.
Package ids defines the typed identifier strings used across the harness wire protocol and persistence layer. All IDs are ULID-derived with a typed prefix so a string can be inspected without context.
Formats (normative — see docs/harness-architecture.md § Glossary):
SessionID sess_<ULID> one per EngineRun LogID log_<ULID> persistence-layer ID CallID call_<ULID> one per tool call JTI tok_<ULID> token ID (revocation key) ClientID cli_<ULID> stable for the lifetime of a client attach
Branch ID rewrite is deterministic from (source_id, new_log_id) so two clients branching the same boundary produce the same new IDs.
Index ¶
- Constants
- Variables
- func RewriteForBranch(sourceID string, newLogID LogID) (string, error)
- func ValidCall(s CallID) bool
- func ValidClient(s ClientID) bool
- func ValidJTI(s JTI) bool
- func ValidLog(s LogID) bool
- func ValidSession(s SessionID) bool
- type CallID
- type ClientID
- type JTI
- type LogID
- type SessionID
Constants ¶
const ( PrefixSession = "sess" PrefixLog = "log" PrefixCall = "call" PrefixToken = "tok" PrefixClient = "cli" )
Prefix constants — keep in lockstep with the doc.
Variables ¶
var ErrInvalidPrefix = errors.New("ids: invalid prefix")
ErrInvalidPrefix is returned when a parsed ID has the wrong prefix.
Functions ¶
func RewriteForBranch ¶
RewriteForBranch deterministically derives a new ID from a source ID and the new LogID it belongs to, per the doc's branch ID-rewrite rule.
Two clients branching the same source ID at the same boundary with the same destination LogID produce the same rewritten ID. This is the property the replay/diff tools rely on.
The input may be any prefixed ID; the rewritten ID keeps the same prefix.
func ValidClient ¶
ValidClient reports whether s is a syntactically valid ClientID.
func ValidSession ¶
ValidSession reports whether s is a syntactically valid SessionID.
Types ¶
type CallID ¶
type CallID string
Typed ID strings. These are stringly-typed so they serialize naturally over JSON without custom marshalers, but separate Go types so the compiler catches misuse (e.g. passing a SessionID where a LogID is expected).
type ClientID ¶
type ClientID string
Typed ID strings. These are stringly-typed so they serialize naturally over JSON without custom marshalers, but separate Go types so the compiler catches misuse (e.g. passing a SessionID where a LogID is expected).
func ParseClient ¶
ParseClient parses a ClientID string and validates the prefix.
type JTI ¶
type JTI string
Typed ID strings. These are stringly-typed so they serialize naturally over JSON without custom marshalers, but separate Go types so the compiler catches misuse (e.g. passing a SessionID where a LogID is expected).
type LogID ¶
type LogID string
Typed ID strings. These are stringly-typed so they serialize naturally over JSON without custom marshalers, but separate Go types so the compiler catches misuse (e.g. passing a SessionID where a LogID is expected).
type SessionID ¶
type SessionID string
Typed ID strings. These are stringly-typed so they serialize naturally over JSON without custom marshalers, but separate Go types so the compiler catches misuse (e.g. passing a SessionID where a LogID is expected).
func ParseSession ¶
ParseSession parses a SessionID string and validates the prefix.