strategy

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// new torrents timespan during which will NOT be examined at all
	NEW_TORRENTS_TIMESPAN = int64(15 * 60)
	// new torrents timespan during which will NOT be stalled
	NEW_TORRENTS_STALL_EXEMPTION_TIMESPAN = int64(30 * 60)
	NO_PROCESS_TORRENT_DELETEION_TIMESPAN = int64(30 * 60)
	STALL_DOWNLOAD_SPEED                  = int64(10 * 1024)
	SLOW_UPLOAD_SPEED                     = int64(100 * 1024)
	RATIO_CHECK_MIN_DOWNLOAD_SPEED        = int64(100 * 1024)
	SLOW_TORRENTS_CHECK_TIMESPAN          = int64(15 * 60)
	// stalled torrent will be deleted after this time passed
	STALL_TORRENT_DELETEION_TIMESPAN     = int64(30 * 60)
	BANDWIDTH_FULL_PERCENT               = float64(0.8)
	DELETE_TORRENT_IMMEDIATELY_SCORE     = float64(99999)
	RESUME_TORRENTS_FREE_DISK_SPACE_TIER = int64(5 * 1024 * 1024 * 1024)  // 5GB
	DELETE_TORRENTS_FREE_DISK_SPACE_TIER = int64(10 * 1024 * 1024 * 1024) // 10GB
)

Variables

This section is empty.

Functions

func RateSiteTorrent

func RateSiteTorrent(siteTorrent *site.Torrent, siteOption *BrushSiteOptionStruct) (
	score float64, predictionUploadSpeed int64, note string)

Types

type AlgorithmAddTorrent

type AlgorithmAddTorrent struct {
	DownloadUrl string
	Name        string
	Meta        map[string]int64
	Msg         string
}

type AlgorithmModifyTorrent

type AlgorithmModifyTorrent struct {
	InfoHash string
	Name     string
	Meta     map[string]int64
	Msg      string
}

type AlgorithmOperationTorrent

type AlgorithmOperationTorrent struct {
	InfoHash string
	Name     string
	Msg      string
}

type AlgorithmResult

type AlgorithmResult struct {
	DeleteTorrents  []AlgorithmOperationTorrent // torrents that will be removed from client
	StallTorrents   []AlgorithmModifyTorrent    // torrents that will stop downloading but still uploading
	ResumeTorrents  []AlgorithmOperationTorrent // resume paused / errored torrents
	ModifyTorrents  []AlgorithmModifyTorrent    // modify meta info of these torrents
	AddTorrents     []AlgorithmAddTorrent       // new torrents that will be added to client
	CanAddMore      bool                        // client is able to add more torrents
	FreeSpaceChange int64                       // estimated free space change after apply above operations
	Msg             string
}

func Decide

func Decide(clientStatus *client.Status, clientTorrents []client.Torrent, siteTorrents []site.Torrent,
	siteOption *BrushSiteOptionStruct, clientOption *BrushClientOptionStruct) (result *AlgorithmResult)

* @todo : this function requires a major rework. It's a mess right now. * * Strategy (Desired) * Delete a torrent from client when (any of the the follow criterion matches): * a. Tt's uploading speed become SLOW enough AND free disk space insufficient * b. It's consuming too much downloading bandwidth and uploading / downloading speed ratio is too low * c. It's incomplete and been totally stalled (no uploading or downloading activity) for some time * d. It's incomplete and the free discount expired (or will soon expire) * Stall ALL incomplete torrent of client (limit download speed to 1B/s, so upload only) * when free disk space insufficient * * This's somwwhat broken in qBittorrent for now (See https://github.com/qbittorrent/qBittorrent/issues/2185 ). * * Simply limiting downloading speed (to a very low tier) will also drop uploading speed to the same level * * Consider removing this behavior * Add new torrents to client when server uploading and downloading bandwidth is somewhat idle AND * there is SOME free disk space * Also: * * Use the current seeders / leechers info of torrent when make decisions

type BrushClientOptionStruct

type BrushClientOptionStruct struct {
	MinDiskSpace            int64
	SlowUploadSpeedTier     int64
	MaxDownloadingTorrents  int64
	MaxTorrents             int64
	MinRatio                float64
	DefaultUploadSpeedLimit int64
}

func GetBrushClientOptions

func GetBrushClientOptions(clientInstance client.Client) *BrushClientOptionStruct

type BrushSiteOptionStruct

type BrushSiteOptionStruct struct {
	AllowNoneFree           bool
	AllowPaid               bool
	AllowHr                 bool
	AllowZeroSeeders        bool
	TorrentUploadSpeedLimit int64
	TorrentMinSizeLimit     int64
	TorrentMaxSizeLimit     int64
	Now                     int64
	Excludes                []string
}

func GetBrushSiteOptions

func GetBrushSiteOptions(siteInstance site.Site, ts int64) *BrushSiteOptionStruct

Jump to

Keyboard shortcuts

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