Documentation ¶
Overview ¶
TODO(@Wondertan): Instead of doing sampling over the coordinates do a random walk over NMT trees.
Index ¶
Constants ¶
const AvailabilityTimeout = 10 * time.Minute
AvailabilityTimeout specifies timeout for DA validation during which data have to be found on the network, otherwise ErrNotAvailable is fired. TODO: https://github.com/celestiaorg/celestia-node/issues/10
Variables ¶
var DefaultSampleAmount = 16
DefaultSampleAmount sets the default amount of samples to be sampled from the network by lightAvailability.
var ErrNotAvailable = errors.New("da: data not available")
ErrNotAvailable is returned whenever DA sampling fails.
Functions ¶
Types ¶
type Availability ¶
Availability defines interface for validation of Shares' availability.
func NewLightAvailability ¶
func NewLightAvailability(get format.NodeGetter) Availability
NewLightAvailability creates a new Light DataAvailability.
type DAGNet ¶
type DAGNet struct {
// contains filtered or unexported fields
}
func (*DAGNet) CleanDAG ¶
func (dn *DAGNet) CleanDAG() format.DAGService
func (*DAGNet) CleanService ¶
func (*DAGNet) ConnectAll ¶
func (dn *DAGNet) ConnectAll()
type Root ¶
type Root = da.DataAvailabilityHeader
Root represents root commitment to multiple Shares. In practice, it is a commitment to all the Data in a square.
func RandFillDAG ¶
type Service ¶
type Service interface { Availability // erasure coded data square or block. GetShare(ctx context.Context, root *Root, row, col int) (Share, error) // It also optimistically executes erasure coding recovery. GetShares(context.Context, *Root) ([][]Share, error) // DataAvailabilityHeader as a 1D array/slice. GetSharesByNamespace(context.Context, *Root, namespace.ID) ([]Share, error) // Start starts the Service. Start(context.Context) error // Stop stops the Service. Stop(context.Context) error }
Service provides a simple interface to access any data square or block share on the network.
All Get methods follow the following flow:
- Check local storage for the requested Share.
- If exists
- Load from disk
- Return
- If not
- Find provider on the network
- Fetch the Share from the provider
- Store the Share
- Return
func NewService ¶
func NewService(dag format.DAGService, avail Availability) Service
NewService creates new basic share.Service.
type Share ¶
type Share = namespace.PrefixedData8
TODO(@Wondertan): We prefix real data of shares with namespaces to be able to recover them during erasure coding
recovery. However, that is storage and bandwidth overhead(8 bytes per each share) which we can avoid by getting namespaces from CIDs stored in IPLD NMT Nodes, instead of encoding namespaces in erasure coding.
TODO(@Wondertan): Ideally, Shares structure should be defined in a separate repository with
rsmt2d/nmt/celestia-core/celestia-node importing it. rsmt2d and nmt are already dependent on the notion of "share", so why shouldn't we have a separated and global type for it to avoid the type mess with defining own share type in each package.
Share is a fixed-size data chunk associated with a namespace ID, whose data will be erasure-coded and committed to in Namespace Merkle trees.