Documentation
¶
Overview ¶
Package reporting provides persistence seams for reporting export jobs, downloadable artifacts, and shared reporting artifacts such as saved views and published snapshots.
Index ¶
- Variables
- func HasRunExportLink(job *reportjob.Record) bool
- func ValidateAdoptionMutation(current, next *reportrun.Record, expectedRunRevision int64, ...) error
- func ValidateReportRunUpdate(current, next *reportrun.Record, expectedRevision int64) error
- func ValidateRunExportCandidate(candidate *reportjob.Record) error
- type Client
- type RunClient
- type RunExportClient
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAlreadyExists indicates a storage collision on a reporting job or artifact ID. ErrAlreadyExists = errors.New("reporting store: already exists") // ErrNotFound hides records outside the authenticated owner scope. ErrNotFound = errors.New("reporting store: not found") // ErrCASMismatch indicates that an expected revision is stale. ErrCASMismatch = errors.New("reporting store: revision mismatch") // ErrImmutable indicates an attempted mutation of a completed report // snapshot outside the one supported adoption transaction. ErrImmutable = errors.New("reporting store: completed snapshot is immutable") // ErrConflict indicates an idempotency replay whose immutable request // identity does not match the already persisted job. ErrConflict = errors.New("reporting store: conflict") // ErrSchemaRequired indicates that the additive manual T2 schema has not // been applied. Runtime store initialization never applies it. ErrSchemaRequired = errors.New("reporting store: additive T2 schema is required") // ErrInvalidTransition indicates a stale or invalid export-job lifecycle // transition. ErrInvalidTransition = errors.New("reporting store: invalid job transition") )
Functions ¶
func HasRunExportLink ¶ added in v0.1.23
HasRunExportLink reports whether any nullable T2 link field is populated. Such jobs must be created and transitioned through RunExportClient.
func ValidateAdoptionMutation ¶ added in v0.1.23
func ValidateAdoptionMutation(current, next *reportrun.Record, expectedRunRevision int64, record *reportcontext.Record, expectedContextRevision int64) error
ValidateAdoptionMutation validates the only mutation permitted for a completed run: binding an unbound manual snapshot and advancing its exact conversation pointer in one store operation.
func ValidateReportRunUpdate ¶ added in v0.1.23
ValidateReportRunUpdate protects terminal snapshots even when a caller bypasses the report-run service and invokes a store directly.
func ValidateRunExportCandidate ¶ added in v0.1.23
ValidateRunExportCandidate limits the trusted submit boundary to exact run identity plus the currently supported exporter choices. The run revision and snapshots are deliberately absent here: stores derive and copy them.
Types ¶
type Client ¶
type Client interface {
CreateJob(ctx context.Context, job *reportjob.Record) error
GetJob(ctx context.Context, jobID string) (*reportjob.Record, error)
ListJobs(ctx context.Context) ([]*reportjob.Record, error)
UpdateJob(ctx context.Context, job *reportjob.Record) error
PutArtifact(ctx context.Context, artifact *reportartifact.Record) error
GetArtifact(ctx context.Context, artifactID string) (*reportartifact.Record, error)
ListArtifacts(ctx context.Context) ([]*reportartifact.Record, error)
}
Client persists reporting export jobs and artifacts.
type RunClient ¶ added in v0.1.23
type RunClient interface {
CreateReportRun(ctx context.Context, run *reportrun.Record) error
GetReportRun(ctx context.Context, reportRunID string) (*reportrun.Record, error)
GetReportRunByRequestID(ctx context.Context, uiRunRequestID string) (*reportrun.Record, error)
UpdateReportRunCAS(ctx context.Context, run *reportrun.Record, expectedRevision int64) error
GetConversationReportContext(ctx context.Context, conversationID string) (*reportcontext.Record, error)
PutConversationReportContextCAS(ctx context.Context, record *reportcontext.Record, expectedRevision int64) error
AdoptReportRunAndContextCAS(ctx context.Context, run *reportrun.Record, expectedRunRevision int64, record *reportcontext.Record, expectedContextRevision int64) error
}
RunClient persists durable browser report runs and their active conversation pointers. Implementations must scope reads and writes to the authenticated owner in ctx.
type RunExportClient ¶ added in v0.1.23
type RunExportClient interface {
SubmitJobFromRun(ctx context.Context, candidate *reportjob.Record) (job *reportjob.Record, replay bool, err error)
ClaimJob(ctx context.Context, jobID string, startedAt time.Time) (*reportjob.Record, error)
CompleteJobWithArtifact(ctx context.Context, jobID string, artifact *reportartifact.Record, diagnostics []byte, completedAt time.Time, retentionTTL time.Duration) (*reportjob.Record, error)
FailJob(ctx context.Context, jobID, errorText string, diagnostics []byte, completedAt time.Time) (*reportjob.Record, error)
ReconcileRunningJobs(ctx context.Context, staleBefore, reconciledAt time.Time, errorText string) ([]*reportjob.Record, error)
}
RunExportClient owns the T2 transactional/recoverable boundaries. The candidate job contains trusted identity and export options only; SubmitJobFromRun must copy the snapshot from the exact persisted run.