[−][src]Module solana::erasure
Erasure Coding and Recovery
Blobs are logically grouped into erasure sets or blocks. Each set contains 16 sequential data blobs and 4 sequential coding blobs.
Coding blobs in each set starting from start_idx
:
For each erasure set:
generate NUM_CODING
coding_blobs.
index the coding blobs from start_idx
to start_idx + NUM_CODING - 1
.
model of an erasure set, with top row being data blobs and second being coding |<======================= NUM_DATA ==============================>| |<==== NUM_CODING ===>| +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ | D | | D | | D | | D | | D | | D | | D | | D | | D | | D | +---+ +---+ +---+ +---+ +---+ . . . +---+ +---+ +---+ +---+ +---+ | C | | C | | C | | C | | | | | | | | | | | | | +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+
blob structure for coding blobs
- ------- meta is set and used by transport, meta.size is actual length | of data in the byte array blob.data | | + -- data is stuff shipped over the wire, and has an included | | header V V +----------+------------------------------------------------------------+ | meta | data | |+---+-- |+---+---+---+---+------------------------------------------+| || s | . || i | | f | s | || || i | . || n | i | l | i | || || z | . || d | d | a | z | blob.data(), or blob.data_mut() || || e | || e | | g | e | || |+---+-- || x | | s | | || | |+---+---+---+---+------------------------------------------+| +----------+------------------------------------------------------------+ | |<=== coding blob part for "coding" =======>| | | |<============== data blob part for "coding" ==============>|
Structs
CodingGenerator | Generates coding blobs on demand given data blobs |
ErasureConfig | |
Session | Represents an erasure "session" with a particular configuration and number of data and coding blobs |
Constants
ERASURE_SET_SIZE | Total number of blobs in an erasure set; includes data and coding blobs |
NUM_CODING | Number of coding blobs; also the maximum number that can go missing. |
NUM_DATA | Number of data blobs |