evaluator

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAlgorithm is a rule-based scheduling algorithm.
	DefaultAlgorithm = "default"

	// PluginAlgorithm is a scheduling algorithm based on plugin extension.
	PluginAlgorithm = "plugin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Evaluator

type Evaluator interface {
	// EvaluateParents sorts and returns a list of parent peers ordered by their suitability as download sources.
	// Parents are ranked from best to worst based on a comprehensive multi-dimensional evaluation.
	EvaluateParents(parents []*standard.Peer, child *standard.Peer) []*standard.Peer

	// IsBadParent determines whether a peer is unsuitable to be selected as a parent
	// for downloading pieces.
	IsBadParent(peer *standard.Peer) bool

	// EvaluatePersistentParents sorts and returns a list of parent peers ordered by their suitability as download sources.
	// Parents are ranked from best to worst based on a comprehensive multi-dimensional evaluation.
	EvaluatePersistentParents(parents []*persistent.Peer, child *persistent.Peer) []*persistent.Peer

	// IsBadPersistentParent determines whether a peer is unsuitable to be selected as a persistent parent
	// for downloading pieces.
	IsBadPersistentParent(peer *persistent.Peer) bool

	// EvaluatePersistentCacheParents sorts and returns a list of parent peers ordered by their suitability as download sources.
	// Parents are ranked from best to worst based on a comprehensive multi-dimensional evaluation.
	EvaluatePersistentCacheParents(parents []*persistentcache.Peer, child *persistentcache.Peer) []*persistentcache.Peer

	// IsBadPersistentCacheParent determines whether a peer is unsuitable to be selected as a persistent cache parent
	// for downloading pieces.
	IsBadPersistentCacheParent(peer *persistentcache.Peer) bool
}

Evaluator is an interface that evaluates the parents.

func LoadPlugin

func LoadPlugin(dir string) (Evaluator, error)

func New

func New(algorithm string, pluginDir string) Evaluator

New returns a new Evaluator.

Jump to

Keyboard shortcuts

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