Package-level declarations
Types
The disk subsystem boundary. This is the Kotlin counterpart of libtorrent's disk_interface (disk_interface.hpp). libtorrent dispatches each operation to a thread pool and hands back the result through a completion callback; here every operation simply suspends, so the caller writes straight-line coroutine code and the implementation is free to run blocking file I/O on an I/O dispatcher.
A DiskIo backed by real files under basePath, via the platform RandomAccessStorage. Ports the piece↔file mapping logic of libtorrent's default_storage/mmap_storage (storage_utils.cpp): the torrent is a single concatenated byte stream, and a piece read/write fans out across whichever files its byte range overlaps.
A DiskIo that keeps the whole torrent in one in-memory buffer. The BitTorrent piece model treats the files as a single concatenated byte stream, so piece p lives at p * pieceLength within that stream, which is exactly this buffer. Per-file boundaries only matter when writing to real files (FileDiskIo); here one buffer is the simplest correct model.
Result of hashing a piece: its v1 SHA-1 and (for v2 torrents) per-16KiB-block SHA-256 leaves.
Android random-access file: identical to the JVM actual (java.io is available on Android).
Random-access file handle. This is the one thing a torrent client needs from the filesystem that has no common-stdlib equivalent: reading and writing at an arbitrary byte offset. kotlinx-io's FileSystem is stream-oriented, so this is a small platform expect/actual (RandomAccessFile on JVM/Android, POSIX fseeko/fread/fwrite on Apple).
Apple (iOS/macOS) random-access file via POSIX stdio with positional seeks.
JVM/desktop random-access file via RandomAccessFile (seek + positional read/write).
How files are laid out on disk. This is the port of libtorrent's storage_mode_t (storage_defs.hpp).