Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RetrieveQuadrantTimeout = blockTime / numQuadrants * 2
RetrieveQuadrantTimeout defines how much time Retriever waits before starting to retrieve another quadrant.
NOTE: - The whole data square must be retrieved in less than block time. - We have 4 quadrants from two sources(rows, cols) which equals to 8 in total.
Functions ¶
This section is empty.
Types ¶
type Retriever ¶
type Retriever struct {
// contains filtered or unexported fields
}
Retriever retrieves rsmt2d.ExtendedDataSquares from the IPLD network. Instead of requesting data 'share by share' it requests data by quadrants minimizing bandwidth usage in the happy cases.
---- ---- | 0 | 1 | ---- ---- | 2 | 3 | ---- ----
Retriever randomly picks one of the data square quadrants and tries to request them one by one until it is able to reconstruct the whole square.
func NewRetriever ¶
func NewRetriever(bServ blockservice.BlockService) *Retriever
NewRetriever creates a new instance of the Retriever over IPLD BlockService and rmst2d.Codec
func (*Retriever) Retrieve ¶
func (r *Retriever) Retrieve(ctx context.Context, dah *da.DataAvailabilityHeader) (*rsmt2d.ExtendedDataSquare, error)
Retrieve retrieves all the data committed to DataAvailabilityHeader.
If not available locally, it aims to request from the network only one quadrant (1/4) of the data square and reconstructs the other three quadrants (3/4). If the requested quadrant is not available within RetrieveQuadrantTimeout, it starts requesting another quadrant until either the data is reconstructed, context is canceled or ErrByzantine is generated.