Module solana_ledger::shred

source ·
Expand description

The shred module defines data structures and methods to pull MTU sized data frames from the network. There are two types of shreds: data and coding. Data shreds contain entry information while coding shreds provide redundancy to protect against dropped network packets (erasures).

+———————————————————————————————+ | Data Shred | +———————————————————————————————+ | common | data | payload | | header | header | | |+—+—+— |+—+—+—|+–––––––––––––––––––––––––––––+––+| || s | s | . || p | f | s || data (ie ledger entries) | r || || i | h | . || a | l | i || | e || || g | r | . || r | a | z || See notes immediately after shred diagrams for an | s || || n | e | || e | g | e || explanation of the “restricted” section in this payload | t || || a | d | || n | s | || | r || || t | | || t | | || | i || || u | t | || | | || | c || || r | y | || o | | || | t || || e | p | || f | | || | e || || | e | || f | | || | d || |+—+—+— |+—+—+—+|–––––––––––––––––––––––––––––+––+| +———————————————————————————————+

+———————————————————————————————+ | Coding Shred | +———————————————————————————————+ | common | coding | payload | | header | header | | |+—+—+— |+—+—+—+––––––––––––––––––––––––––––––––+| || s | s | . || n | n | p || data (encoded data shred data) || || i | h | . || u | u | o || || || g | r | . || m | m | s || || || n | e | || | | i || || || a | d | || d | c | t || || || t | | || | | i || || || u | t | || s | s | o || || || r | y | || h | h | n || || || e | p | || r | r | || || || | e | || e | e | || || || | | || d | d | || || |+—+—+— |+—+—+—+|+–––––––––––––––––––––––––––––––+| +———————————————————————————————+

Notes: a) Coding shreds encode entire data shreds: both of the headers AND the payload. b) Coding shreds require their own headers for identification and etc. c) The erasure algorithm requires data shred and coding shred bytestreams to be equal in length.

So, given a) - c), we must restrict data shred’s payload length such that the entire coding payload can fit into one coding shred / packet.

Modules§

Structs§

Enums§

Constants§

Functions§

Type Aliases§