github.com/celestiaorg/celestia-node@v0.15.0-beta.1/pruner/params.go (about) 1 package pruner 2 3 import ( 4 "time" 5 ) 6 7 type Option func(*Params) 8 9 type Params struct { 10 // gcCycle is the frequency at which the pruning Service 11 // runs the ticker. If set to 0, the Service will not run. 12 gcCycle time.Duration 13 } 14 15 func DefaultParams() Params { 16 return Params{ 17 gcCycle: time.Minute * 5, 18 } 19 } 20 21 // WithGCCycle configures how often the pruning Service 22 // triggers a pruning cycle. 23 func WithGCCycle(cycle time.Duration) Option { 24 return func(p *Params) { 25 p.gcCycle = cycle 26 } 27 } 28 29 // WithDisabledGC disables the pruning Service's pruning 30 // routine. 31 func WithDisabledGC() Option { 32 return func(p *Params) { 33 p.gcCycle = time.Duration(0) 34 } 35 } 36 37 // WithPrunerMetrics is a utility function to turn on pruner metrics and that is 38 // expected to be "invoked" by the fx lifecycle. 39 func WithPrunerMetrics(s *Service) error { 40 return s.WithMetrics() 41 }