Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
EpochDuration = time.Hour * 24
)
View Source
var (
ErrElectionBeforeGenesis = errors.New("election time/tick before genesis timestamp")
)
Functions ¶
func NewElectionAlgorithm ¶
func NewElectionAlgorithm(group *Context) *electionAlgorithm
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) EpochStats ¶
func (obj *API) EpochStats(epoch uint64) (*api.EpochStats, error)
func (*API) EpochTicker ¶
func (*API) GetPillarDelegationsByEpoch ¶
type AlgorithmConfig ¶
type AlgorithmConfig struct {
// contains filtered or unexported fields
}
func NewAlgorithmContext ¶
func NewAlgorithmContext(delegations []*types.PillarDelegation, hashH *types.HashHeight) *AlgorithmConfig
type ChainTicker ¶
type Consensus ¶
type Consensus interface { Verifier EventManager Init() error Start() error Stop() error GetMomentumProducer(timestamp time.Time) (*types.Address, error) FrontierPillarReader() api.PillarReader FixedPillarReader(types.HashHeight) api.PillarReader }
Consensus include all interface for consensus
type Context ¶
func NewConsensusContext ¶
type ElectionAlgorithm ¶
type ElectionAlgorithm interface {
SelectProducers(context *AlgorithmConfig) []*types.PillarDelegation
}
type ElectionReader ¶
type EventListener ¶
type EventListener interface {
NewProducerEvent(ProducerEvent)
}
type EventManager ¶
type EventManager interface { Register(callback EventListener) UnRegister(callback EventListener) }
type Points ¶
type Points interface { // MomentumEventListener is used to precompute points as momentums come, so API calls have hot data chain.MomentumEventListener GetPeriodPoints() PointsReader GetEpochPoints() PointsReader }
type PointsReader ¶
type PointsReader interface { common.Ticker // Returns nil, nil for points which are in the future GetPoint(tick uint64) (*storage.Point, error) }
PointsReader can read pillar statistics of epoch or period
type ProducerEvent ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.