Documentation
¶
Overview ¶
Package gc provides garbage collection for the content cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Interval time.Duration // How often to run (default: 1h)
StartupDelay time.Duration // Delay before first run (default: 5m)
MaxCacheBytes int64 // Target max cache size
BatchSize int // Max items to process per run (default: 1000)
CompactInterval time.Duration // How often to compact bbolt (default: 24h)
CompactThreshold float64 // Compact if free pages > threshold (default: 0.3)
}
Config configures the GC manager.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default GC configuration.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages garbage collection for the content cache.
func New ¶
func New(db metadb.MetaDB, backend backend.Backend, config Config, metrics *Metrics, logger *slog.Logger) *Manager
New creates a new GC manager.
type ManagerOption ¶
type ManagerOption func(*Manager)
ManagerOption configures a Manager.
func WithLogger ¶
func WithLogger(logger *slog.Logger) ManagerOption
WithLogger sets the logger for the manager.
func WithMetrics ¶
func WithMetrics(meter metric.Meter) ManagerOption
WithMetrics sets the metrics for the manager.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics holds GC-related OpenTelemetry metric instruments.
type Result ¶
type Result struct {
StartedAt time.Time `json:"started_at"`
Duration time.Duration `json:"duration"`
UnreferencedBlobsDeleted int `json:"unreferenced_blobs_deleted"`
OrphanBlobsDeleted int `json:"orphan_blobs_deleted"`
ExpiredMetaDeleted int `json:"expired_meta_deleted"`
LRUBlobsEvicted int `json:"lru_blobs_evicted"`
BytesReclaimed int64 `json:"bytes_reclaimed"`
Errors []string `json:"errors,omitempty"`
}
Result contains the results of a GC run.
Click to show internal directories.
Click to hide internal directories.