Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// NodeID filters entries for a specific node (empty means all nodes).
NodeID string
// Operation filters by operation type (e.g., "create", "update").
Operation string
// User filters by user who made the change.
User string
// Since filters entries after this timestamp (Unix seconds).
Since int64
// Until filters entries before this timestamp (Unix seconds).
Until int64
// Limit restricts the number of results (0 means no limit).
Limit int
}
Filter defines criteria for querying the audit log.
type JSONLRepository ¶
type JSONLRepository struct {
// contains filtered or unexported fields
}
JSONLRepository implements Repository using JSONL (JSON Lines) format. This is an append-only log stored at the configured history path.
func NewYAMLRepository ¶
func NewYAMLRepository(historyPath string) *JSONLRepository
NewYAMLRepository creates a new JSONL-based history repository. historyPath is the file path for the audit log (e.g., .deco/history.jsonl). Use config.ResolveHistoryPath() to get this from the project config. The name is kept as NewYAMLRepository for consistency with test expectations, even though it uses JSONL format internally.
func (*JSONLRepository) Append ¶
func (r *JSONLRepository) Append(entry domain.AuditEntry) error
Append adds a new entry to the audit log. Entries are immutable once appended.
func (*JSONLRepository) Query ¶
func (r *JSONLRepository) Query(filter Filter) ([]domain.AuditEntry, error)
Query retrieves audit entries matching the filter criteria. Returns entries in chronological order (oldest first).
func (*JSONLRepository) QueryLatestHashes ¶
func (r *JSONLRepository) QueryLatestHashes() (map[string]string, error)
QueryLatestHashes returns a map of nodeID -> latest content hash for all nodes. This reads the history file once, providing O(history) complexity instead of O(nodes × history) when querying each node individually.
type Repository ¶
type Repository interface {
// Append adds a new entry to the audit log.
// Entries are immutable once appended.
Append(entry domain.AuditEntry) error
// Query retrieves audit entries matching the filter criteria.
// Returns entries in chronological order (oldest first).
Query(filter Filter) ([]domain.AuditEntry, error)
}
Repository defines the interface for audit log persistence. The audit log is append-only for data integrity.