tribler.core.torrent_checker.healthdataclasses

Attributes

MINUTE

HOUR

TOLERABLE_TIME_DRIFT

TORRENT_CHECK_WINDOW

HEALTH_FRESHNESS_SECONDS

Classes

Source

Source of the Torrent Health information.

HealthInfo

An entry that described the health of a torrent at a particular moment in time.

TrackerResponse

A list of health responses for the given url.

Module Contents

tribler.core.torrent_checker.healthdataclasses.MINUTE = 60
tribler.core.torrent_checker.healthdataclasses.HOUR = 3600
tribler.core.torrent_checker.healthdataclasses.TOLERABLE_TIME_DRIFT = 60
tribler.core.torrent_checker.healthdataclasses.TORRENT_CHECK_WINDOW = 60
tribler.core.torrent_checker.healthdataclasses.HEALTH_FRESHNESS_SECONDS = 14400
class tribler.core.torrent_checker.healthdataclasses.Source

Bases: enum.IntEnum

Source of the Torrent Health information.

UNKNOWN = 0
DHT = 1
TRACKER = 2
POPULARITY_COMMUNITY = 3
class tribler.core.torrent_checker.healthdataclasses.HealthInfo

An entry that described the health of a torrent at a particular moment in time.

infohash: bytes
seeders: int = 0
leechers: int = 0
last_check: int
self_checked: bool = False
source: Source
tracker: str = ''
is_valid() bool

Whether the reported seeders and leechers are > 0 and the check was performed at most a minute in the future.

old() bool

Whether this check is more than 4 hours old.

older_than(other: HealthInfo) bool

Whether this check is older than the given check.

much_older_than(other: HealthInfo) bool

Whether this check is more than 4 hours older than the given check.

should_replace(prev: HealthInfo) bool

Whether this check should replace the given check.

to_api_response() dict

Serialize the dataclass to a JSON-compatible dictionary for REST API responses.

class tribler.core.torrent_checker.healthdataclasses.TrackerResponse

A list of health responses for the given url.

url: str
torrent_health_list: list[HealthInfo]