-
Notifications
You must be signed in to change notification settings - Fork 323
/
context.go
44 lines (35 loc) · 1.27 KB
/
context.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
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2019 IoTeX Foundation
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
package consensusfsm
import (
"time"
fsm "github.com/iotexproject/go-fsm"
"go.uber.org/zap"
"github.com/iotexproject/iotex-core/pkg/lifecycle"
)
// Context defines the context of the fsm
type Context interface {
lifecycle.StartStopper
Activate(bool)
Active() bool
IsStaleEvent(*ConsensusEvent) bool
IsFutureEvent(*ConsensusEvent) bool
IsStaleUnmatchedEvent(*ConsensusEvent) bool
Logger() *zap.Logger
Height() uint64
NewConsensusEvent(fsm.EventType, interface{}) *ConsensusEvent
NewBackdoorEvt(fsm.State) *ConsensusEvent
Broadcast(interface{})
Prepare() error
IsDelegate() bool
Proposal() (interface{}, error)
WaitUntilRoundStart() time.Duration
PreCommitEndorsement() interface{}
NewProposalEndorsement(interface{}) (interface{}, error)
NewLockEndorsement(interface{}) (interface{}, error)
NewPreCommitEndorsement(interface{}) (interface{}, error)
Commit(interface{}) (bool, error)
ConsensusConfig
}