Documentation
¶
Overview ¶
Package executionstore composes immutable repository-backed execution receipts with server-private SQLite snapshot bytes and lifecycle state.
Index ¶
- Constants
- Variables
- func ResolvePrivateDir(explicit string) (string, error)
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) IncidentStoreByID(projectID, storeID string) (incidents.APIStore, error)
- func (m *Manager) ProjectStore(projectID string) (*Store, error)
- func (m *Manager) RoutedStore(projectID string, incident *apicontract.IncidentRef) (*Store, error)
- func (m *Manager) Store(location incidents.StoreLocation) (*Store, error)
- func (m *Manager) StoreByID(projectID, storeID string) (*Store, error)
- type Options
- type Store
- func (s *Store) Close() error
- func (s *Store) Execution(ctx context.Context, ref apicontract.ExecutionRef) (apicontract.ExecutionRecord, error)
- func (s *Store) Executions(ctx context.Context) ([]apicontract.ExecutionRecord, error)
- func (s *Store) ExecutionsBounded(ctx context.Context, limit int) ([]apicontract.ExecutionRecord, bool, error)
- func (s *Store) ExpireDue(ctx context.Context) error
- func (s *Store) PutExecution(ctx context.Context, record apicontract.ExecutionRecord) error
- func (s *Store) PutSnapshot(ctx context.Context, ref apicontract.ExecutionRef, ...) (snapshotRef string, stored bool, err error)
- func (s *Store) RequireIncident(ctx context.Context, ref incidents.IncidentRef) error
- func (s *Store) RollbackSnapshot(ctx context.Context, snapshotRef string) error
- func (s *Store) Snapshot(ctx context.Context, ref apicontract.ExecutionRef, snapshotRef string) (apicontract.SnapshotReadResponse, error)
- func (s *Store) State(ctx context.Context, snapshotRef string) (*apicontract.SnapshotState, error)
Constants ¶
const ( DirEnv = "DATATUG_EVIDENCE_DIR" DefaultDir = ".datatug/evidence" DefaultByteCap = 2 << 20 DefaultRetention = 30 * 24 * time.Hour )
Variables ¶
var ( ErrSnapshotNotFound = errors.New("snapshot not found") ErrUnsafePrivateDir = errors.New("private evidence directory must be outside Git and evidence repositories") )
Functions ¶
func ResolvePrivateDir ¶
ResolvePrivateDir selects the explicitly configured directory, then the environment override, then ~/.datatug/evidence.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager opens one Store per routed evidence store and owns their handles.
func NewManager ¶
func NewManager(roots incidentstore.RepositoryRoots, locations map[string]incidents.StoreLocation, options Options) (*Manager, error)
func (*Manager) IncidentStoreByID ¶ added in v0.28.0
IncidentStoreByID exposes the canonical incident provider already owned by this routed evidence store. Incident and execution evidence therefore share one RepositoryStore, lock, and recovery boundary.
func (*Manager) ProjectStore ¶
ProjectStore opens the primary project-repository evidence route.
func (*Manager) RoutedStore ¶
func (m *Manager) RoutedStore(projectID string, incident *apicontract.IncidentRef) (*Store, error)
RoutedStore selects an incident-qualified route or the project's primary route when incident is absent.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns one routed repository and its private snapshot sidecar.
func (*Store) Execution ¶
func (s *Store) Execution(ctx context.Context, ref apicontract.ExecutionRef) (apicontract.ExecutionRecord, error)
func (*Store) Executions ¶
func (s *Store) Executions(ctx context.Context) ([]apicontract.ExecutionRecord, error)
func (*Store) ExecutionsBounded ¶
func (s *Store) ExecutionsBounded(ctx context.Context, limit int) ([]apicontract.ExecutionRecord, bool, error)
func (*Store) ExpireDue ¶
ExpireDue deletes retained bytes and advances available snapshots to the terminal expired state. Receipts and snapshotRef remain untouched.
func (*Store) PutExecution ¶
func (s *Store) PutExecution(ctx context.Context, record apicontract.ExecutionRecord) error
func (*Store) PutSnapshot ¶
func (s *Store) PutSnapshot(ctx context.Context, ref apicontract.ExecutionRef, recordset apicontract.Recordset, executedAt time.Time) (snapshotRef string, stored bool, err error)
PutSnapshot stores canonical typed-row JSON when it fits the configured cap. A refusal returns stored=false and writes no lifecycle row.
func (*Store) RequireIncident ¶
RequireIncident proves that a client-supplied incident association resolves in the same routed repository before immutable evidence is written.
func (*Store) RollbackSnapshot ¶
RollbackSnapshot removes unpublished bytes after receipt publication fails.
func (*Store) Snapshot ¶
func (s *Store) Snapshot(ctx context.Context, ref apicontract.ExecutionRef, snapshotRef string) (apicontract.SnapshotReadResponse, error)
func (*Store) State ¶
func (s *Store) State(ctx context.Context, snapshotRef string) (*apicontract.SnapshotState, error)
State returns the separately stored current lifecycle state.