PieceBlock

data class PieceBlock(val pieceIndex: Int, val blockIndex: Int) : Comparable<PieceBlock>

Identifies a single block within a piece. This is a pure-Kotlin port of libtorrent's piece_block (include/libtorrent/piece_block.hpp).

A piece is the unit the .torrent metadata hashes; a block is the unit a peer actually requests over the wire (16 KiB by default). pieceIndex is a plain piece index and blockIndex is the 0-based block offset inside that piece. Both are plain Int (v0 KiteTorrent does not use strong index types).

The C++ type defines a total order (piece first, then block) and value equality; we mirror both so blocks can live in sorted/hashed containers.

Constructors

Link copied to clipboard
constructor(pieceIndex: Int, blockIndex: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open operator override fun compareTo(other: PieceBlock): Int