retention

package
v1.10.12 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountSnapshotOnlyLogicalFiles

func CountSnapshotOnlyLogicalFiles(ctx context.Context, dbconn *sql.DB) (int64, error)

CountSnapshotOnlyLogicalFiles returns the number of distinct logical files referenced by retained snapshot_file rows but absent from physical_file.

func CountSnapshotReferencedLogicalFiles

func CountSnapshotReferencedLogicalFiles(ctx context.Context, dbconn *sql.DB) (int64, error)

CountSnapshotReferencedLogicalFiles returns the number of distinct logical files referenced by retained snapshot_file rows.

func IsLogicalFileReferencedBySnapshot

func IsLogicalFileReferencedBySnapshot(ctx context.Context, rower snapshotQueryRower, logicalFileID int64) (bool, error)

IsLogicalFileReferencedBySnapshot reports whether any retained snapshot_file row references logicalFileID.

func ListAllRetainedLogicalFileIDs

func ListAllRetainedLogicalFileIDs(ctx context.Context, dbconn *sql.DB) (map[int64]struct{}, error)

ListAllRetainedLogicalFileIDs returns the union of current-state and snapshot-referenced logical_file IDs.

func ListCurrentReferencedLogicalFileIDs

func ListCurrentReferencedLogicalFileIDs(ctx context.Context, dbconn *sql.DB) (map[int64]struct{}, error)

ListCurrentReferencedLogicalFileIDs returns logical_file IDs referenced by current-state physical_file mappings.

func ListSnapshotReferencedLogicalFileIDs

func ListSnapshotReferencedLogicalFileIDs(ctx context.Context, dbconn *sql.DB) (map[int64]struct{}, error)

ListSnapshotReferencedLogicalFileIDs returns logical_file IDs referenced by retained snapshot_file entries.

func SumSnapshotReferencedLogicalBytes

func SumSnapshotReferencedLogicalBytes(ctx context.Context, dbconn *sql.DB) (int64, error)

SumSnapshotReferencedLogicalBytes returns the sum(total_size) for distinct logical files referenced by retained snapshot_file rows.

Types

type ReachabilitySummary

type ReachabilitySummary struct {
	// CurrentLogicalIDs contains logical_file IDs referenced by current-state
	// physical_file mappings.
	CurrentLogicalIDs map[int64]struct{}
	// SnapshotLogicalIDs contains logical_file IDs referenced by retained
	// snapshot_file entries.
	SnapshotLogicalIDs map[int64]struct{}
	// RetainedLogicalIDs is the union of CurrentLogicalIDs and
	// SnapshotLogicalIDs. A logical file ID present here must not be reclaimed
	// by GC.
	RetainedLogicalIDs map[int64]struct{}
}

ReachabilitySummary aggregates logical-file reachability across all retention dimensions at a single point in time.

func ComputeReachabilitySummary

func ComputeReachabilitySummary(ctx context.Context, dbconn *sql.DB) (*ReachabilitySummary, error)

ComputeReachabilitySummary queries the database for all retained logical-file IDs and returns a populated ReachabilitySummary for use in GC and other retention decisions.

type RetentionClassification

type RetentionClassification struct {
	// CurrentOnly contains logical_file IDs referenced by current-state
	// physical_file mappings only (not by any snapshot).
	CurrentOnly map[int64]struct{}
	// SnapshotOnly contains logical_file IDs referenced by retained
	// snapshot_file entries only (not by any current-state physical_file).
	SnapshotOnly map[int64]struct{}
	// Shared contains logical_file IDs referenced by both current-state
	// physical_file mappings and retained snapshot_file entries.
	Shared map[int64]struct{}
}

RetentionClassification partitions the retained logical-file ID set into three mutually exclusive buckets useful for operator-facing reporting.

func ClassifyRetention

func ClassifyRetention(summary *ReachabilitySummary) *RetentionClassification

ClassifyRetention partitions the logical-file IDs in summary into the three mutually exclusive buckets of RetentionClassification. It does not query the database; all inputs come from the pre-computed summary.

Jump to

Keyboard shortcuts

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