tribler.core.libtorrent.download_manager.stream
Attributes
Exceptions
An attempt was made to create a chunk for no stream. |
|
An attempt was made to create a stream for no files. |
Classes
Holds the streaming status of a specific download. |
|
File-like object that reads a file from a torrent, and controls the dynamic buffer of the |
Module Contents
- tribler.core.libtorrent.download_manager.stream.HEADER_SIZE = 5242880
- tribler.core.libtorrent.download_manager.stream.FOOTER_SIZE = 1048576
- tribler.core.libtorrent.download_manager.stream.BUFFER_PERCENT = 0.05
- tribler.core.libtorrent.download_manager.stream.DEADLINE_PRIO_MAP = [7, 6, 6, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
- exception tribler.core.libtorrent.download_manager.stream.NotStreamingError
Bases:
ExceptionAn attempt was made to create a chunk for no stream.
- exception tribler.core.libtorrent.download_manager.stream.NoAvailableStreamError
Bases:
ExceptionAn attempt was made to create a stream for no files.
- class tribler.core.libtorrent.download_manager.stream.Stream(download: tribler.core.libtorrent.download_manager.download.Download)
Holds the streaming status of a specific download.
- _logger
- download
- file_name: pathlib.Path | None = None
- async enable(file_index: int = 0, buffer_position: int | None = None, buffer_percent: float = BUFFER_PERCENT, header_size: int = HEADER_SIZE, footer_size: int = FOOTER_SIZE) None
Sets the file index and waits for initial buffering to be completed.
- iter_pieces(have: bool | None = None, start_from: int | None = None) collections.abc.Generator[int]
Generator function that yield the pieces for the active file index.
- async wait_for_pieces(pieces_needed: list[int]) None
Waits until the specified pieces have been completed.
- bytes_to_pieces(bytes_begin: int, bytes_end: int) list[int]
Returns the pieces that represents the given byte range.
- update_priorities() None
Sets the piece priorities and deadlines according to the cursors of the outstanding stream requests.
- class tribler.core.libtorrent.download_manager.stream.StreamReader(stream: Stream, start_offset: int = 0)
File-like object that reads a file from a torrent, and controls the dynamic buffer of the stream instance according to read position.
- _logger
- stream
- file: io.BufferedReader | None = None
- async __aenter__() Self
Opens the chunk.
- async __aexit__(exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: types.TracebackType | None) None
Closes the chunk.