Documentation ¶
Index ¶
- type Broker
- type Config
- type Svc
- func (s *Svc) Checkpoint() ([]byte, error)
- func (s *Svc) GetState(k string) ([]byte, []types.StateProvider, error)
- func (s *Svc) Keys() []string
- func (s *Svc) Load(ctx context.Context, data []byte) error
- func (s *Svc) LoadState(ctx context.Context, payload *types.Payload) ([]types.StateProvider, error)
- func (*Svc) Name() types.CheckpointName
- func (s *Svc) Namespace() types.SnapshotNamespace
- func (s *Svc) NotifyOnEpoch(f func(context.Context, types.Epoch), r func(context.Context, types.Epoch))
- func (s *Svc) OnBlockEnd(ctx context.Context)
- func (s *Svc) OnEpochLengthUpdate(ctx context.Context, l time.Duration) error
- func (s *Svc) OnTick(ctx context.Context, t time.Time)
- func (s *Svc) ReloadConf(conf Config)
- func (s *Svc) Stopped() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config represent the configuration of vegatime service.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type Svc ¶
type Svc struct {
// contains filtered or unexported fields
}
Svc represents the Service managing epoch inside Vega.
func NewService ¶
NewService instantiates a new epochtime service.
func (*Svc) Checkpoint ¶
func (*Svc) Name ¶
func (*Svc) Name() types.CheckpointName
func (*Svc) Namespace ¶
func (s *Svc) Namespace() types.SnapshotNamespace
func (*Svc) NotifyOnEpoch ¶
func (s *Svc) NotifyOnEpoch(f func(context.Context, types.Epoch), r func(context.Context, types.Epoch))
NotifyOnEpoch allows other services to register 2 callback functions. The first will be called once we enter or leave a new epoch, and the second will be called when the epoch service has been restored from a snapshot.
func (*Svc) OnBlockEnd ¶
OnBlockEnd handles a callback from the abci when the block ends.
func (*Svc) OnEpochLengthUpdate ¶
func (*Svc) OnTick ¶
NB: An epoch is ended when the first block that exceeds the expiry of the current epoch ends. As onTick is called from onBlockStart - to make epoch continuous and avoid no man's epoch - once we get the first block past expiry we mark get ready to end the epoch. Once we get the on block end callback we're setting the flag to be ready to start a new block on the next onTick (i.e. preceding the beginning of the next block). Once we get the next block's on tick we close the epoch and notify on its end and start a new epoch (with incremented sequence) and notify about it.
func (*Svc) ReloadConf ¶
ReloadConf reload the configuration for the epochtime service.