BlockState

The four states a single block can be in. This is a pure-Kotlin port of the anonymous enum inside libtorrent's piece_picker::block_info (include/libtorrent/piece_picker.hpp).

State flows strictly forward during a healthy download: NONE โ†’ REQUESTED โ†’ WRITING โ†’ FINISHED. A block may also jump straight from NONE to WRITING or FINISHED (e.g. resume data, or a peer that hands us a whole block at once), and may fall back to NONE on abort / write-failure.

Entries

Link copied to clipboard

Not requested from anyone yet, so any peer can be asked for it.

Link copied to clipboard

A request for this block is outstanding to at least one peer.

Link copied to clipboard

The block arrived and is being flushed to disk.

Link copied to clipboard

The block is on disk (or counted as had, e.g. a pad block).

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
expect val name: String
Link copied to clipboard
expect val ordinal: Int

Functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.