placement

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelectWithReplicaset added in v1.6.0

func SelectWithReplicaset()

func Unique added in v1.6.0

Types

type BitShift added in v1.5.0

type BitShift struct {
	// contains filtered or unexported fields
}

func (*BitShift) Bump added in v1.5.0

func (b *BitShift) Bump()

func (*BitShift) Debug added in v1.5.0

func (b *BitShift) Debug()

func (*BitShift) Increment added in v1.5.0

func (b *BitShift) Increment(nodes []*nodeselection.SelectedNode, success int)

func (*BitShift) InitScoreNode added in v1.5.0

func (b *BitShift) InitScoreNode() nodeselection.ScoreNode

type Bucket added in v1.1.0

type Bucket struct {
	SegmentCount   int
	ClassExemplars []string
}

Bucket stores the number of segments (and some exemplars) for each piece count.

func (*Bucket) Increment added in v1.1.0

func (b *Bucket) Increment(classExemplar string)

Increment increments the bucket counters.

func (*Bucket) Reset added in v1.1.0

func (b *Bucket) Reset()

Reset resets the bucket counters.

type Download added in v1.15.0

type Download struct {
	util.DialerHelper
	util.Loop
	db.WithDatabase
	NodeURL      storj.NodeURL
	Bucket       string `arg:""`
	EncryptedKey string `arg:""`
	DesiredNodes int    `default:"39"`
	Selector     string `default:"tag:provider"`
	Debug        bool
}

func (*Download) Run added in v1.15.0

func (n *Download) Run() (err error)

type DownloadPool added in v1.15.0

type DownloadPool struct {
	util.DialerHelper
	util.Loop
	db.WithDatabase
	WithPlacement
	NodeURL      storj.NodeURL
	Bucket       string `arg:""`
	EncryptedKey string `arg:""`
	DesiredNodes int    `default:"39"`
	Selector     string `default:"tag:provider"`
	Debug        bool
	Placement    int
}

func (*DownloadPool) Run added in v1.15.0

func (n *DownloadPool) Run() (err error)

type Fair added in v1.5.0

type Fair struct {
	// contains filtered or unexported fields
}

func (*Fair) Bump added in v1.5.0

func (f *Fair) Bump()

func (*Fair) Debug added in v1.5.0

func (f *Fair) Debug()

func (*Fair) Increment added in v1.5.0

func (f *Fair) Increment(nodes []*nodeselection.SelectedNode, success int)

func (*Fair) InitScoreNode added in v1.5.0

func (f *Fair) InitScoreNode() nodeselection.ScoreNode

type FairTracker added in v1.5.0

type FairTracker struct {
	// contains filtered or unexported fields
}

func NewFairTracker added in v1.5.0

func NewFairTracker() *FairTracker

func (*FairTracker) BumpGeneration added in v1.5.0

func (f *FairTracker) BumpGeneration()

func (*FairTracker) Get added in v1.5.0

func (f *FairTracker) Get(uplink storj.NodeID) func(node *nodeselection.SelectedNode) float64

func (*FairTracker) Update added in v1.5.0

func (f *FairTracker) Update(node *nodeselection.SelectedNode)

type Histogram added in v1.1.0

type Histogram struct {
	// pieceCount -> {number of segments, exemplars}
	Buckets []*Bucket
	// pieceCount * -1 -> {number of segments, exemplars}
	NegativeBuckets []*Bucket
}

func (*Histogram) AddPieceCount added in v1.1.0

func (h *Histogram) AddPieceCount(pieceCount int, classExemplar string)

AddPieceCount adds a piece count to the histogram.

func (*Histogram) Reset added in v1.1.0

func (h *Histogram) Reset()

Reset resets the histogram counters.

type List

type List struct {
	db.WithDatabase
	WithPlacement
	Placement  int      `help:"placement to use"`
	Attributes []string `help:"node attributes to print out"`
	Filter     string   `help:"additional display only node filter"`
}

func (List) Run

func (s List) Run() error

type NamedNodeAttribute added in v1.1.0

type NamedNodeAttribute struct {
	Name      string
	Attribute nodeselection.NodeAttribute
}

type NodeList added in v1.5.0

type NodeList struct {
	Nodes []*nodeselection.SelectedNode
}

func (NodeList) SelectAllStorageNodesUpload added in v1.5.0

func (n NodeList) SelectAllStorageNodesUpload(ctx context.Context, selectionCfg overlay.NodeSelectionConfig) (reputable, new []*nodeselection.SelectedNode, err error)

type Nodes

type Nodes struct {
	WithPlacement
	db.WithDatabase
	Selector []string
	Filter   string

	Placement          int
	OnlineWindow       time.Duration `default:"4h"`
	MinimumDiskSpace   memory.Size   `default:"500GB"`
	IgnoreUploadFilter bool
}

func (Nodes) Run

func (s Nodes) Run() error

type Noop added in v1.5.0

type Noop struct {
}

func (*Noop) Bump added in v1.5.0

func (n *Noop) Bump()

func (*Noop) Debug added in v1.5.0

func (n *Noop) Debug()

func (*Noop) Increment added in v1.5.0

func (n *Noop) Increment(nodes []*nodeselection.SelectedNode, success int)

func (*Noop) InitScoreNode added in v1.5.0

func (n *Noop) InitScoreNode() nodeselection.ScoreNode

type NoopFailureTracker added in v1.7.0

type NoopFailureTracker struct {
}

func (*NoopFailureTracker) Get added in v1.7.0

type Placement

type Placement struct {
	Select       Select       `cmd:"" help:"select given number of nodes from DB, matching the placement rule"`
	SelectPool   SelectPool   `cmd:"" help:"select given number of nodes from DB, printing simplified pool stat"`
	Nodes        Nodes        `cmd:"" help:"load the upload cache and print out statistics"`
	List         List         `cmd:"" help:"list nodes available for selection"`
	Tags         Tags         `cmd:"" help:"report current tag distribution"`
	QueryTags    QueryTags    `cmd:"" help:"generate query for tags"`
	Simulate     Simulate     `cmd:"" help:"selection simulation with histogram"`
	Score        Score        `cmd:"" help:"print out node scores"`
	Replicasets  Replicasets  `cmd:"" help:"experiments with replicasets"`
	DownloadPool DownloadPool `cmd:"" help:"test download pool, with requesting downloads from satellite and classify received nodes"`
	Download     Download     `cmd:"" help:"initiate a download request and print out the selected nodes (using satellite)"`
}

type QueryTags added in v1.3.0

type QueryTags struct {
	Tags           []string `help:"the tags to query for, separated by commas"`
	SelfSignedTags []string `help:"the self signed tags to query for, separated by commas"`
	QueryEnd       string   `help:"the query end, default is empty"`
	Fields         []string `help:"the node table fields to return (node_id is always added)" default:""`
}

func (QueryTags) Run added in v1.3.0

func (q QueryTags) Run() error

type Replicaset added in v1.6.0

type Replicaset struct {
	RequiredNodes int
	Nodes         []*nodeselection.SelectedNode
	Invariant     func([]*nodeselection.SelectedNode, *nodeselection.SelectedNode) bool
}

func InitReplicasets added in v1.6.0

func InitReplicasets(nodes []*nodeselection.SelectedNode, required int, invariant func([]*nodeselection.SelectedNode, *nodeselection.SelectedNode) bool) []*Replicaset

func (*Replicaset) IsFull added in v1.6.0

func (r *Replicaset) IsFull() bool

func (*Replicaset) Len added in v1.6.0

func (r *Replicaset) Len() int

func (*Replicaset) Offer added in v1.6.0

func (r *Replicaset) Offer(node *nodeselection.SelectedNode) bool

type Replicasets added in v1.6.0

type Replicasets struct {
	db.WithDatabase
	Attribute string `default:"tag:host"`
	Filter    string
}

func (Replicasets) Run added in v1.6.0

func (r Replicasets) Run() error

type Score added in v1.3.0

type Score struct {
	db.WithDatabase
	Filter string `default:""`
	Score  string `default:"node_value(\"free_disk\")"`
}

func (*Score) Run added in v1.3.0

func (n *Score) Run() (err error)

type Select

type Select struct {
	WithPlacement
	db.WithDatabase
	Placement  int
	NodeNo     int    `default:"110"`
	Selector   string `default:"wallet"`
	Number     int    `default:"1"`
	Durability string `help:"node attribute to calculate the durability risk for"`
	Invariant  bool   `help:"Check invariant for all selections"`
}

func (Select) Run

func (s Select) Run() error

type SelectPool added in v1.3.0

type SelectPool struct {
	WithPlacement
	db.WithDatabase
	Placement storj.PlacementConstraint
	Selector  string
	CSV       bool
	Tracker   string `default:"noop"`
	Rps       int    `default:"400"`
	K         int    `default:"1000000"`
	FakeNodes int    `default:"0" help:"Number of fake nodes to use instead of db"`
}

func (*SelectPool) Run added in v1.3.0

func (n *SelectPool) Run() (err error)

type Simulate

type Simulate struct {
	db.WithDatabase
	Selector string
	Filter   string
	NodeNo   int `default:"110"`
	Number   int `default:"1"`
}

func (Simulate) Run

func (s Simulate) Run() error

type Tags added in v1.3.0

type Tags struct {
	db.WithDatabase
	ValueTags   []string `help:"node tags to check the value" default:""`
	CategoryTag string   `help:"node tags to categorize nodes" default:"tag:server_group"`
	Filter      string   `help:"additional display only node filter" default:""`
	All         bool
}

func (Tags) Run added in v1.3.0

func (s Tags) Run() error

type TrackerWrap added in v1.5.0

type TrackerWrap interface {
	Increment(nodes []*nodeselection.SelectedNode, success int)
	Bump()
	InitScoreNode() nodeselection.ScoreNode
	Debug()
}

type WithPlacement added in v1.5.0

type WithPlacement struct {
	PlacementConfig string `help:"location of the placement file" yaml:"placement-config"`
}

func (WithPlacement) GetPlacement added in v1.5.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL