Documentation
¶
Overview ¶
Package indexgc runs a bounded, best-effort background sweep that removes stale entity-store index (collection) entries whose backing entity is gone.
The source of these orphans was fixed upstream (atomic deletes, lease-bound session index entries), so this exists to drain any legacy backlog on upgrade and to keep a cluster self-healing if a future leak ever reappears, without anyone having to run `miren debug reindex` by hand. It deliberately does its work off the read path: foreground reads stay pure and never issue deletes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCConfig ¶
type GCConfig struct {
// CheckInterval is how often to run a sweep.
CheckInterval time.Duration
// MaxDeletesPerSweep caps deletions per sweep so a large legacy backlog
// drains over several sweeps rather than one thundering pass. Zero means
// unbounded.
MaxDeletesPerSweep int
// BatchPause is slept periodically during deletion to rate-limit write
// pressure. Zero disables pacing.
BatchPause time.Duration
// SweepTimeout bounds a single sweep. A truncated sweep is fine: the next
// one resumes the work, since the pass is idempotent.
SweepTimeout time.Duration
}
GCConfig tunes the background sweep. Defaults are intentionally gentle: this is convergence insurance, not active firefighting, so it drains slowly and stays out of the way.
func DefaultGCConfig ¶
func DefaultGCConfig() GCConfig
DefaultGCConfig returns the default (gentle) configuration.
type GCController ¶
type GCController struct {
Log *slog.Logger
Store *entity.EtcdStore
Config GCConfig
// contains filtered or unexported fields
}
GCController periodically removes stale collection entries from the entity store. It operates directly on the EtcdStore's CAS-guarded cleanup rather than going through the entity-access client, since it works below the index it is repairing.
func (*GCController) Start ¶
func (c *GCController) Start(ctx context.Context)
Start begins the periodic sweep.