Documentation ¶
Overview ¶
Package quorum is a generated GoMock package.
Package quorum is a generated GoMock package.
Index ¶
- Constants
- Variables
- func SpecString(spec *protocols.Spec) string
- type API
- func (api *API) AllNodes(_ context.Context) map[string]string
- func (api *API) MinerListAtRecentEpoch(_ context.Context) []common.Address
- func (api *API) PeerList(_ context.Context) *PeerListDTO
- func (api *API) PingList(_ context.Context) map[string]string
- func (api *API) Snapshot(_ context.Context, epoch uint64) *snapshot.SnapDTO
- func (api *API) SnapshotSystem(_ context.Context) *snapshot.SystemDTO
- func (api *API) SnapshotSystemEpochs(_ context.Context) []uint64
- func (api *API) SnapshotSystemRecentEpoch(_ context.Context) uint64
- func (api *API) Version(_ context.Context) string
- type Config
- type ContractService
- type ContractServiceWith
- type Handlers
- type MinersMsg
- type MockContractService
- type MockContractServiceMockRecorder
- type MockHandlers
- func (m *MockHandlers) EXPECT() *MockHandlersMockRecorder
- func (m *MockHandlers) HandleMinersMsg(msg *MinersMsg, peer *Peer)
- func (m *MockHandlers) HandleNodeCandidateListMsg(msg *NodeCandidateListMsg, peer *Peer)
- func (m *MockHandlers) HandleVoteMinerAddMsg(peer *Peer)
- func (m *MockHandlers) HandleVoteMinerDelMsg(peer *Peer)
- type MockHandlersMockRecorder
- func (mr *MockHandlersMockRecorder) HandleMinersMsg(msg, peer interface{}) *gomock.Call
- func (mr *MockHandlersMockRecorder) HandleNodeCandidateListMsg(msg, peer interface{}) *gomock.Call
- func (mr *MockHandlersMockRecorder) HandleVoteMinerAddMsg(peer interface{}) *gomock.Call
- func (mr *MockHandlersMockRecorder) HandleVoteMinerDelMsg(peer interface{}) *gomock.Call
- type MockHook
- type MockHookMockRecorder
- type MockMsgPauser
- type MockMsgPauserMockRecorder
- type MockP2PServer
- type MockP2PServerMockRecorder
- type MockPeerListService
- func (m *MockPeerListService) AddPeer(p *Peer)
- func (m *MockPeerListService) EXPECT() *MockPeerListServiceMockRecorder
- func (m *MockPeerListService) GetSnapshotNodes() ([]*snapshot.Node, error)
- func (m *MockPeerListService) MarkSelfIsMinerCandidate(in bool)
- func (m *MockPeerListService) Peers() []*Peer
- func (m *MockPeerListService) PingList() []enode.ID
- func (m *MockPeerListService) PingListLen() int
- func (m *MockPeerListService) PingListPeers() []*Peer
- func (m *MockPeerListService) RemovePeer(peerID enode.ID)
- func (m *MockPeerListService) SelfIsMinerCandidate() bool
- func (m *MockPeerListService) ToDTO() *PeerListDTO
- type MockPeerListServiceMockRecorder
- func (mr *MockPeerListServiceMockRecorder) AddPeer(p interface{}) *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) GetSnapshotNodes() *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) MarkSelfIsMinerCandidate(in interface{}) *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) Peers() *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) PingList() *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) PingListLen() *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) PingListPeers() *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) RemovePeer(peerID interface{}) *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) SelfIsMinerCandidate() *gomock.Call
- func (mr *MockPeerListServiceMockRecorder) ToDTO() *gomock.Call
- type MockPingPeerService
- type MockPingPeerServiceMockRecorder
- type MockSnapshotService
- func (m *MockSnapshotService) EXPECT() *MockSnapshotServiceMockRecorder
- func (m *MockSnapshotService) Epochs() []uint64
- func (m *MockSnapshotService) GetSnapshot(epoch uint64) *snapshot.Snapshot
- func (m *MockSnapshotService) MinerListAtEpoch(epoch uint64) []common.Address
- func (m *MockSnapshotService) PrepareSnapshot(epoch uint64) (*snapshot.Snapshot, error)
- func (m *MockSnapshotService) RecentEpoch() uint64
- func (m *MockSnapshotService) ToDTO() *snapshot.SystemDTO
- type MockSnapshotServiceMockRecorder
- func (mr *MockSnapshotServiceMockRecorder) Epochs() *gomock.Call
- func (mr *MockSnapshotServiceMockRecorder) GetSnapshot(epoch interface{}) *gomock.Call
- func (mr *MockSnapshotServiceMockRecorder) MinerListAtEpoch(epoch interface{}) *gomock.Call
- func (mr *MockSnapshotServiceMockRecorder) PrepareSnapshot(epoch interface{}) *gomock.Call
- func (mr *MockSnapshotServiceMockRecorder) RecentEpoch() *gomock.Call
- func (mr *MockSnapshotServiceMockRecorder) ToDTO() *gomock.Call
- type NodeCandidateListMsg
- type NodeCandidateMsg
- type P2PServer
- type Peer
- func (p *Peer) Address() common.Address
- func (p *Peer) Close() error
- func (p *Peer) Closed() bool
- func (p *Peer) GetState() *peerState
- func (p *Peer) HandleMsg(_ context.Context, msg interface{}) error
- func (p Peer) InPingList() bool
- func (p Peer) IsMinerCandidate() bool
- func (p Peer) IsQuorumCandidate() bool
- func (p Peer) MarkIsMinerCandidate(res bool)
- func (p *Peer) SendMiners(ctx context.Context, msg *MinersMsg) error
- func (p *Peer) SendNodeCandidateList(ctx context.Context, msg *NodeCandidateListMsg) error
- func (p *Peer) SendVoteMinerAddMsg(ctx context.Context) error
- func (p *Peer) SendVoteMinerDelMsg(ctx context.Context) error
- func (p *Peer) String() string
- func (p *Peer) ToDTO() *PeerDTO
- type PeerDTO
- type PeerList
- func (pl *PeerList) AddPeer(p *Peer)
- func (pl *PeerList) GetPeer(peerID enode.ID) *Peer
- func (pl *PeerList) GetSnapshotNodes() ([]*snapshot.Node, error)
- func (pl *PeerList) Ids() []enode.ID
- func (pl *PeerList) Len() int
- func (pl *PeerList) MarkSelfIsMinerCandidate(in bool)
- func (pl *PeerList) Peers() []*Peer
- func (pl *PeerList) PingList() []enode.ID
- func (pl *PeerList) PingListLen() (length int)
- func (pl *PeerList) PingListPeers() []*Peer
- func (pl *PeerList) RemovePeer(peerID enode.ID)
- func (pl *PeerList) Self() *enode.Node
- func (pl *PeerList) SelfIsMinerCandidate() bool
- func (pl *PeerList) ToDTO() *PeerListDTO
- type PeerListDTO
- type PeerListService
- type PeerStateDTO
- type PingPeerService
- type Quorum
- func (q *Quorum) APIs() []rpc.API
- func (q *Quorum) CreateQuorumSnapshot(epoch uint64, logger log.Logger) (*snapshot.Snapshot, error)
- func (q *Quorum) Engine() consensus.Engine
- func (q *Quorum) HandleMinersMsg(msg *MinersMsg, peer *Peer)
- func (q *Quorum) HandleNodeCandidateListMsg(msg *NodeCandidateListMsg, peer *Peer)
- func (q *Quorum) HandleVoteMinerAddMsg(peer *Peer)
- func (q *Quorum) HandleVoteMinerDelMsg(peer *Peer)
- func (q *Quorum) MarkMinerCandidate(res bool)
- func (q *Quorum) MinerListAtEpoch(epoch uint64) []common.Address
- func (q *Quorum) MinerListAtRecentEpoch() []common.Address
- func (q *Quorum) PrepareNodeListAtEpoch(epoch uint64)
- func (q *Quorum) Prepared() bool
- func (q *Quorum) Protocols() []p2p.Protocol
- func (q *Quorum) SelfIsMinerCandidate() bool
- func (q *Quorum) SetContractService(c ContractService)
- func (q *Quorum) SetEngine(engine *quorum.QuorumEngine)
- func (q *Quorum) Start(srvr *p2p.Server) error
- func (q *Quorum) Stop() error
- func (q *Quorum) Stopped() bool
- type SelfState
- type SnapshotService
- type VoteMinerAddMsg
- type VoteMinerDelMsg
Constants ¶
const ( ProtocolVersionStr = "1.0.0" // The same, as a string ProtocolName = "quorum" // Nickname of the protocol in geth DefaultPrepareMinersTimeout = 10 * time.Second DefaultPingFrequency = 10 * time.Second DefaultQuorumMaxPing = 1200 * time.Millisecond DefaultHandshakeTimeout = 3000 * time.Millisecond )
quorum constants
Variables ¶
var ( ErrOnWriteMessage = errors.New("error during message writing") ErrHookValidate = errors.New("error during hook validation") ErrHookApply = errors.New("error during hook applying") )
var ( ErrOnGettingDistribution = errors.New("error during getCurrentDistribution contract call") ErrGettingSnapshot = errors.New("error during snapshot nodes getting") )
var DefaultConfig = Config{ PrepareMinersTimeout: DefaultPrepareMinersTimeout, PingFrequency: DefaultPingFrequency, QuorumMaxPing: DefaultQuorumMaxPing, HandshakeTimeout: DefaultHandshakeTimeout, Test: false, }
DefaultConfig represents (shocker!) the default configuration.
var Spec = &protocols.Spec{ Name: "qrm", Version: 1, MaxMsgSize: 10 * 1024 * 1024, Messages: []interface{}{ VoteMinerAddMsg{}, VoteMinerDelMsg{}, NodeCandidateListMsg{}, MinersMsg{}, }, }
Spec (QuorumSpec) is the spec of the quorum protocol ...
Functions ¶
func SpecString ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API provides the quorum RPC service
func (*API) MinerListAtRecentEpoch ¶
MinerListAtRecentEpoch returns miner list at recent epoch
func (*API) PeerList ¶
func (api *API) PeerList(_ context.Context) *PeerListDTO
PeerList returns list of all connected peers
func (*API) PingList ¶
PingList returns peer list of quorum protocol (with satisfying ping duration)
func (*API) SnapshotSystemRecentEpoch ¶
type Config ¶
type Config struct { PrepareMinersTimeout time.Duration PingFrequency time.Duration QuorumMaxPing time.Duration HandshakeTimeout time.Duration Test bool }
Config represents the configuration state of a quorum service.
func (*Config) PingProtocolTimeout ¶
type ContractService ¶
type ContractServiceWith ¶
type ContractServiceWith func(ctx context.Context) (distribution map[common.Address]uint64, err error)
func (ContractServiceWith) GetCurrentDistribution ¶
type MockContractService ¶
type MockContractService struct {
// contains filtered or unexported fields
}
MockContractService is a mock of ContractService interface.
func NewMockContractService ¶
func NewMockContractService(ctrl *gomock.Controller) *MockContractService
NewMockContractService creates a new mock instance.
func (*MockContractService) EXPECT ¶
func (m *MockContractService) EXPECT() *MockContractServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockContractService) GetCurrentDistribution ¶
func (m *MockContractService) GetCurrentDistribution(ctx context.Context) (map[common.Address]uint64, error)
GetCurrentDistribution mocks base method.
type MockContractServiceMockRecorder ¶
type MockContractServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockContractServiceMockRecorder is the mock recorder for MockContractService.
func (*MockContractServiceMockRecorder) GetCurrentDistribution ¶
func (mr *MockContractServiceMockRecorder) GetCurrentDistribution(ctx interface{}) *gomock.Call
GetCurrentDistribution indicates an expected call of GetCurrentDistribution.
type MockHandlers ¶
type MockHandlers struct {
// contains filtered or unexported fields
}
MockHandlers is a mock of Handlers interface.
func NewMockHandlers ¶
func NewMockHandlers(ctrl *gomock.Controller) *MockHandlers
NewMockHandlers creates a new mock instance.
func (*MockHandlers) EXPECT ¶
func (m *MockHandlers) EXPECT() *MockHandlersMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockHandlers) HandleMinersMsg ¶
func (m *MockHandlers) HandleMinersMsg(msg *MinersMsg, peer *Peer)
HandleMinersMsg mocks base method.
func (*MockHandlers) HandleNodeCandidateListMsg ¶
func (m *MockHandlers) HandleNodeCandidateListMsg(msg *NodeCandidateListMsg, peer *Peer)
HandleNodeCandidateListMsg mocks base method.
func (*MockHandlers) HandleVoteMinerAddMsg ¶
func (m *MockHandlers) HandleVoteMinerAddMsg(peer *Peer)
HandleVoteMinerAddMsg mocks base method.
func (*MockHandlers) HandleVoteMinerDelMsg ¶
func (m *MockHandlers) HandleVoteMinerDelMsg(peer *Peer)
HandleVoteMinerDelMsg mocks base method.
type MockHandlersMockRecorder ¶
type MockHandlersMockRecorder struct {
// contains filtered or unexported fields
}
MockHandlersMockRecorder is the mock recorder for MockHandlers.
func (*MockHandlersMockRecorder) HandleMinersMsg ¶
func (mr *MockHandlersMockRecorder) HandleMinersMsg(msg, peer interface{}) *gomock.Call
HandleMinersMsg indicates an expected call of HandleMinersMsg.
func (*MockHandlersMockRecorder) HandleNodeCandidateListMsg ¶
func (mr *MockHandlersMockRecorder) HandleNodeCandidateListMsg(msg, peer interface{}) *gomock.Call
HandleNodeCandidateListMsg indicates an expected call of HandleNodeCandidateListMsg.
func (*MockHandlersMockRecorder) HandleVoteMinerAddMsg ¶
func (mr *MockHandlersMockRecorder) HandleVoteMinerAddMsg(peer interface{}) *gomock.Call
HandleVoteMinerAddMsg indicates an expected call of HandleVoteMinerAddMsg.
func (*MockHandlersMockRecorder) HandleVoteMinerDelMsg ¶
func (mr *MockHandlersMockRecorder) HandleVoteMinerDelMsg(peer interface{}) *gomock.Call
HandleVoteMinerDelMsg indicates an expected call of HandleVoteMinerDelMsg.
type MockHook ¶
type MockHook struct {
// contains filtered or unexported fields
}
MockHook is a mock of Hook interface.
func NewMockHook ¶
func NewMockHook(ctrl *gomock.Controller) *MockHook
NewMockHook creates a new mock instance.
func (*MockHook) EXPECT ¶
func (m *MockHook) EXPECT() *MockHookMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockHookMockRecorder ¶
type MockHookMockRecorder struct {
// contains filtered or unexported fields
}
MockHookMockRecorder is the mock recorder for MockHook.
func (*MockHookMockRecorder) Apply ¶
func (mr *MockHookMockRecorder) Apply(peer, costToLocalNode, size interface{}) *gomock.Call
Apply indicates an expected call of Apply.
func (*MockHookMockRecorder) Validate ¶
func (mr *MockHookMockRecorder) Validate(peer, size, msg, payer interface{}) *gomock.Call
Validate indicates an expected call of Validate.
type MockMsgPauser ¶
type MockMsgPauser struct {
// contains filtered or unexported fields
}
MockMsgPauser is a mock of MsgPauser interface.
func NewMockMsgPauser ¶
func NewMockMsgPauser(ctrl *gomock.Controller) *MockMsgPauser
NewMockMsgPauser creates a new mock instance.
func (*MockMsgPauser) EXPECT ¶
func (m *MockMsgPauser) EXPECT() *MockMsgPauserMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockMsgPauserMockRecorder ¶
type MockMsgPauserMockRecorder struct {
// contains filtered or unexported fields
}
MockMsgPauserMockRecorder is the mock recorder for MockMsgPauser.
func (*MockMsgPauserMockRecorder) Pause ¶
func (mr *MockMsgPauserMockRecorder) Pause() *gomock.Call
Pause indicates an expected call of Pause.
func (*MockMsgPauserMockRecorder) Resume ¶
func (mr *MockMsgPauserMockRecorder) Resume() *gomock.Call
Resume indicates an expected call of Resume.
func (*MockMsgPauserMockRecorder) Wait ¶
func (mr *MockMsgPauserMockRecorder) Wait() *gomock.Call
Wait indicates an expected call of Wait.
type MockP2PServer ¶
type MockP2PServer struct {
// contains filtered or unexported fields
}
MockP2PServer is a mock of P2PServer interface.
func NewMockP2PServer ¶
func NewMockP2PServer(ctrl *gomock.Controller) *MockP2PServer
NewMockP2PServer creates a new mock instance.
func (*MockP2PServer) EXPECT ¶
func (m *MockP2PServer) EXPECT() *MockP2PServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockP2PServerMockRecorder ¶
type MockP2PServerMockRecorder struct {
// contains filtered or unexported fields
}
MockP2PServerMockRecorder is the mock recorder for MockP2PServer.
func (*MockP2PServerMockRecorder) Self ¶
func (mr *MockP2PServerMockRecorder) Self() *gomock.Call
Self indicates an expected call of Self.
type MockPeerListService ¶
type MockPeerListService struct {
// contains filtered or unexported fields
}
MockPeerListService is a mock of PeerListService interface.
func NewMockPeerListService ¶
func NewMockPeerListService(ctrl *gomock.Controller) *MockPeerListService
NewMockPeerListService creates a new mock instance.
func (*MockPeerListService) AddPeer ¶
func (m *MockPeerListService) AddPeer(p *Peer)
AddPeer mocks base method.
func (*MockPeerListService) EXPECT ¶
func (m *MockPeerListService) EXPECT() *MockPeerListServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPeerListService) GetSnapshotNodes ¶
func (m *MockPeerListService) GetSnapshotNodes() ([]*snapshot.Node, error)
GetSnapshotNodes mocks base method.
func (*MockPeerListService) MarkSelfIsMinerCandidate ¶
func (m *MockPeerListService) MarkSelfIsMinerCandidate(in bool)
MarkSelfIsMinerCandidate mocks base method.
func (*MockPeerListService) Peers ¶
func (m *MockPeerListService) Peers() []*Peer
Peers mocks base method.
func (*MockPeerListService) PingList ¶
func (m *MockPeerListService) PingList() []enode.ID
PingList mocks base method.
func (*MockPeerListService) PingListLen ¶
func (m *MockPeerListService) PingListLen() int
PingListLen mocks base method.
func (*MockPeerListService) PingListPeers ¶
func (m *MockPeerListService) PingListPeers() []*Peer
PingListPeers mocks base method.
func (*MockPeerListService) RemovePeer ¶
func (m *MockPeerListService) RemovePeer(peerID enode.ID)
RemovePeer mocks base method.
func (*MockPeerListService) SelfIsMinerCandidate ¶
func (m *MockPeerListService) SelfIsMinerCandidate() bool
SelfIsMinerCandidate mocks base method.
func (*MockPeerListService) ToDTO ¶
func (m *MockPeerListService) ToDTO() *PeerListDTO
ToDTO mocks base method.
type MockPeerListServiceMockRecorder ¶
type MockPeerListServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockPeerListServiceMockRecorder is the mock recorder for MockPeerListService.
func (*MockPeerListServiceMockRecorder) AddPeer ¶
func (mr *MockPeerListServiceMockRecorder) AddPeer(p interface{}) *gomock.Call
AddPeer indicates an expected call of AddPeer.
func (*MockPeerListServiceMockRecorder) GetSnapshotNodes ¶
func (mr *MockPeerListServiceMockRecorder) GetSnapshotNodes() *gomock.Call
GetSnapshotNodes indicates an expected call of GetSnapshotNodes.
func (*MockPeerListServiceMockRecorder) MarkSelfIsMinerCandidate ¶
func (mr *MockPeerListServiceMockRecorder) MarkSelfIsMinerCandidate(in interface{}) *gomock.Call
MarkSelfIsMinerCandidate indicates an expected call of MarkSelfIsMinerCandidate.
func (*MockPeerListServiceMockRecorder) Peers ¶
func (mr *MockPeerListServiceMockRecorder) Peers() *gomock.Call
Peers indicates an expected call of Peers.
func (*MockPeerListServiceMockRecorder) PingList ¶
func (mr *MockPeerListServiceMockRecorder) PingList() *gomock.Call
PingList indicates an expected call of PingList.
func (*MockPeerListServiceMockRecorder) PingListLen ¶
func (mr *MockPeerListServiceMockRecorder) PingListLen() *gomock.Call
PingListLen indicates an expected call of PingListLen.
func (*MockPeerListServiceMockRecorder) PingListPeers ¶
func (mr *MockPeerListServiceMockRecorder) PingListPeers() *gomock.Call
PingListPeers indicates an expected call of PingListPeers.
func (*MockPeerListServiceMockRecorder) RemovePeer ¶
func (mr *MockPeerListServiceMockRecorder) RemovePeer(peerID interface{}) *gomock.Call
RemovePeer indicates an expected call of RemovePeer.
func (*MockPeerListServiceMockRecorder) SelfIsMinerCandidate ¶
func (mr *MockPeerListServiceMockRecorder) SelfIsMinerCandidate() *gomock.Call
SelfIsMinerCandidate indicates an expected call of SelfIsMinerCandidate.
func (*MockPeerListServiceMockRecorder) ToDTO ¶
func (mr *MockPeerListServiceMockRecorder) ToDTO() *gomock.Call
ToDTO indicates an expected call of ToDTO.
type MockPingPeerService ¶
type MockPingPeerService struct {
// contains filtered or unexported fields
}
MockPingPeerService is a mock of PingPeerService interface.
func NewMockPingPeerService ¶
func NewMockPingPeerService(ctrl *gomock.Controller) *MockPingPeerService
NewMockPingPeerService creates a new mock instance.
func (*MockPingPeerService) EXPECT ¶
func (m *MockPingPeerService) EXPECT() *MockPingPeerServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPingPeerService) String ¶
func (m *MockPingPeerService) String() string
String mocks base method.
type MockPingPeerServiceMockRecorder ¶
type MockPingPeerServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockPingPeerServiceMockRecorder is the mock recorder for MockPingPeerService.
func (*MockPingPeerServiceMockRecorder) PingPong ¶
func (mr *MockPingPeerServiceMockRecorder) PingPong(timeout interface{}) *gomock.Call
PingPong indicates an expected call of PingPong.
func (*MockPingPeerServiceMockRecorder) String ¶
func (mr *MockPingPeerServiceMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockSnapshotService ¶
type MockSnapshotService struct {
// contains filtered or unexported fields
}
MockSnapshotService is a mock of SnapshotService interface.
func NewMockSnapshotService ¶
func NewMockSnapshotService(ctrl *gomock.Controller) *MockSnapshotService
NewMockSnapshotService creates a new mock instance.
func (*MockSnapshotService) EXPECT ¶
func (m *MockSnapshotService) EXPECT() *MockSnapshotServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSnapshotService) Epochs ¶
func (m *MockSnapshotService) Epochs() []uint64
Epochs mocks base method.
func (*MockSnapshotService) GetSnapshot ¶
func (m *MockSnapshotService) GetSnapshot(epoch uint64) *snapshot.Snapshot
GetSnapshot mocks base method.
func (*MockSnapshotService) MinerListAtEpoch ¶
func (m *MockSnapshotService) MinerListAtEpoch(epoch uint64) []common.Address
MinerListAtEpoch mocks base method.
func (*MockSnapshotService) PrepareSnapshot ¶
func (m *MockSnapshotService) PrepareSnapshot(epoch uint64) (*snapshot.Snapshot, error)
PrepareSnapshot mocks base method.
func (*MockSnapshotService) RecentEpoch ¶
func (m *MockSnapshotService) RecentEpoch() uint64
RecentEpoch mocks base method.
func (*MockSnapshotService) ToDTO ¶
func (m *MockSnapshotService) ToDTO() *snapshot.SystemDTO
ToDTO mocks base method.
type MockSnapshotServiceMockRecorder ¶
type MockSnapshotServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockSnapshotServiceMockRecorder is the mock recorder for MockSnapshotService.
func (*MockSnapshotServiceMockRecorder) Epochs ¶
func (mr *MockSnapshotServiceMockRecorder) Epochs() *gomock.Call
Epochs indicates an expected call of Epochs.
func (*MockSnapshotServiceMockRecorder) GetSnapshot ¶
func (mr *MockSnapshotServiceMockRecorder) GetSnapshot(epoch interface{}) *gomock.Call
GetSnapshot indicates an expected call of GetSnapshot.
func (*MockSnapshotServiceMockRecorder) MinerListAtEpoch ¶
func (mr *MockSnapshotServiceMockRecorder) MinerListAtEpoch(epoch interface{}) *gomock.Call
MinerListAtEpoch indicates an expected call of MinerListAtEpoch.
func (*MockSnapshotServiceMockRecorder) PrepareSnapshot ¶
func (mr *MockSnapshotServiceMockRecorder) PrepareSnapshot(epoch interface{}) *gomock.Call
PrepareSnapshot indicates an expected call of PrepareSnapshot.
func (*MockSnapshotServiceMockRecorder) RecentEpoch ¶
func (mr *MockSnapshotServiceMockRecorder) RecentEpoch() *gomock.Call
RecentEpoch indicates an expected call of RecentEpoch.
func (*MockSnapshotServiceMockRecorder) ToDTO ¶
func (mr *MockSnapshotServiceMockRecorder) ToDTO() *gomock.Call
ToDTO indicates an expected call of ToDTO.
type NodeCandidateListMsg ¶
type NodeCandidateListMsg struct { List []*NodeCandidateMsg Epoch *big.Int }
func NewNodeCandidateListMsg ¶
func NewNodeCandidateListMsg(nodes map[common.Address]bool, epoch uint64) *NodeCandidateListMsg
type NodeCandidateMsg ¶
func NewNodeCandidateMsg ¶
func NewNodeCandidateMsg(address common.Address, isMinerCandidate bool) *NodeCandidateMsg
type Peer ¶
type Peer struct { *protocols.Peer // represents the connection for online peer PingPeer PingPeerService // represents the connection for online ping peer // contains filtered or unexported fields }
Peer is a representation of quorum service peer
func NewPeer ¶
func NewPeer(p *protocols.Peer, pingPeer PingPeerService, quorum Handlers) *Peer
NewPeer creates peer with given quorum protocol peer
func (Peer) InPingList ¶
func (p Peer) InPingList() bool
InPingList returns if this peerState in our ping list
func (Peer) IsMinerCandidate ¶
func (p Peer) IsMinerCandidate() bool
IsMinerCandidate returns if this peer wants to mine AT THE MOMENT (not depending to epoch)
func (Peer) IsQuorumCandidate ¶
func (p Peer) IsQuorumCandidate() bool
IsQuorumCandidate returns if this peerState is our quorum candidate now
func (Peer) MarkIsMinerCandidate ¶
func (p Peer) MarkIsMinerCandidate(res bool)
MarkIsMinerCandidate marks peer as miner candidate AT THE MOMENT
func (*Peer) SendNodeCandidateList ¶
func (p *Peer) SendNodeCandidateList(ctx context.Context, msg *NodeCandidateListMsg) error
SendNodeCandidateList sends MinerCandidateListMsg
func (*Peer) SendVoteMinerAddMsg ¶
SendVoteMinerAddMsg sends VoteMinerAddMsg
func (*Peer) SendVoteMinerDelMsg ¶
SendVoteMinerDelMsg sends NewVoteMinerDelMsg
type PeerList ¶
type PeerList struct {
// contains filtered or unexported fields
}
PeerList is a representation of quorum service peers list with additional helper methods
func (*PeerList) AddPeer ¶
AddPeer adds the peer using quorum protocol peer if peer state found in recent peers - restore state from that map
func (*PeerList) GetSnapshotNodes ¶
GetSnapshotNodes methods creates a snapshot of current peers state and returns slice of snapshot.Node Result also contains data about self node. Self node remoteNodeCandidates are also feels in while getting snapshot nodes
func (*PeerList) MarkSelfIsMinerCandidate ¶
MarkSelfIsMinerCandidate - marks self node is miner candidate AT THE MOMENT
func (*PeerList) PingList ¶
PingList returns the slice of enode.ID of ping list (doesn`t include self node)
func (*PeerList) PingListLen ¶
PingListLen returns the number of peers in ping list (doesn`t include self node)
func (*PeerList) PingListPeers ¶
PingListPeers returns the slice of peers of ping list (doesn`t include self node)
func (*PeerList) RemovePeer ¶
RemovePeer removes peer with peerID from the peer store actually deleting not happening. it just moves from peers map to recentPeers map
func (*PeerList) SelfIsMinerCandidate ¶
SelfIsMinerCandidate - returns if self node is miner candidate AT THE MOMENT (not depending do epoch)
func (*PeerList) ToDTO ¶
func (pl *PeerList) ToDTO() *PeerListDTO
type PeerListDTO ¶
type PeerListService ¶
type PeerStateDTO ¶
type PingPeerService ¶
type Quorum ¶
type Quorum struct {
// contains filtered or unexported fields
}
func (*Quorum) CreateQuorumSnapshot ¶
CreateQuorumSnapshot creates a snapshot of the current state of peer list
func (*Quorum) HandleMinersMsg ¶
HandleMinersMsg handles MinersMsg from peer
func (*Quorum) HandleNodeCandidateListMsg ¶
func (q *Quorum) HandleNodeCandidateListMsg(msg *NodeCandidateListMsg, peer *Peer)
HandleNodeCandidateListMsg handles NodeCandidateListMsg from peer
func (*Quorum) HandleVoteMinerAddMsg ¶
HandleVoteMinerAddMsg handles VoteMinerAddMsg from peer
func (*Quorum) HandleVoteMinerDelMsg ¶
HandleVoteMinerDelMsg handles VoteMinerDelMsg from peer
func (*Quorum) MarkMinerCandidate ¶
MarkMinerCandidate when node enters in quorum, it marks self as miner candidate
func (*Quorum) MinerListAtRecentEpoch ¶
func (*Quorum) PrepareNodeListAtEpoch ¶
func (*Quorum) SelfIsMinerCandidate ¶
SelfIsMinerCandidate returns self miner candidate status
func (*Quorum) SetContractService ¶
func (q *Quorum) SetContractService(c ContractService)
func (*Quorum) SetEngine ¶
func (q *Quorum) SetEngine(engine *quorum.QuorumEngine)
type SelfState ¶
type SelfState struct {
// contains filtered or unexported fields
}
func NewSelfState ¶
func NewSelfState() *SelfState
func (*SelfState) IsMinerCandidate ¶
IsMinerCandidate - returns if self node is miner candidate AT THE MOMENT (not depending do epoch)
func (*SelfState) MarkIsMinerCandidate ¶
MarkIsMinerCandidate - marks self node is miner candidate AT THE MOMENT
type SnapshotService ¶
type VoteMinerAddMsg ¶
type VoteMinerAddMsg struct { }
VoteMinerAddMsg is sent to ask remote peers to add self node to miner nodes
func NewVoteMinerAddMsg ¶
func NewVoteMinerAddMsg() *VoteMinerAddMsg
type VoteMinerDelMsg ¶
type VoteMinerDelMsg struct { }
VoteMinerDelMsg is sent to ask remote peers to delete self node from miner nodes
func NewVoteMinerDelMsg ¶
func NewVoteMinerDelMsg() *VoteMinerDelMsg