MCPcopy
hub / github.com/grafana/dskit / Validate

Method Validate

ring/lifecycler.go:109–125  ·  view source on GitHub ↗

Validate checks the consistency of LifecyclerConfig, and fails if this cannot be achieved.

()

Source from the content-addressed store, hash-verified

107
108// Validate checks the consistency of LifecyclerConfig, and fails if this cannot be achieved.
109func (cfg *LifecyclerConfig) Validate() error {
110 _, ok := cfg.RingTokenGenerator.(*SpreadMinimizingTokenGenerator)
111 if ok {
112 // If cfg.RingTokenGenerator is a SpreadMinimizingTokenGenerator, we must ensure that
113 // the tokens are not loaded from file.
114 if cfg.TokensFilePath != "" {
115 return errors.New("you can't configure the tokens file path when using the spread minimizing token strategy. Please set the tokens file path to an empty string")
116 }
117 }
118 if cfg.HeartbeatPeriod == 0 {
119 return errors.New("heartbeat period must be greater than 0")
120 }
121 if cfg.HeartbeatTimeout == 0 {
122 return errors.New("heartbeat timeout must be greater than 0")
123 }
124 return nil
125}
126
127/*
128Lifecycler is a Service that is responsible for publishing changes to a ring for a single instance.

Callers 1

NewLifecyclerFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected