Documentation
¶
Overview ¶
Package nodelog provides an append only, content addressed node log on SQLite. Behaviour matches pkg/trajectory_ir/runtime/log.py so Go and Python share one IR story.
The import path is trajir/log; the package name is nodelog to avoid clashing with the standard library log package at call sites.
Index ¶
- Variables
- type NodeLog
- func (l *NodeLog) Append(kind string, stepN *int, payload map[string]any, trajectoryID, tenantID string, ...) (*nodes.Node, error)
- func (l *NodeLog) ClaimToolCall(stepN int, payload map[string]any, trajectoryID, tenantID string, seq int) (claimed bool, err error)
- func (l *NodeLog) Close() error
- func (l *NodeLog) Count(nodeID string) (int, error)
- func (l *NodeLog) Has(trajectoryID, tenantID string, stepN int, kind string, seq *int) (bool, error)
- func (l *NodeLog) HasAllTenants(trajectoryID string, stepN int, kind string, seq *int) (bool, error)
- func (l *NodeLog) ListNodes(trajectoryID, tenantID string) ([]map[string]any, error)
- func (l *NodeLog) ListNodesAllTenants(trajectoryID string) ([]map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
var ErrSlotConflict = postgres.ErrSlotConflict
Functions ¶
This section is empty.
Types ¶
type NodeLog ¶
type NodeLog struct {
// contains filtered or unexported fields
}
NodeLog is an append only SQLite log keyed by content addressed node id. INSERT OR IGNORE makes replaying the same node a no op, which is what durable step replay relies on.
func (*NodeLog) Append ¶
func (l *NodeLog) Append( kind string, stepN *int, payload map[string]any, trajectoryID, tenantID string, seq int, ) (*nodes.Node, error)
Append builds a node via trajir/nodes and stores it. Same content id is ignored (idempotent replay). Different payload at the same logical slot returns ErrSlotConflict.
func (*NodeLog) ClaimToolCall ¶
func (l *NodeLog) ClaimToolCall( stepN int, payload map[string]any, trajectoryID, tenantID string, seq int, ) (claimed bool, err error)
ClaimToolCall atomically inserts a TOOL_CALL at (trajectory, step, seq). Returns claimed=true if this caller owns the slot and may run the tool. Returns claimed=false if the slot was already taken (block-and-gate).
func (*NodeLog) Has ¶
func (l *NodeLog) Has(trajectoryID, tenantID string, stepN int, kind string, seq *int) (bool, error)
Has reports whether a node of kind exists for trajectory and step scoped to tenantID. When seq is non nil, the match is limited to that sequence slot. tenantID must be non-empty; use HasAllTenants for cross-tenant administrative checks.
func (*NodeLog) HasAllTenants ¶
func (l *NodeLog) HasAllTenants(trajectoryID string, stepN int, kind string, seq *int) (bool, error)
HasAllTenants reports whether a node of kind exists for trajectory and step across any tenant. This bypasses tenant isolation and is intended for administrative or diagnostic tools only.
func (*NodeLog) ListNodes ¶
ListNodes returns nodes for a trajectory scoped to tenantID. tenantID is required so this method always enforces tenant isolation at the read path. Callers that genuinely need rows across tenants (e.g. tir.Export's own mixed-tenant check) must use ListNodesAllTenants explicitly instead.
func (*NodeLog) ListNodesAllTenants ¶
ListNodesAllTenants returns nodes for a trajectory across all tenants. This bypasses tenant isolation and should only be used by code that performs its own tenant-scoping check on the result, such as tir.Export detecting a trajectory with mixed tenant_id values.