Documentation ¶
Overview ¶
Package bootstrap is a generated GoMock package.
Package bootstrap checks for the bootstrap/fallback data update from the spacemesh administrator (a centralized entity controlled by the spacemesh team). This is intended as a short-term solution at the beginning of the network deployment to facilitate recovering from network failures and should be removed once the network is stable.
The updater periodically checks for the latest update from a URL provided by the spacemesh administrator, verifies the data, persists on disk and notifies subscribers of a new update.
Subscribers register by calling `Subscribe()` to receive a channel for the latest update.
Index ¶
- Constants
- Variables
- func PersistFilename(dataDir string, epoch types.EpochID, basename string) string
- func UpdateName(epoch types.EpochID, suffix string) string
- func ValidateSchema(data []byte) error
- type Config
- type EpochData
- type EpochOverride
- type InnerData
- type MocklayerClock
- type MocklayerClockCurrentLayerCall
- func (c *MocklayerClockCurrentLayerCall) Do(f func() types.LayerID) *MocklayerClockCurrentLayerCall
- func (c *MocklayerClockCurrentLayerCall) DoAndReturn(f func() types.LayerID) *MocklayerClockCurrentLayerCall
- func (c *MocklayerClockCurrentLayerCall) Return(arg0 types.LayerID) *MocklayerClockCurrentLayerCall
- type MocklayerClockMockRecorder
- type Opt
- type Update
- type Updater
- type VerifiedUpdate
Constants ¶
const ( DefaultURL = "http://localhost:3000/bootstrap" DirName = "bootstrap" SuffixBeacon = "bc" SuffixActiveSet = "as" SuffixBootstrap = "bs" )
Variables ¶
var ( ErrWrongVersion = errors.New("wrong schema version") ErrInvalidBeacon = errors.New("invalid beacon") )
var Schema string
Functions ¶
func PersistFilename ¶
func ValidateSchema ¶
Types ¶
type Config ¶
type Config struct { URL string `mapstructure:"bootstrap-url"` Version string `mapstructure:"bootstrap-version"` DataDir string Interval time.Duration }
func DefaultConfig ¶
func DefaultConfig() Config
type EpochOverride ¶
type MocklayerClock ¶
type MocklayerClock struct {
// contains filtered or unexported fields
}
MocklayerClock is a mock of layerClock interface.
func NewMocklayerClock ¶
func NewMocklayerClock(ctrl *gomock.Controller) *MocklayerClock
NewMocklayerClock creates a new mock instance.
func (*MocklayerClock) CurrentLayer ¶
func (m *MocklayerClock) CurrentLayer() types.LayerID
CurrentLayer mocks base method.
func (*MocklayerClock) EXPECT ¶
func (m *MocklayerClock) EXPECT() *MocklayerClockMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MocklayerClockCurrentLayerCall ¶ added in v1.4.0
MocklayerClockCurrentLayerCall wrap *gomock.Call
func (*MocklayerClockCurrentLayerCall) Do ¶ added in v1.4.0
func (c *MocklayerClockCurrentLayerCall) Do(f func() types.LayerID) *MocklayerClockCurrentLayerCall
Do rewrite *gomock.Call.Do
func (*MocklayerClockCurrentLayerCall) DoAndReturn ¶ added in v1.4.0
func (c *MocklayerClockCurrentLayerCall) DoAndReturn(f func() types.LayerID) *MocklayerClockCurrentLayerCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MocklayerClockCurrentLayerCall) Return ¶ added in v1.4.0
func (c *MocklayerClockCurrentLayerCall) Return(arg0 types.LayerID) *MocklayerClockCurrentLayerCall
Return rewrite *gomock.Call.Return
type MocklayerClockMockRecorder ¶
type MocklayerClockMockRecorder struct {
// contains filtered or unexported fields
}
MocklayerClockMockRecorder is the mock recorder for MocklayerClock.
func (*MocklayerClockMockRecorder) CurrentLayer ¶
func (mr *MocklayerClockMockRecorder) CurrentLayer() *MocklayerClockCurrentLayerCall
CurrentLayer indicates an expected call of CurrentLayer.
type Opt ¶
type Opt func(*Updater)
func WithConfig ¶
func WithFilesystem ¶
func WithHttpClient ¶
func WithLogger ¶
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
func (*Updater) Downloaded ¶ added in v1.1.0
func (*Updater) Subscribe ¶
func (u *Updater) Subscribe() (<-chan *VerifiedUpdate, error)
type VerifiedUpdate ¶
type VerifiedUpdate struct { Data *EpochOverride Persisted string }
func (*VerifiedUpdate) MarshalLogObject ¶
func (vd *VerifiedUpdate) MarshalLogObject(encoder log.ObjectEncoder) error