Documentation ¶
Index ¶
- Variables
- func ConstructModule(tp node.Type, cfg *Config, options ...fx.Option) fx.Option
- type API
- func (api *API) GetEDS(ctx context.Context, root *share.Root) (*rsmt2d.ExtendedDataSquare, error)
- func (api *API) GetShare(ctx context.Context, dah *share.Root, row, col int) (share.Share, error)
- func (api *API) GetSharesByNamespace(ctx context.Context, root *share.Root, namespace namespace.ID) (share.NamespacedShares, error)
- func (api *API) ProbabilityOfAvailability(ctx context.Context) float64
- func (api *API) SharesAvailable(ctx context.Context, root *share.Root) error
- type Config
- type Module
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNegativeInterval = errors.New("interval must be positive")
)
Functions ¶
Types ¶
type API ¶ added in v0.5.0
type API struct { Internal struct { SharesAvailable func(context.Context, *share.Root) error `perm:"public"` ProbabilityOfAvailability func(context.Context) float64 `perm:"public"` GetShare func( ctx context.Context, dah *share.Root, row, col int, ) (share.Share, error) `perm:"public"` GetEDS func( ctx context.Context, root *share.Root, ) (*rsmt2d.ExtendedDataSquare, error) `perm:"public"` GetSharesByNamespace func( ctx context.Context, root *share.Root, namespace namespace.ID, ) (share.NamespacedShares, error) `perm:"public"` } }
API is a wrapper around Module for the RPC. TODO(@distractedm1nd): These structs need to be autogenerated.
func (*API) GetSharesByNamespace ¶ added in v0.5.0
func (*API) ProbabilityOfAvailability ¶ added in v0.5.0
type Config ¶
type Config struct { // PeersLimit defines how many peers will be added during discovery. PeersLimit uint // DiscoveryInterval is an interval between discovery sessions. DiscoveryInterval time.Duration // AdvertiseInterval is a interval between advertising sessions. // NOTE: only full and bridge can advertise themselves. AdvertiseInterval time.Duration // NOTE: This config variable only has an effect on full and bridge nodes. UseShareExchange bool // ShrExEDSParams sets shrexeds client and server configuration parameters ShrExEDSParams *shrexeds.Parameters // ShrExNDParams sets shrexnd client and server configuration parameters ShrExNDParams *shrexnd.Parameters // PeerManagerParams sets peer-manager configuration parameters PeerManagerParams peers.Parameters }
func DefaultConfig ¶
func DefaultConfig() Config
type Module ¶
type Module interface { // the Network. SharesAvailable(context.Context, *share.Root) error // ProbabilityOfAvailability calculates the probability of the data square // being available based on the number of samples collected. ProbabilityOfAvailability(context.Context) float64 GetShare(ctx context.Context, dah *share.Root, row, col int) (share.Share, error) // GetEDS gets the full EDS identified by the given root. GetEDS(ctx context.Context, root *share.Root) (*rsmt2d.ExtendedDataSquare, error) // Shares are returned in a row-by-row order if the namespace spans multiple rows. GetSharesByNamespace(ctx context.Context, root *share.Root, namespace namespace.ID) (share.NamespacedShares, error) }
Module provides access to any data square or block share on the network.
All Get methods provided on Module 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
Any method signature changed here needs to also be changed in the API struct.
Click to show internal directories.
Click to hide internal directories.