Documentation
¶
Index ¶
- func CountSnapshotOnlyLogicalFiles(ctx context.Context, dbconn *sql.DB) (int64, error)
- func CountSnapshotReferencedLogicalFiles(ctx context.Context, dbconn *sql.DB) (int64, error)
- func IsLogicalFileReferencedBySnapshot(ctx context.Context, rower snapshotQueryRower, logicalFileID int64) (bool, error)
- func ListAllRetainedLogicalFileIDs(ctx context.Context, dbconn *sql.DB) (map[int64]struct{}, error)
- func ListCurrentReferencedLogicalFileIDs(ctx context.Context, dbconn *sql.DB) (map[int64]struct{}, error)
- func ListSnapshotReferencedLogicalFileIDs(ctx context.Context, dbconn *sql.DB) (map[int64]struct{}, error)
- func SumSnapshotReferencedLogicalBytes(ctx context.Context, dbconn *sql.DB) (int64, error)
- type ReachabilitySummary
- type RetentionClassification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountSnapshotOnlyLogicalFiles ¶
CountSnapshotOnlyLogicalFiles returns the number of distinct logical files referenced by retained snapshot_file rows but absent from physical_file.
func CountSnapshotReferencedLogicalFiles ¶
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 ¶
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.
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 ¶
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{}
// 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.