Documentation
¶
Overview ¶
Package datalifecycle manages cr's durable local data retention.
Index ¶
Constants ¶
const ( // LiveRetention is the default retention window for live review runs. LiveRetention = 90 * 24 * time.Hour // DryRunRetention is the default retention window for dry-run review runs. DryRunRetention = 7 * 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Layout statepaths.Layout
Store Store
Now func() time.Time
RemoveAll RemoveAllFunc
Progress ProgressReporter
}
Options contains lifecycle operation dependencies.
type OrphanItem ¶
OrphanItem describes one unreferenced artifact directory.
type ProgressReporter ¶ added in v0.9.177
type ProgressReporter interface {
Start(op, target string) ProgressSpan
}
ProgressReporter records lifecycle sub-steps without depending on a specific CLI surface.
type ProgressSpan ¶ added in v0.9.177
type ProgressSpan interface {
End(error)
}
ProgressSpan completes one lifecycle progress event.
type PruneOptions ¶
type PruneOptions struct {
OlderThan time.Duration
KeepLast *int
DryRun bool
Retention RetentionPolicy
}
PruneOptions selects runs to prune.
type PruneResult ¶
type PruneResult struct {
DryRun bool
SelectedRuns []RunItem
DeletedRuns []RunItem
OrphansRemoved []OrphanItem
Warnings []string
}
PruneResult summarizes one prune operation.
func Prune ¶
func Prune(ctx context.Context, opts Options, prune PruneOptions) (PruneResult, error)
Prune deletes selected ledger rows first, then best-effort artifact dirs.
type PurgeResult ¶
PurgeResult summarizes a whole data-root purge.
func Purge ¶
func Purge(layout statepaths.Layout, dryRun bool, yes bool, removeAll RemoveAllFunc) (PurgeResult, error)
Purge removes the whole data root without opening the ledger database.
type RemoveAllFunc ¶
RemoveAllFunc removes a path recursively.
type RetentionPolicy ¶ added in v0.1.36
type RetentionPolicy struct {
LiveMaxAge time.Duration
LiveForever bool
// DryRunMaxAge is an internal policy override for callers that own dry-run
// lifecycle separately from profile config. The zero value uses DryRunRetention.
DryRunMaxAge time.Duration
}
RetentionPolicy controls the built-in no-selector retention windows.
type RunItem ¶
type RunItem struct {
RunID string
PostMode ledger.PostMode
StartedAt time.Time
ArtifactPath string
}
RunItem describes one selected or deleted ledger run.
type Stats ¶
type Stats struct {
DataRoot string
LedgerPath string
RunsRoot string
RunCount int
LiveRuns int
DryRunRuns int
OutcomeCounts map[ledger.Outcome]int
OldestStarted *time.Time
NewestStarted *time.Time
ArtifactBytes int64
OrphanCount int
OrphanBytes int64
}
Stats summarizes local durable data.