sqlite

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package sqlite provides SQLite-based persistence implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleDatasource added in v0.9.0

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

BundleDatasource implements usecase.BundleEventRepository with the SQLite-backed Traceary store. Kept as a thin adapter on top of EventDatasource + the schema_migrations table so the bundle usecase stays infrastructure-agnostic.

func NewBundleDatasource added in v0.9.0

func NewBundleDatasource(db *Database, eventStore *EventDatasource) *BundleDatasource

NewBundleDatasource constructs a BundleDatasource.

func (*BundleDatasource) BeginBundleImport added in v0.10.0

BeginBundleImport starts the transaction shared by every table importer in a bundle (sessions, usage_observations, events, command_audits, memories, and memory_edges).

func (*BundleDatasource) ListBundleCommandAudits added in v0.10.0

func (d *BundleDatasource) ListBundleCommandAudits(ctx context.Context) ([]*model.CommandAudit, error)

ListBundleCommandAudits returns every command audit in deterministic order for bundle export.

func (*BundleDatasource) ListBundleMemories added in v0.10.0

func (d *BundleDatasource) ListBundleMemories(ctx context.Context) ([]apptypes.MemoryDetails, error)

ListBundleMemories returns every durable memory with refs for bundle export.

func (*BundleDatasource) ListBundleMemoryEdges added in v0.10.0

func (d *BundleDatasource) ListBundleMemoryEdges(ctx context.Context) ([]*model.MemoryEdge, error)

ListBundleMemoryEdges returns every memory graph edge for bundle export.

func (*BundleDatasource) ListBundleRunLineages added in v0.32.0

func (d *BundleDatasource) ListBundleRunLineages(ctx context.Context) ([]*model.RunLineage, error)

ListBundleRunLineages returns every immutable lineage fact. The usecase validates and orders the complete graph before encoding it.

func (*BundleDatasource) ListBundleSessions added in v0.10.0

func (d *BundleDatasource) ListBundleSessions(ctx context.Context) ([]*model.Session, error)

ListBundleSessions returns every session in parents-first order for bundle export.

func (*BundleDatasource) ListBundleUsageObservations added in v0.32.0

func (d *BundleDatasource) ListBundleUsageObservations(ctx context.Context) ([]*model.UsageObservation, error)

ListBundleUsageObservations returns every durable usage observation in a deterministic order that keeps snapshot predecessors before successors.

func (*BundleDatasource) SchemaVersion added in v0.9.0

func (d *BundleDatasource) SchemaVersion(ctx context.Context) (int, error)

SchemaVersion returns the max version recorded in schema_migrations. 0 means "no migrations have been applied".

type CodexCaptureDiagnosticDatasource added in v0.32.0

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

CodexCaptureDiagnosticDatasource loads a complete body-free aggregate for one doctor window.

func NewCodexCaptureDiagnosticDatasource added in v0.32.0

func NewCodexCaptureDiagnosticDatasource(db *Database) *CodexCaptureDiagnosticDatasource

NewCodexCaptureDiagnosticDatasource creates the read-only SQLite adapter.

func (*CodexCaptureDiagnosticDatasource) LoadCodexCaptureDiagnostic added in v0.32.0

LoadCodexCaptureDiagnostic returns aggregate counts only. Session identities, event bodies, and provider payloads never leave this adapter.

type Database added in v0.4.0

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

Database wraps a SQLite path and provides connection and migration utilities shared by all per-aggregate datasources in this package.

The dbPath is mutable via SetPath so the CLI can late-bind the path after resolving the --db-path flag / TRACEARY_DB_PATH environment variable inside each subcommand's RunE. The mutex protects concurrent path switches from a racing reader; every operation takes a path snapshot at entry and then works with the snapshot, so a path switch midway through cannot split the check and the use.

func NewDatabase added in v0.4.0

func NewDatabase(dbPath string, migrations fs.FS) *Database

NewDatabase creates a new Database bound to the given database path.

func (*Database) Path added in v0.4.0

func (d *Database) Path() string

Path returns the current database file path.

func (*Database) SetPath added in v0.4.0

func (d *Database) SetPath(dbPath string)

SetPath updates the database file path. Call this after resolving the CLI --db-path flag / TRACEARY_DB_PATH environment variable so the datasources built from this Database open the user-specified path instead of the composition-root default.

type EventDatasource added in v0.4.0

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

EventDatasource is the SQLite-backed implementation of the event repository and event query service.

func NewEventDatasource added in v0.4.0

func NewEventDatasource(db *Database) *EventDatasource

NewEventDatasource creates a new EventDatasource bound to the given database.

func (*EventDatasource) GetContext added in v0.4.0

func (d *EventDatasource) GetContext(
	ctx context.Context,
	workspace types.Workspace, sessionID types.SessionID,
	limit int,
) ([]*model.Event, error)

GetContext returns events matching the requested context in descending time order.

func (*EventDatasource) GetContextMetadata added in v0.31.0

func (d *EventDatasource) GetContextMetadata(
	ctx context.Context,
	criteria apptypes.EventContextCriteria,
) ([]apptypes.EventMetadata, error)

GetContextMetadata returns body-free context membership in descending time order.

func (*EventDatasource) GetDetails added in v0.4.0

func (d *EventDatasource) GetDetails(
	ctx context.Context,
	eventID types.EventID,
) (apptypes.EventDetails, error)

GetDetails returns the details for the given event ID.

func (*EventDatasource) ListRecent added in v0.4.0

func (d *EventDatasource) ListRecent(
	ctx context.Context,
	limit, offset int,
	kind types.EventKind, client types.Client, agent types.Agent, sessionID types.SessionID, workspace types.Workspace,
	failuresOnly bool,
	from, to time.Time,
	sourceHook string,
) ([]*model.Event, error)

ListRecent returns events in descending time order.

func (*EventDatasource) ListRecentCommandPreviews added in v0.31.0

func (d *EventDatasource) ListRecentCommandPreviews(ctx context.Context, sessionID types.SessionID, limit, bodyRuneLimit int) ([]apptypes.EventBodyPreview, error)

ListRecentCommandPreviews returns bounded command bodies for summary generation.

func (*EventDatasource) ListRecentMetadata added in v0.31.0

func (d *EventDatasource) ListRecentMetadata(
	ctx context.Context,
	criteria apptypes.EventListCriteria,
) ([]apptypes.EventMetadata, error)

ListRecentMetadata returns body-free event metadata in descending time order.

func (*EventDatasource) ListReportWindow added in v0.31.0

ListReportWindow returns body-free command records under one read snapshot.

func (*EventDatasource) ListTimelineBlocks added in v0.4.0

func (d *EventDatasource) ListTimelineBlocks(
	ctx context.Context,
	workspace types.Workspace,
	from, to time.Time,
	gapSeconds, limit int,
) ([]apptypes.TimelineBlock, error)

ListTimelineBlocks returns work blocks separated by idle gaps.

func (*EventDatasource) ListWindow added in v0.5.1

func (d *EventDatasource) ListWindow(
	ctx context.Context,
	criteria apptypes.EventListCriteria,
) ([]*model.Event, error)

ListWindow returns every event matching the criteria whose created_at falls in [From, To). The entire paged scan runs inside a single read transaction so SQLite snapshot isolation protects it from concurrent writers shifting later pages — which would otherwise cause OFFSET-based pagination to drop rows. Callers provide the per-page size via criteria.Limit(); offset is ignored.

func (*EventDatasource) ListWindowMetadata added in v0.31.0

func (d *EventDatasource) ListWindowMetadata(
	ctx context.Context,
	criteria apptypes.EventListCriteria,
) ([]apptypes.EventMetadata, error)

ListWindowMetadata returns all matching body-free events under one read snapshot.

func (*EventDatasource) Save added in v0.4.0

func (d *EventDatasource) Save(ctx context.Context, event *model.Event) error

Save persists an event.

func (*EventDatasource) SaveWithAudit added in v0.4.0

func (d *EventDatasource) SaveWithAudit(
	ctx context.Context,
	event *model.Event,
	audit *model.CommandAudit,
) error

SaveWithAudit persists an event together with its command audit.

func (*EventDatasource) Search added in v0.4.0

func (d *EventDatasource) Search(
	ctx context.Context,
	query string, workspace types.Workspace, sessionID types.SessionID, client types.Client, agent types.Agent, kind types.EventKind,
	from, to time.Time,
	limit, offset int,
	failuresOnly bool,
) ([]*model.Event, error)

Search returns matching events in descending time order.

func (*EventDatasource) SearchMetadata added in v0.31.0

func (d *EventDatasource) SearchMetadata(
	ctx context.Context,
	criteria apptypes.EventSearchCriteria,
) ([]apptypes.EventMetadata, error)

SearchMetadata searches content in SQLite while returning only body-free rows.

type MemoryDatasource added in v0.5.0

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

MemoryDatasource is the SQLite-backed implementation of the memory repository and memory query service.

func NewMemoryDatasource added in v0.5.0

func NewMemoryDatasource(db *Database) *MemoryDatasource

NewMemoryDatasource creates a new MemoryDatasource bound to the given database.

func NewMemoryDatasourceWithClock added in v0.10.0

func NewMemoryDatasourceWithClock(db *Database, clock types.Clock) *MemoryDatasource

NewMemoryDatasourceWithClock creates a new MemoryDatasource using the provided clock.

func (*MemoryDatasource) CountByStatus added in v0.20.0

CountByStatus returns the true per-status row counts matching the criteria, ignoring its Limit/Offset. It backs the reliability pane's candidate/accepted totals when the bounded summary scan is saturated.

func (*MemoryDatasource) FindByID added in v0.5.0

func (d *MemoryDatasource) FindByID(ctx context.Context, memoryID types.MemoryID) (types.Optional[*model.Memory], error)

FindByID returns the memory for the given ID.

func (*MemoryDatasource) GetDetails added in v0.5.0

func (d *MemoryDatasource) GetDetails(ctx context.Context, memoryID types.MemoryID) (apptypes.MemoryDetails, error)

GetDetails returns the details for a single memory.

func (*MemoryDatasource) List added in v0.5.0

List returns memory summaries matching the provided criteria.

func (*MemoryDatasource) ListStale added in v0.15.0

ListStale returns stale memory rows plus the total count before paging.

func (*MemoryDatasource) Save added in v0.5.0

func (d *MemoryDatasource) Save(ctx context.Context, memory *model.Memory) error

Save persists a memory aggregate together with its refs.

func (*MemoryDatasource) SaveDistillation added in v0.12.0

func (d *MemoryDatasource) SaveDistillation(ctx context.Context, distilled *model.Memory, sources []*model.Memory) error

SaveDistillation persists a distilled accepted memory and source-candidate lifecycle updates in a single transaction.

func (*MemoryDatasource) SaveSupersession added in v0.5.0

func (d *MemoryDatasource) SaveSupersession(ctx context.Context, superseded *model.Memory, replacement *model.Memory) error

SaveSupersession persists a superseded memory state and its replacement in a single transaction.

func (*MemoryDatasource) Search added in v0.5.0

Search performs text search across durable memories and their refs.

type MemoryEdgeDatasource added in v0.9.0

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

MemoryEdgeDatasource is the SQLite-backed implementation of the memory-graph overlay introduced for #573.

func NewMemoryEdgeDatasource added in v0.9.0

func NewMemoryEdgeDatasource(db *Database) *MemoryEdgeDatasource

NewMemoryEdgeDatasource constructs a MemoryEdgeDatasource bound to the given database.

func (*MemoryEdgeDatasource) List added in v0.9.0

List returns edges matching the given filter.

func (*MemoryEdgeDatasource) Save added in v0.9.0

Save persists a new edge row.

type MemoryToolFileDatasource added in v0.10.0

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

MemoryToolFileDatasource is the SQLite-backed implementation of the Anthropic memory-tool file repository.

func NewMemoryToolFileDatasource added in v0.10.0

func NewMemoryToolFileDatasource(db *Database) *MemoryToolFileDatasource

NewMemoryToolFileDatasource creates a new MemoryToolFileDatasource.

func (*MemoryToolFileDatasource) DeletePathPrefix added in v0.10.0

func (d *MemoryToolFileDatasource) DeletePathPrefix(ctx context.Context, path types.MemoryToolPath) (int64, error)

DeletePathPrefix deletes an exact file or all files below a directory path.

func (*MemoryToolFileDatasource) FindByPath added in v0.10.0

FindByPath returns a memory-tool file by exact path.

func (*MemoryToolFileDatasource) List added in v0.10.0

List returns all memory-tool files ordered by path.

func (*MemoryToolFileDatasource) RenamePathPrefix added in v0.10.0

func (d *MemoryToolFileDatasource) RenamePathPrefix(
	ctx context.Context,
	oldPath types.MemoryToolPath,
	newPath types.MemoryToolPath,
	updatedAt time.Time,
) (int64, error)

RenamePathPrefix renames an exact file or all files below a directory path.

func (*MemoryToolFileDatasource) Save added in v0.10.0

Save inserts or updates a memory-tool file.

type ReportDatasource added in v0.31.0

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

ReportDatasource loads all report projections through one SQLite snapshot.

func NewReportDatasource added in v0.31.0

func NewReportDatasource(db *Database) *ReportDatasource

NewReportDatasource creates a report query adapter for one database.

func (*ReportDatasource) LoadReportWindow added in v0.31.0

func (d *ReportDatasource) LoadReportWindow(ctx context.Context, criteria apptypes.ReportCriteria) (apptypes.ReportWindow, error)

LoadReportWindow loads body-free aggregate inputs in one read transaction.

type RunLineageDatasource added in v0.32.0

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

RunLineageDatasource persists immutable run facts with serialized replay.

func NewRunLineageDatasource added in v0.32.0

func NewRunLineageDatasource(db *Database) *RunLineageDatasource

NewRunLineageDatasource creates a run lineage datasource.

func (*RunLineageDatasource) FindByIdentity added in v0.32.0

func (d *RunLineageDatasource) FindByIdentity(ctx context.Context, identity types.RunIdentity) (types.Optional[*model.RunLineage], error)

FindByIdentity restores one namespaced run or returns None.

func (*RunLineageDatasource) Record added in v0.32.0

func (d *RunLineageDatasource) Record(ctx context.Context, lineage *model.RunLineage) (transition model.RunLineageTransition, err error)

Record inserts a fact or reports an exact already-applied replay.

type SessionDatasource added in v0.4.0

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

SessionDatasource is the SQLite-backed implementation of the session repository and session query service.

func NewSessionDatasource added in v0.4.0

func NewSessionDatasource(db *Database) *SessionDatasource

NewSessionDatasource creates a new SessionDatasource bound to the given database.

func (*SessionDatasource) FindByID added in v0.4.0

func (d *SessionDatasource) FindByID(ctx context.Context, sessionID types.SessionID) (types.Optional[*model.Session], error)

FindByID returns the session for the given ID. Returns an empty Optional when the session does not exist.

func (*SessionDatasource) FindEndedSessionIDs added in v0.23.0

func (d *SessionDatasource) FindEndedSessionIDs(ctx context.Context, sessionIDs []types.SessionID) (map[types.SessionID]struct{}, error)

FindEndedSessionIDs returns ended session IDs in bounded batches so callers can reconcile diagnostic markers without issuing one aggregate query per ID.

func (*SessionDatasource) FindLatest added in v0.4.0

func (d *SessionDatasource) FindLatest(
	ctx context.Context,
	client types.Client, agent types.Agent, workspace types.Workspace,
	activeOnly bool,
) (types.Optional[*model.Event], error)

FindLatest returns the session_started event for the latest matching session. Returns an empty Optional when no matching session exists.

func (*SessionDatasource) LineageOf added in v0.10.0

func (d *SessionDatasource) LineageOf(ctx context.Context, sessionID types.SessionID) ([]apptypes.SessionSummary, error)

LineageOf returns the full session family rooted at the topmost ancestor of sessionID. An unknown session ID returns an empty slice.

func (*SessionDatasource) ListSummaries added in v0.4.0

func (d *SessionDatasource) ListSummaries(
	ctx context.Context,
	limit, offset int,
	sessionID types.SessionID, workspace types.Workspace, client types.Client, agent types.Agent, label string, activeOnly bool,
	from, to types.Optional[time.Time],
) ([]apptypes.SessionSummary, error)

ListSummaries returns aggregated session information.

func (*SessionDatasource) ListTreeSummaries added in v0.10.0

func (d *SessionDatasource) ListTreeSummaries(
	ctx context.Context,
	limit int,
	workspace types.Workspace,
	rootSessionID types.SessionID,
) ([]apptypes.SessionSummary, error)

ListTreeSummaries returns sessions for the tree view. Without a root filter it preserves the regular recent-session listing behavior. With a root filter it returns the requested root and its full descendant subtree. The workspace filter applies to descendants when provided, while the requested root is kept even if it is outside that workspace. The recent-session limit is intentionally not applied to descendants of an explicit root.

func (*SessionDatasource) NextChildSpawnOrder added in v0.10.0

func (d *SessionDatasource) NextChildSpawnOrder(ctx context.Context, parentSessionID types.SessionID) (int, error)

NextChildSpawnOrder returns one greater than the current maximum spawn_order among the parent's children.

func (*SessionDatasource) Save added in v0.4.0

func (d *SessionDatasource) Save(ctx context.Context, session *model.Session) error

Save persists a session label change. It is orthogonal to SaveBoundary: it writes only the label column (via a defensive idempotent insert plus UPDATE label = ?) and never touches ended_at or summary. This lets callers label a session regardless of whether it is still active or already ended, and keeps session end and session label operations from clobbering each other's columns when they race.

func (*SessionDatasource) SaveBoundary added in v0.4.0

func (d *SessionDatasource) SaveBoundary(ctx context.Context, session *model.Session, event *model.Event) error

SaveBoundary atomically persists a session aggregate together with its boundary event. Both writes are committed in a single transaction.

func (*SessionDatasource) UpdateModelIfEmpty added in v0.26.1

func (d *SessionDatasource) UpdateModelIfEmpty(ctx context.Context, sessionID types.SessionID, modelName string) (bool, error)

UpdateModelIfEmpty writes model into sessions.model when empty.

func (*SessionDatasource) UpdateSummaryIfEmpty added in v0.11.0

func (d *SessionDatasource) UpdateSummaryIfEmpty(ctx context.Context, sessionID types.SessionID, summary string) (bool, error)

UpdateSummaryIfEmpty writes summary into sessions.summary when the row's existing value is NULL or empty. Manually authored summaries are left alone. Returns true when a row was actually updated.

type StoreManagementDatasource added in v0.4.0

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

StoreManagementDatasource provides store lifecycle and maintenance operations backed by SQLite.

func NewStoreManagementDatasource added in v0.4.0

func NewStoreManagementDatasource(db *Database) *StoreManagementDatasource

NewStoreManagementDatasource creates a new StoreManagementDatasource bound to the given database.

func (*StoreManagementDatasource) ApplyOneShotSessions added in v0.31.0

ApplyOneShotSessions evaluates and commits all eligible transitions in one transaction.

func (*StoreManagementDatasource) ApplyRawBodyPlan added in v0.31.0

func (d *StoreManagementDatasource) ApplyRawBodyPlan(ctx context.Context, databaseIdentity string, sqliteUserVersion int, migrationDigest, planID string, candidates []apptypes.RawBodyCandidate, appliedAt time.Time) (apptypes.RawBodyApplyResult, error)

ApplyRawBodyPlan prunes exact candidate versions in durable, resumable batches.

func (*StoreManagementDatasource) CloseStaleSessions added in v0.4.0

func (d *StoreManagementDatasource) CloseStaleSessions(
	ctx context.Context,
	staleAfter time.Duration,
	dryRun bool,
	protectedSessionIDs []types.SessionID,
) (int, error)

CloseStaleSessions closes active sessions that have no recent events.

func (*StoreManagementDatasource) CollectGarbage added in v0.4.0

func (d *StoreManagementDatasource) CollectGarbage(
	ctx context.Context,
	before time.Time,
	target apptypes.GarbageCollectionTarget,
	dryRun bool,
) (int, error)

CollectGarbage removes or decays store records older than the given time for the selected target. Stale auto-extracted memory candidates are transitioned to expired (counted in the return value) rather than hard-deleted.

func (*StoreManagementDatasource) CreateBackup added in v0.4.0

func (d *StoreManagementDatasource) CreateBackup(ctx context.Context, outputPath string, overwrite bool) (err error)

CreateBackup creates a backup of the SQLite DB.

func (*StoreManagementDatasource) DedupeContentEvents added in v0.21.3

DedupeContentEvents reports (dry-run) or quarantines (apply) historical hook- originated prompt/transcript duplicate rows. It targets only events with client='hook' and kind in ('prompt','transcript'); command audits are never touched. Apply is transactionally safe and idempotent: a second apply finds no duplicates left in events for an already-cleaned group, so it moves nothing.

func (*StoreManagementDatasource) DeleteArchiveRows added in v0.28.0

func (d *StoreManagementDatasource) DeleteArchiveRows(ctx context.Context, idsByTable map[string][]string) (int, error)

DeleteArchiveRows implements application.StoreArchiver.

func (*StoreManagementDatasource) Initialize added in v0.4.0

func (d *StoreManagementDatasource) Initialize(ctx context.Context) error

Initialize creates the store directory, applies migrations, and sets file permissions.

func (*StoreManagementDatasource) ListArchiveEligible added in v0.28.0

ListArchiveEligible implements application.StoreArchiver.

func (*StoreManagementDatasource) ListRawBodyCandidates added in v0.31.0

func (d *StoreManagementDatasource) ListRawBodyCandidates(ctx context.Context, before time.Time) (apptypes.RawBodyRetentionSnapshot, error)

ListRawBodyCandidates returns exact eligible identities under one read snapshot.

func (*StoreManagementDatasource) PreviewOneShotSessions added in v0.31.0

PreviewOneShotSessions evaluates every evidence entry in a read-only transaction.

func (*StoreManagementDatasource) RestoreArchiveRows added in v0.28.0

func (d *StoreManagementDatasource) RestoreArchiveRows(
	ctx context.Context,
	tables []application.ArchiveTableData,
	dryRun bool,
) (inserted, skipped, conflicts int, err error)

RestoreArchiveRows implements application.StoreArchiver.

func (*StoreManagementDatasource) RestoreBackup added in v0.4.0

func (d *StoreManagementDatasource) RestoreBackup(ctx context.Context, inputPath string, overwrite bool) (err error)

RestoreBackup restores the SQLite DB from a backup file.

func (*StoreManagementDatasource) RestoreContentEventDedupeRun added in v0.21.3

func (d *StoreManagementDatasource) RestoreContentEventDedupeRun(
	ctx context.Context,
	runID string,
) (apptypes.ContentEventDedupeRestoreResult, error)

RestoreContentEventDedupeRun moves the rows quarantined by the given dedupe run back into events. It is all-or-nothing: if any original event id already exists in events, the whole restore fails (no overwrite) and nothing changes.

func (*StoreManagementDatasource) RestoreRawBodyPlan added in v0.31.0

func (d *StoreManagementDatasource) RestoreRawBodyPlan(ctx context.Context, databaseIdentity string, sqliteUserVersion int, migrationDigest, planID string, bodies []apptypes.RawBodyRecoveryBody, restoredAt time.Time) (apptypes.RawBodyRestoreResult, error)

RestoreRawBodyPlan restores exact bodies only for the execution that pruned them.

type UsageObservationDatasource added in v0.32.0

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

UsageObservationDatasource persists usage observations with serialized write transitions and immutable snapshot chains.

func NewUsageObservationDatasource added in v0.32.0

func NewUsageObservationDatasource(db *Database) *UsageObservationDatasource

NewUsageObservationDatasource creates a usage observation datasource.

func (*UsageObservationDatasource) FindByID added in v0.32.0

FindByID restores an observation by authoritative identity.

func (*UsageObservationDatasource) FindSnapshotHead added in v0.32.0

func (d *UsageObservationDatasource) FindSnapshotHead(
	ctx context.Context,
	series string,
) (types.Optional[*model.UsageObservation], error)

FindSnapshotHead restores the only unsuperseded observation in one immutable snapshot series.

func (*UsageObservationDatasource) Record added in v0.32.0

Record inserts or idempotently finalizes one authoritative observation.

func (*UsageObservationDatasource) RecordExclusive added in v0.32.0

RecordExclusive atomically grants one source observation the additive claim for a normalized identity. Later alternative sources are retained as excluded evidence regardless of delivery order or concurrency.

type WorkspaceIdentityDatasource added in v0.31.0

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

WorkspaceIdentityDatasource serves body-free diagnostics and reviewed aliases.

func NewWorkspaceIdentityDatasource added in v0.31.0

func NewWorkspaceIdentityDatasource(db *Database) *WorkspaceIdentityDatasource

NewWorkspaceIdentityDatasource constructs the workspace diagnostics adapter.

func (*WorkspaceIdentityDatasource) DeleteWorkspaceAlias added in v0.31.0

func (d *WorkspaceIdentityDatasource) DeleteWorkspaceAlias(ctx context.Context, sessionID types.SessionID, workspace types.Workspace) error

DeleteWorkspaceAlias removes one explicit reviewed alias decision.

func (*WorkspaceIdentityDatasource) SaveWorkspaceAlias added in v0.31.0

func (d *WorkspaceIdentityDatasource) SaveWorkspaceAlias(ctx context.Context, alias *model.WorkspaceAlias) error

SaveWorkspaceAlias inserts or updates an explicit operator-reviewed alias.

func (*WorkspaceIdentityDatasource) WorkspaceIdentityReport added in v0.31.0

func (d *WorkspaceIdentityDatasource) WorkspaceIdentityReport(ctx context.Context, conflictSampleLimit int) (apptypes.WorkspaceIdentityReport, error)

WorkspaceIdentityReport returns body-free attribution and delivery metrics.

Jump to

Keyboard shortcuts

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