satellite/overlay: rename newNodePercentage to newNodeFraction
Change-Id: Ie66de91f88183b44de0773589e83e4ade9aa997a
This commit is contained in:
parent
0781a91ff4
commit
699b635e5d
@ -302,12 +302,12 @@ func (planet *Planet) newSatellites(count int) ([]*SatelliteSystem, error) {
|
||||
},
|
||||
Overlay: overlay.Config{
|
||||
Node: overlay.NodeSelectionConfig{
|
||||
UptimeCount: 0,
|
||||
AuditCount: 0,
|
||||
NewNodePercentage: 0,
|
||||
OnlineWindow: time.Minute,
|
||||
DistinctIP: false,
|
||||
MinimumDiskSpace: 100 * memory.MB,
|
||||
UptimeCount: 0,
|
||||
AuditCount: 0,
|
||||
NewNodeFraction: 0,
|
||||
OnlineWindow: time.Minute,
|
||||
DistinctIP: false,
|
||||
MinimumDiskSpace: 100 * memory.MB,
|
||||
|
||||
AuditReputationRepairWeight: 1,
|
||||
AuditReputationUplinkWeight: 1,
|
||||
|
@ -27,13 +27,13 @@ type Config struct {
|
||||
// NodeSelectionConfig is a configuration struct to determine the minimum
|
||||
// values for nodes to select
|
||||
type NodeSelectionConfig struct {
|
||||
UptimeCount int64 `help:"the number of times a node's uptime has been checked to not be considered a New Node" releaseDefault:"100" devDefault:"0"`
|
||||
AuditCount int64 `help:"the number of times a node has been audited to not be considered a New Node" releaseDefault:"100" devDefault:"0"`
|
||||
NewNodePercentage float64 `help:"the percentage of new nodes allowed per request" default:"0.05"` // TODO: fix, this is not percentage, it's ratio
|
||||
MinimumVersion string `help:"the minimum node software version for node selection queries" default:""`
|
||||
OnlineWindow time.Duration `help:"the amount of time without seeing a node before its considered offline" default:"4h"`
|
||||
DistinctIP bool `help:"require distinct IPs when choosing nodes for upload" releaseDefault:"true" devDefault:"false"`
|
||||
MinimumDiskSpace memory.Size `help:"how much disk space a node at minimum must have to be selected for upload" default:"100MB"`
|
||||
UptimeCount int64 `help:"the number of times a node's uptime has been checked to not be considered a New Node" releaseDefault:"100" devDefault:"0"`
|
||||
AuditCount int64 `help:"the number of times a node has been audited to not be considered a New Node" releaseDefault:"100" devDefault:"0"`
|
||||
NewNodeFraction float64 `help:"the fraction of new nodes allowed per request" default:"0.05"`
|
||||
MinimumVersion string `help:"the minimum node software version for node selection queries" default:""`
|
||||
OnlineWindow time.Duration `help:"the amount of time without seeing a node before its considered offline" default:"4h"`
|
||||
DistinctIP bool `help:"require distinct IPs when choosing nodes for upload" releaseDefault:"true" devDefault:"false"`
|
||||
MinimumDiskSpace memory.Size `help:"how much disk space a node at minimum must have to be selected for upload" default:"100MB"`
|
||||
|
||||
AuditReputationRepairWeight float64 `help:"weight to apply to audit reputation for total repair reputation calculation" default:"1.0"`
|
||||
AuditReputationUplinkWeight float64 `help:"weight to apply to audit reputation for total uplink reputation calculation" default:"1.0"`
|
||||
|
@ -432,7 +432,7 @@ func TestSelectNewStorageNodesExcludedIPs(t *testing.T) {
|
||||
UniqueIPCount: 2,
|
||||
Satellite: func(log *zap.Logger, index int, config *satellite.Config) {
|
||||
config.Overlay.Node.DistinctIP = true
|
||||
config.Overlay.Node.NewNodePercentage = 1
|
||||
config.Overlay.Node.NewNodeFraction = 1
|
||||
},
|
||||
},
|
||||
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
||||
|
@ -296,8 +296,8 @@ func (service *Service) FindStorageNodesWithPreferences(ctx context.Context, req
|
||||
}
|
||||
|
||||
newNodeCount := 0
|
||||
if preferences.NewNodePercentage > 0 {
|
||||
newNodeCount = int(float64(reputableNodeCount) * preferences.NewNodePercentage)
|
||||
if preferences.NewNodeFraction > 0 {
|
||||
newNodeCount = int(float64(reputableNodeCount) * preferences.NewNodeFraction)
|
||||
}
|
||||
|
||||
var newNodes []*NodeDossier
|
||||
|
@ -33,13 +33,13 @@ func TestCache_Database(t *testing.T) {
|
||||
}
|
||||
|
||||
// returns a NodeSelectionConfig with sensible test values
|
||||
func testNodeSelectionConfig(auditCount int64, newNodePercentage float64, distinctIP bool) overlay.NodeSelectionConfig {
|
||||
func testNodeSelectionConfig(auditCount int64, newNodeFraction float64, distinctIP bool) overlay.NodeSelectionConfig {
|
||||
return overlay.NodeSelectionConfig{
|
||||
UptimeCount: 0,
|
||||
AuditCount: auditCount,
|
||||
NewNodePercentage: newNodePercentage,
|
||||
OnlineWindow: time.Hour,
|
||||
DistinctIP: distinctIP,
|
||||
UptimeCount: 0,
|
||||
AuditCount: auditCount,
|
||||
NewNodeFraction: newNodeFraction,
|
||||
OnlineWindow: time.Hour,
|
||||
DistinctIP: distinctIP,
|
||||
|
||||
AuditReputationRepairWeight: 1,
|
||||
AuditReputationUplinkWeight: 1,
|
||||
|
4
scripts/testdata/satellite-config.yaml.lock
vendored
4
scripts/testdata/satellite-config.yaml.lock
vendored
@ -397,8 +397,8 @@ identity.key-path: /root/.local/share/storj/identity/satellite/identity.key
|
||||
# the minimum node software version for node selection queries
|
||||
# overlay.node.minimum-version: ""
|
||||
|
||||
# the percentage of new nodes allowed per request
|
||||
# overlay.node.new-node-percentage: 0.05
|
||||
# the fraction of new nodes allowed per request
|
||||
# overlay.node.new-node-fraction: 0.05
|
||||
|
||||
# the amount of time without seeing a node before its considered offline
|
||||
# overlay.node.online-window: 4h0m0s
|
||||
|
Loading…
Reference in New Issue
Block a user