MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / SetOrphanGCConfig

Method SetOrphanGCConfig

internal/server/orphan_gc.go:545–564  ·  view source on GitHub ↗

SetOrphanGCConfig overrides the default sweep interval (24h) and grace period (30d). Pass 0 for either to keep the package default. Must be called before StartOrphanGC.

(interval, grace time.Duration)

Source from the content-addressed store, hash-verified

543// grace period (30d). Pass 0 for either to keep the package default.
544// Must be called before StartOrphanGC.
545func (s *Server) SetOrphanGCConfig(interval, grace time.Duration) {
546 s.orphanGC.mu.Lock()
547 defer s.orphanGC.mu.Unlock()
548 if interval > 0 {
549 s.orphanGC.interval = interval
550 }
551 if grace > 0 {
552 // A grace shorter than a copy transaction lets the sweep claim a
553 // soft-deleted source row the copy has already planned from, and
554 // reclaim its blob before the clone commits. Floor it at the window
555 // the reference-stamp protocol already accepts for slow writers
556 // (TASK-4280).
557 if grace < orphanGCRefStaleWindow {
558 slog.Warn("orphan GC: configured grace is below the minimum and was raised",
559 "configured", grace.String(), "effective", orphanGCRefStaleWindow.String())
560 grace = orphanGCRefStaleWindow
561 }
562 s.orphanGC.grace = grace
563 }
564}
565
566// StartOrphanGC kicks off the periodic sweep loop. Idempotent —
567// calling twice is a no-op (existing loop continues, second call

Callers 3

TestOrphanGC_StartStopFunction · 0.80
serveCmdFunction · 0.80

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
StringMethod · 0.45