2019-10-11 22:18:05 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package gracefulexit
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
"gopkg.in/spacemonkeygo/monkit.v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// Error is the default error class for graceful exit package.
|
|
|
|
Error = errs.Class("gracefulexit")
|
|
|
|
|
2019-10-23 02:06:01 +01:00
|
|
|
// ErrNodeNotFound is returned if a graceful exit entry for a node does not exist in database
|
|
|
|
ErrNodeNotFound = errs.Class("graceful exit node not found")
|
|
|
|
|
2019-11-08 18:57:51 +00:00
|
|
|
// ErrAboveOptimalThreshold is returned if a graceful exit entry for a node has more pieces than required.
|
|
|
|
ErrAboveOptimalThreshold = errs.Class("pointer has more pieces than required")
|
|
|
|
|
2019-10-11 22:18:05 +01:00
|
|
|
mon = monkit.Package()
|
|
|
|
)
|
|
|
|
|
|
|
|
// Config for the chore
|
|
|
|
type Config struct {
|
2019-12-09 17:30:38 +00:00
|
|
|
Enabled bool `help:"whether or not graceful exit is enabled on the satellite side." default:"true"`
|
2019-11-01 14:21:24 +00:00
|
|
|
|
2019-10-11 22:18:05 +01:00
|
|
|
ChoreBatchSize int `help:"size of the buffer used to batch inserts into the transfer queue." default:"500"`
|
|
|
|
ChoreInterval time.Duration `help:"how often to run the transfer queue chore." releaseDefault:"30s" devDefault:"10s"`
|
|
|
|
|
2019-10-24 17:24:42 +01:00
|
|
|
EndpointBatchSize int `help:"size of the buffer used to batch transfer queue reads and sends to the storage node." default:"100"`
|
|
|
|
|
2019-10-30 17:40:57 +00:00
|
|
|
MaxFailuresPerPiece int `help:"maximum number of transfer failures per piece." default:"3"`
|
2019-10-24 17:24:42 +01:00
|
|
|
OverallMaxFailuresPercentage int `help:"maximum percentage of transfer failures per node." default:"10"`
|
2019-12-09 17:30:38 +00:00
|
|
|
MaxInactiveTimeFrame time.Duration `help:"maximum inactive time frame of transfer activities per node." default:"168h"`
|
2019-10-30 17:40:57 +00:00
|
|
|
RecvTimeout time.Duration `help:"the minimum duration for receiving a stream from a storage node before timing out" default:"10m"`
|
2019-11-13 14:54:50 +00:00
|
|
|
MaxOrderLimitSendCount int `help:"maximum number of order limits a satellite sends to a node before marking piece transfer failed" default:"5"`
|
2019-12-20 21:51:13 +00:00
|
|
|
NodeMinAgeInMonths int `help:"minimum age for a node on the network in order to initiate graceful exit" default:"6"`
|
2019-10-11 22:18:05 +01:00
|
|
|
}
|