incidentstore

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package incidentstore persists the Incidentius event stream in a repository.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExecutionNotFound = errors.New("execution not found")
	ErrExecutionExists   = errors.New("execution already exists")
)
View Source
var ErrExecutionIndexUnavailable = errors.New("execution index unavailable")
View Source
var ErrIncidentNotFound = errors.New("incident not found")

Functions

This section is empty.

Types

type ConfiguredStore added in v0.27.0

type ConfiguredStore struct {
	StoreID    string                      `yaml:"storeId" json:"storeId"`
	Kind       incidents.StoreLocationKind `yaml:"kind" json:"kind"`
	Project    *incidents.ProjectRef       `yaml:"project,omitempty" json:"project,omitempty"`
	Repository string                      `yaml:"repository" json:"repository"`
}

ConfiguredStore is one trusted repository route shared by incident and execution evidence. Repository is a checked-out local Git repository root.

func (ConfiguredStore) Location added in v0.27.0

func (ConfiguredStore) Validate added in v0.27.0

func (c ConfiguredStore) Validate() error

type RepositoryRoots

type RepositoryRoots struct {
	Application string
	Dedicated   map[string]string
	Projects    map[incidents.ProjectRef]string
}

RepositoryRoots resolves every supported StoreLocation to its checked-out Git repository root. The caller owns cloning, authentication, and sync.

func ResolveRouting added in v0.27.0

func ResolveRouting(projectPaths map[string]string, configured []ConfiguredStore) (RepositoryRoots, map[string]incidents.StoreLocation, error)

ResolveRouting combines project defaults with explicit dedicated, application, or project-repository overrides.

type RepositoryStore

type RepositoryStore struct {
	// contains filtered or unexported fields
}

RepositoryStore owns one configured incident repository. Project, dedicated, and application repositories use this same implementation and layout; routing decides only which root is supplied.

func NewRepositoryStore

func NewRepositoryStore(location incidents.StoreLocation, root string) (*RepositoryStore, error)

func OpenLocation

func OpenLocation(location incidents.StoreLocation, roots RepositoryRoots) (*RepositoryStore, error)

OpenLocation resolves a store location and opens its repository-backed incident store. It keeps location selection separate from persistence so project, dedicated, and application repositories cannot silently share a fallback directory.

func (*RepositoryStore) Append

func (s *RepositoryStore) Append(ctx context.Context, mutation incidents.Mutation) (result incidents.AppendResult, err error)

func (*RepositoryStore) Close

func (s *RepositoryStore) Close() error

Close releases the root directory handle held by the store.

func (*RepositoryStore) Events

func (s *RepositoryStore) Events(ctx context.Context, ref incidents.IncidentRef, afterSeq uint64) (events []incidents.Event, err error)

func (*RepositoryStore) Execution added in v0.27.0

Execution loads an immutable receipt by its store-qualified ID.

func (*RepositoryStore) Executions added in v0.27.0

func (s *RepositoryStore) Executions(ctx context.Context) (records []apicontract.ExecutionRecord, err error)

Executions returns all valid receipts in newest-first order. Filtering and response limits are deliberately applied by the contract-facing service.

func (*RepositoryStore) ExecutionsBounded added in v0.27.0

func (s *RepositoryStore) ExecutionsBounded(ctx context.Context, limit int) (records []apicontract.ExecutionRecord, omitted bool, err error)

ExecutionsBounded returns at most limit receipts while bounding receipt reads. omitted reports that one or more indexed receipts were not read. A negative limit preserves the unbounded internal/listing behavior.

func (*RepositoryStore) Merge

func (s *RepositoryStore) Merge(ctx context.Context, mutation incidents.MergeMutation) (result incidents.MergeResult, err error)

func (*RepositoryStore) Projection

func (s *RepositoryStore) Projection(ctx context.Context, ref incidents.IncidentRef, at *time.Time) (projection incidents.Incident, err error)

func (*RepositoryStore) PutExecution added in v0.27.0

func (s *RepositoryStore) PutExecution(ctx context.Context, record apicontract.ExecutionRecord) error

PutExecution appends one immutable execution receipt to the routed evidence repository. The receipt is never overwritten, including by an idempotent retry, because an execution ID names exactly one immutable observation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL