Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { DetectionInterval time.Duration `help:"how often to run the downtime detection chore." releaseDefault:"1h0s" devDefault:"30s"` EstimationInterval time.Duration `help:"how often to run the downtime estimation chore" releaseDefault:"1h0s" devDefault:"30s"` EstimationBatchSize int `help:"the downtime estimation chore should check this many offline nodes" releaseDefault:"1000" devDefault:"100"` EstimationConcurrencyLimit int `help:"max number of concurrent connections in estimation chore" default:"10"` }
Config for the chore.
type DB ¶
type DB interface { // Add adds a record for a particular node ID with the amount of time it has been offline. Add(ctx context.Context, nodeID storj.NodeID, trackedTime time.Time, timeOffline time.Duration) error // GetOfflineTime gets the total amount of offline time for a node within a certain timeframe. // "total offline time" is defined as the sum of all offline time windows that begin inside the provided time window. // An offline time window that began before `begin` but that overlaps with the provided time window is not included. // An offline time window that begins within the provided time window, but that extends beyond `end` is included. GetOfflineTime(ctx context.Context, nodeID storj.NodeID, begin, end time.Time) (time.Duration, error) }
DB implements basic operations for downtime tracking service
architecture: Database
type DetectionChore ¶
DetectionChore looks for nodes that have not checked in and tries to contact them.
architecture: Chore
func NewDetectionChore ¶
func NewDetectionChore(log *zap.Logger, config Config, overlay *overlay.Service, service *Service) *DetectionChore
NewDetectionChore instantiates DetectionChore.
type EstimationChore ¶ added in v0.29.8
EstimationChore estimates how long nodes have been offline.
architecture: Chore
func NewEstimationChore ¶ added in v0.29.8
func NewEstimationChore(log *zap.Logger, config Config, overlay *overlay.Service, service *Service, db DB) *EstimationChore
NewEstimationChore instantiates EstimationChore.
func (*EstimationChore) Close ¶ added in v0.29.8
func (chore *EstimationChore) Close() error
Close closes chore.
type NodeOfflineTime ¶
NodeOfflineTime represents a record in the nodes_offline_time table.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a service for downtime checking.
architecture: Service
func NewService ¶
NewService creates a new downtime tracking service.
func (*Service) CheckAndUpdateNodeAvailability ¶
func (service *Service) CheckAndUpdateNodeAvailability(ctx context.Context, nodeurl storj.NodeURL) (success bool, err error)
CheckAndUpdateNodeAvailability tries to ping the supplied address and updates the uptime based on ping success or failure. Returns true if the ping and uptime updates are successful.