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