github.com/celestiaorg/celestia-node@v0.15.0-beta.1/nodebuilder/das/das.go (about) 1 package das 2 3 import ( 4 "context" 5 6 "github.com/celestiaorg/celestia-node/das" 7 ) 8 9 var _ Module = (*API)(nil) 10 11 //go:generate mockgen -destination=mocks/api.go -package=mocks . Module 12 type Module interface { 13 // SamplingStats returns the current statistics over the DA sampling process. 14 SamplingStats(ctx context.Context) (das.SamplingStats, error) 15 // WaitCatchUp blocks until DASer finishes catching up to the network head. 16 WaitCatchUp(ctx context.Context) error 17 } 18 19 // API is a wrapper around Module for the RPC. 20 // TODO(@distractedm1nd): These structs need to be autogenerated. 21 type API struct { 22 Internal struct { 23 SamplingStats func(ctx context.Context) (das.SamplingStats, error) `perm:"read"` 24 WaitCatchUp func(ctx context.Context) error `perm:"read"` 25 } 26 } 27 28 func (api *API) SamplingStats(ctx context.Context) (das.SamplingStats, error) { 29 return api.Internal.SamplingStats(ctx) 30 } 31 32 func (api *API) WaitCatchUp(ctx context.Context) error { 33 return api.Internal.WaitCatchUp(ctx) 34 }