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) 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(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 {
// 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)
Update updates the stat with one measurement: number of pieces which are available even without the nodes of the selected class.
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, classifiers []NodeClassifier, reportThreshold int, asOfSystemInterval time.Duration) *Report
NewDurability creates the new instance.
func (*Report) TestChangeReporter ¶
func (c *Report) TestChangeReporter(r func(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.