effusion v0.1.0 Effusion.BTP.Block View Source
A chunk of data for a download.
A block of data is distinct from a piece.
A piece is a chunk of data that is piece_length
long,
and has a 20-byte SHA-1 hash in the torrent’s pieces
array.
Blocks can be accumulated into pieces, and both have a piece index and data.
Blocks will also have an :offset
value,
indicating the data’s offset from the start of the piece with index :index
.
Link to this section Summary
Functions
Check if the two blocks are contiguous, with either b1 first or b2 first
Check that the block’s data matches the SHA-1 hash in a metadata map
Check if a block is a requisite size
Make a data structure that represents a block
Combine two contiguous blocks in the same piece into one larger block
Make a data structure for a block containing some data
Check if the first block is followed immedately by the second block, if they are in the same piece
Get the size of the data in, or identified by, a block
Split a piece into many blocks of a certain size
Drop the :offset
value from a block, indicating that it is now a whole piece
Link to this section Functions
Check if the two blocks are contiguous, with either b1 first or b2 first.
Check that the block’s data matches the SHA-1 hash in a metadata map.
Check if a block is a requisite size.
Make a data structure that represents a block.
This object carries no download data.
Combine two contiguous blocks in the same piece into one larger block.
Make a data structure for a block containing some data.
Check if the first block is followed immedately by the second block, if they are in the same piece.
Get the size of the data in, or identified by, a block.
Split a piece into many blocks of a certain size.
Drop the :offset
value from a block, indicating that it is now a whole piece.