Documentation ¶
Overview ¶
Package durability helps us to keep segments in healthy state with reporting risks.
Index ¶
- type Bucket
- type ClassGroupCounter
- type ClassGroupCounters
- type ClassID
- type Config
- type Histogram
- type HistogramByPlacement
- type NodeClassifier
- type NodeGetter
- 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) (err error)
- func (c *Report) TestChangeReporter(r func(n time.Time, class string, missingProvider int, ix int, ...))
- type ReportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶ added in v1.109.3
Bucket stores the number of segments (and some exemplars) for each piece count.
type ClassGroupCounter ¶ added in v1.109.3
ClassGroupCounter is a helper struct to count the number of pieces in a class.
type ClassGroupCounters ¶ added in v1.109.3
type ClassGroupCounters struct {
Counters []ClassGroupCounter
}
ClassGroupCounters is a helper struct to count the number of pieces in each class.
func (*ClassGroupCounters) Increment ¶ added in v1.109.3
func (c *ClassGroupCounters) Increment(class ClassID)
Increment increments the counter for the given class.
type ClassID ¶ added in v1.109.3
type ClassID int32
ClassID is a fork level short identifier for each class.
type Config ¶ added in v1.117.7
type Config struct {
Classes []string `help:"Node attributes used by the durability segment loop to classify risks" default:"last_net,last_ip,wallet,email"`
}
Config contains configuration for the durability ranged loop observer.
func (Config) CreateNodeClassifiers ¶ added in v1.117.7
func (c Config) CreateNodeClassifiers() (map[string]NodeClassifier, error)
CreateNodeClassifiers creates a list of node classifiers based on the configuration.
type Histogram ¶ added in v1.109.3
type Histogram struct { // pieceCount -> {number of segments, exemplars} Buckets []*Bucket // pieceCount * -1 -> {number of segments, exemplars} NegativeBuckets []*Bucket }
Histogram stores the number of segments (and some exemplars) for each piece count.
func (*Histogram) AddPieceCount ¶ added in v1.109.3
func (h *Histogram) AddPieceCount(pieceCount int, segmentExemplar uuid.UUID, segmentExemplarPosition metabase.SegmentPosition, classExemplar ClassID)
AddPieceCount adds a piece count to the histogram.
type HistogramByPlacement ¶ added in v1.110.4
type HistogramByPlacement []Histogram // placement -> Histogram
HistogramByPlacement contains multiple Histogram for each Placement.
func (*HistogramByPlacement) Extend ¶ added in v1.110.4
func (p *HistogramByPlacement) Extend(size int)
Extend will make sure the placement has an initialized Histogram.
func (*HistogramByPlacement) Reset ¶ added in v1.110.4
func (p *HistogramByPlacement) Reset()
Reset will reset all the included Histograms.
type NodeClassifier ¶
type NodeClassifier func(node *nodeselection.SelectedNode) string
NodeClassifier identifies a risk class (for example an owner, or country) of the SelectedNode.
type NodeGetter ¶ added in v1.109.3
type NodeGetter interface {
GetNodes(ctx context.Context, validUpTo time.Time, nodeIDs []storj.NodeID, selectedNodes []nodeselection.SelectedNode) ([]nodeselection.SelectedNode, error)
}
NodeGetter returns node information required by the durability loop.
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 { Class string // 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, nodeGetter NodeGetter, class string, classifier NodeClassifier, 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).
type ReportConfig ¶
type ReportConfig struct {
Enabled bool `help:"whether to enable durability report (rangedloop observer)" default:"true"`
}
ReportConfig configures durability report.