Documentation ¶
Index ¶
- Variables
- func BenchGetHalfAxisFromAccessor(ctx context.Context, b *testing.B, newAccessor func(size int) Accessor, ...)
- func BenchGetSampleFromAccessor(ctx context.Context, b *testing.B, newAccessor func(size int) Accessor, ...)
- func NamespaceData(ctx context.Context, eds Accessor, namespace share.Namespace) (shwap.NamespaceData, error)
- func ReadShares(r io.Reader, shareSize, odsSize int) ([]share.Share, error)
- func TestStreamer(ctx context.Context, t *testing.T, create createAccessorStreamer, odsSize int)
- func TestSuiteAccessor(ctx context.Context, t *testing.T, createAccessor createAccessor, maxSize int)
- type Accessor
- type AccessorStreamer
- type AxisHalf
- type Rsmt2D
- func (eds *Rsmt2D) AxisHalf(_ context.Context, axisType rsmt2d.Axis, axisIdx int) (AxisHalf, error)
- func (eds *Rsmt2D) AxisRoots(context.Context) (*share.AxisRoots, error)
- func (eds *Rsmt2D) Close() error
- func (eds *Rsmt2D) DataHash(context.Context) (share.DataHash, error)
- func (eds *Rsmt2D) HalfRow(idx int, side shwap.RowSide) shwap.Row
- func (eds *Rsmt2D) Reader() (io.Reader, error)
- func (eds *Rsmt2D) RowNamespaceData(_ context.Context, namespace share.Namespace, rowIdx int) (shwap.RowNamespaceData, error)
- func (eds *Rsmt2D) Sample(_ context.Context, rowIdx, colIdx int) (shwap.Sample, error)
- func (eds *Rsmt2D) SampleForProofAxis(rowIdx, colIdx int, proofType rsmt2d.Axis) (shwap.Sample, error)
- func (eds *Rsmt2D) Shares(_ context.Context) ([]share.Share, error)
- func (eds *Rsmt2D) Size(context.Context) int
- type ShareReader
- type Streamer
Constants ¶
This section is empty.
Variables ¶
var EmptyAccessor = &Rsmt2D{ExtendedDataSquare: share.EmptyEDS()}
EmptyAccessor is an accessor of an empty EDS block.
var ErrOutOfBounds = errors.New("index is out of bounds")
ErrOutOfBounds is returned whenever an index is out of bounds.
Functions ¶
func NamespaceData ¶
func NamespaceData( ctx context.Context, eds Accessor, namespace share.Namespace, ) (shwap.NamespaceData, error)
NamespaceData extracts shares for a specific namespace from an EDS, considering each row independently. It uses root to determine which rows to extract data from, avoiding the need to recalculate the row roots for each row.
func ReadShares ¶
ReadShares reads shares from the provided io.Reader until EOF. If EOF is reached, the remaining shares are populated as tail padding shares. Provided reader must contain shares in row-major order.
func TestStreamer ¶
Types ¶
type Accessor ¶
type Accessor interface { // Size returns square size of the Accessor. Size(ctx context.Context) int // DataHash returns data hash of the Accessor. DataHash(ctx context.Context) (share.DataHash, error) // AxisRoots returns share.AxisRoots (DataAvailabilityHeader) of the Accessor. AxisRoots(ctx context.Context) (*share.AxisRoots, error) // Sample returns share and corresponding proof for row and column indices. Implementation can // choose which axis to use for proof. Chosen axis for proof should be indicated in the returned // Sample. Sample(ctx context.Context, rowIdx, colIdx int) (shwap.Sample, error) // AxisHalf returns half of shares axis of the given type and index. Side is determined by // implementation. Implementations should indicate the side in the returned AxisHalf. AxisHalf(ctx context.Context, axisType rsmt2d.Axis, axisIdx int) (AxisHalf, error) // RowNamespaceData returns data for the given namespace and row index. RowNamespaceData(ctx context.Context, namespace share.Namespace, rowIdx int) (shwap.RowNamespaceData, error) Shares(ctx context.Context) ([]share.Share, error) }
Accessor is an interface for accessing extended data square data.
func WithValidation ¶
type AccessorStreamer ¶
AccessorStreamer is an interface that groups Accessor and Streamer interfaces.
func AccessorAndStreamer ¶
func AccessorAndStreamer(a Accessor, s Streamer) AccessorStreamer
func WithClosedOnce ¶
func WithClosedOnce(f AccessorStreamer) AccessorStreamer
func WithProofsCache ¶
func WithProofsCache(ac AccessorStreamer) AccessorStreamer
WithProofsCache creates a new eds accessor with caching of proofs for rows and columns. It is used to speed up the process of building proofs for rows and columns, reducing the number of reads from the underlying accessor.
type AxisHalf ¶
type AxisHalf struct { // IsParity indicates whether the half is parity or data. IsParity bool }
AxisHalf represents a half of data for a row or column in the EDS.
type Rsmt2D ¶
type Rsmt2D struct {
*rsmt2d.ExtendedDataSquare
}
Rsmt2D is a rsmt2d based in-memory implementation of Accessor.
func ReadAccessor ¶
ReadAccessor reads up EDS out of the io.Reader until io.EOF and provides.
func Rsmt2DFromShares ¶
Rsmt2DFromShares constructs an Extended Data Square from shares.
func (*Rsmt2D) AxisHalf ¶
AxisHalf returns Shares for the first half of the axis of the given type and index.
func (*Rsmt2D) HalfRow ¶
HalfRow constructs a new shwap.Row from an Extended Data Square based on the specified index and side.
func (*Rsmt2D) RowNamespaceData ¶
func (eds *Rsmt2D) RowNamespaceData( _ context.Context, namespace share.Namespace, rowIdx int, ) (shwap.RowNamespaceData, error)
RowNamespaceData returns data for the given namespace and row index.
func (*Rsmt2D) SampleForProofAxis ¶
func (eds *Rsmt2D) SampleForProofAxis( rowIdx, colIdx int, proofType rsmt2d.Axis, ) (shwap.Sample, error)
SampleForProofAxis samples a share from an Extended Data Square based on the provided row and column indices and proof axis. It returns a sample with the share and proof.
type ShareReader ¶
type ShareReader struct {
// contains filtered or unexported fields
}
ShareReader implement io.Reader over general function that gets shares by their respective Row and Col coordinates. It enables share streaming over arbitrary storages.
func NewShareReader ¶
func NewShareReader(odsSize int, getShare func(rowIdx, colIdx int) ([]byte, error)) *ShareReader
NewShareReader constructs a new ShareGetter from underlying ODS size and general share getting function.