Documentation ¶
Overview ¶
Package durability helps us to keep segments in healthy state with reporting risks.
Index ¶
- type HealthStat
- type NodeClassifier
- type ObserverFork
- type Report
- func (c *Report) Finish(ctx context.Context) error
- func (c *Report) Fork(ctx context.Context) (rangedloop.Partial, error)
- func (c *Report) GetClass() string
- func (c *Report) Join(ctx context.Context, partial rangedloop.Partial) (err error)
- func (c *Report) Start(ctx context.Context, startTime time.Time) error
- func (c *Report) TestChangeReporter(r func(n time.Time, class string, name string, stat *HealthStat))
- type ReportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthStat ¶
type HealthStat struct { Exemplar string // contains filtered or unexported fields }
HealthStat collects the availability conditions for one class (for example: nodes with the same owner).
func (*HealthStat) Merge ¶
func (h *HealthStat) Merge(stat *HealthStat)
Merge can merge two stat to one, without losing information.
func (*HealthStat) Unused ¶
func (h *HealthStat) Unused() bool
Unused returns true when stat is uninitialized (-1) and was not updated with any number.
func (*HealthStat) Update ¶
func (h *HealthStat) Update(num int, exemplar string)
Update updates the stat with one measurement: number of pieces which are available even without the nodes of the selected class. Exemplar is one example identifier with such measurement. Useful to dig deeper, based on this one example.
type NodeClassifier ¶
type NodeClassifier func(node *nodeselection.SelectedNode) string
NodeClassifier identifies a risk class (for example an owner, or country) of the SelectedNode.
type ObserverFork ¶
type ObserverFork struct {
// contains filtered or unexported fields
}
ObserverFork is the durability calculator for each segment range.
func (*ObserverFork) Process ¶
func (c *ObserverFork) Process(ctx context.Context, segments []rangedloop.Segment) (err error)
Process implements rangedloop.Partial.
type Report ¶
type Report struct {
// contains filtered or unexported fields
}
Report is a calculator (rangloop.Observer) which checks the availability of pieces without certain nodes. It can answer the following question:
- loosing a given group of nodes (all nodes of one country or all nodes of one owner)...
- what will be the lowest humber of healhty pieces, checking all the segments.
Example: we have one segment where 80 pieces are stored, but 42 of them are in Germany.
in this case this reporter will return 38 for the class "country:DE" (assuming all the other segments are more lucky).
func NewDurability ¶
func NewDurability(db overlay.DB, metabaseDB *metabase.DB, class string, classifier NodeClassifier, maxPieceCount int, reportThreshold int, busFactorThreshold int, asOfSystemInterval time.Duration) *Report
NewDurability creates the new instance.
func (*Report) GetClass ¶ added in v1.93.1
GetClass return with the class instance name (like last_net or country).
func (*Report) TestChangeReporter ¶
func (c *Report) TestChangeReporter(r func(n time.Time, class string, name string, stat *HealthStat))
TestChangeReporter modifies the reporter for unit tests.
type ReportConfig ¶
type ReportConfig struct {
Enabled bool `help:"whether to enable durability report (rangedloop observer)" default:"true"`
}
ReportConfig configures durability report.