Documentation
¶
Index ¶
- Constants
- type Communicator
- type CommunicatorMock
- func (m *CommunicatorMock) AllMocksCalled() bool
- func (m *CommunicatorMock) CheckMocksCalled()
- func (m *CommunicatorMock) ExchangePhase1(p context.Context, p1 []core.Node, p2 packets.Phase1Packet) (r map[core.RecordRef]*packets.Phase1Packet, r1 error)
- func (m *CommunicatorMock) ExchangePhase1MinimockCounter() uint64
- func (m *CommunicatorMock) ExchangePhase1MinimockPreCounter() uint64
- func (m *CommunicatorMock) ExchangePhase2(p context.Context, p1 []core.Node, p2 packets.Phase2Packet) (r map[core.RecordRef]*packets.Phase2Packet, r1 error)
- func (m *CommunicatorMock) ExchangePhase2MinimockCounter() uint64
- func (m *CommunicatorMock) ExchangePhase2MinimockPreCounter() uint64
- func (m *CommunicatorMock) ExchangePhase3(p context.Context, p1 []core.Node, p2 packets.Phase3Packet) (r map[core.RecordRef]*packets.Phase3Packet, r1 error)
- func (m *CommunicatorMock) ExchangePhase3MinimockCounter() uint64
- func (m *CommunicatorMock) ExchangePhase3MinimockPreCounter() uint64
- func (m *CommunicatorMock) Finish()
- func (m *CommunicatorMock) MinimockFinish()
- func (m *CommunicatorMock) MinimockWait(timeout time.Duration)
- func (m *CommunicatorMock) ValidateCallCounters()
- func (m *CommunicatorMock) Wait(timeout time.Duration)
- type CommunicatorMockExchangePhase1Params
- type CommunicatorMockExchangePhase2Params
- type CommunicatorMockExchangePhase3Params
- type FirstPhase
- type FirstPhaseState
- type NaiveCommunicator
- func (nc *NaiveCommunicator) ExchangePhase1(ctx context.Context, participants []core.Node, packet packets.Phase1Packet) (map[core.RecordRef]*packets.Phase1Packet, error)
- func (nc *NaiveCommunicator) ExchangePhase2(ctx context.Context, participants []core.Node, packet packets.Phase2Packet) (map[core.RecordRef]*packets.Phase2Packet, error)
- func (nc *NaiveCommunicator) ExchangePhase3(ctx context.Context, participants []core.Node, packet packets.Phase3Packet) (map[core.RecordRef]*packets.Phase3Packet, error)
- func (nc *NaiveCommunicator) Start(ctx context.Context) error
- type PhaseManager
- type Phases
- type SecondPhase
- type SecondPhaseState
- type ThirdPhase
- type ThirdPhasePulseState
- type ThirdPhaseReferendumState
Constants ¶
const ConsensusAtPercents = 0.66
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Communicator ¶ added in v0.6.3
type Communicator interface { // ExchangePhase1 used in first consensus step to exchange data between participants ExchangePhase1(ctx context.Context, participants []core.Node, packet packets.Phase1Packet) (map[core.RecordRef]*packets.Phase1Packet, error) // ExchangePhase2 used in second consensus step to exchange data between participants ExchangePhase2(ctx context.Context, participants []core.Node, packet packets.Phase2Packet) (map[core.RecordRef]*packets.Phase2Packet, error) // ExchangePhase3 used in third consensus step to exchange data between participants ExchangePhase3(ctx context.Context, participants []core.Node, packet packets.Phase3Packet) (map[core.RecordRef]*packets.Phase3Packet, error) }
Communicator interface provides methods to exchange data between nodes
type CommunicatorMock ¶ added in v0.6.3
type CommunicatorMock struct { ExchangePhase1Func func(p context.Context, p1 []core.Node, p2 packets.Phase1Packet) (r map[core.RecordRef]*packets.Phase1Packet, r1 error) ExchangePhase1Counter uint64 ExchangePhase1PreCounter uint64 ExchangePhase1Mock mCommunicatorMockExchangePhase1 ExchangePhase2Func func(p context.Context, p1 []core.Node, p2 packets.Phase2Packet) (r map[core.RecordRef]*packets.Phase2Packet, r1 error) ExchangePhase2Counter uint64 ExchangePhase2PreCounter uint64 ExchangePhase2Mock mCommunicatorMockExchangePhase2 ExchangePhase3Func func(p context.Context, p1 []core.Node, p2 packets.Phase3Packet) (r map[core.RecordRef]*packets.Phase3Packet, r1 error) ExchangePhase3Counter uint64 ExchangePhase3PreCounter uint64 ExchangePhase3Mock mCommunicatorMockExchangePhase3 // contains filtered or unexported fields }
CommunicatorMock implements github.com/insolar/insolar/consensus/phases.Communicator
func NewCommunicatorMock ¶ added in v0.6.3
func NewCommunicatorMock(t minimock.Tester) *CommunicatorMock
NewCommunicatorMock returns a mock for github.com/insolar/insolar/consensus/phases.Communicator
func (*CommunicatorMock) AllMocksCalled ¶ added in v0.6.3
func (m *CommunicatorMock) AllMocksCalled() bool
AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled, it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())
func (*CommunicatorMock) CheckMocksCalled ¶ added in v0.6.3
func (m *CommunicatorMock) CheckMocksCalled()
CheckMocksCalled checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
func (*CommunicatorMock) ExchangePhase1 ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase1(p context.Context, p1 []core.Node, p2 packets.Phase1Packet) (r map[core.RecordRef]*packets.Phase1Packet, r1 error)
ExchangePhase1 implements github.com/insolar/insolar/consensus/phases.Communicator interface
func (*CommunicatorMock) ExchangePhase1MinimockCounter ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase1MinimockCounter() uint64
ExchangePhase1MinimockCounter returns a count of CommunicatorMock.ExchangePhase1Func invocations
func (*CommunicatorMock) ExchangePhase1MinimockPreCounter ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase1MinimockPreCounter() uint64
ExchangePhase1MinimockPreCounter returns the value of CommunicatorMock.ExchangePhase1 invocations
func (*CommunicatorMock) ExchangePhase2 ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase2(p context.Context, p1 []core.Node, p2 packets.Phase2Packet) (r map[core.RecordRef]*packets.Phase2Packet, r1 error)
ExchangePhase2 implements github.com/insolar/insolar/consensus/phases.Communicator interface
func (*CommunicatorMock) ExchangePhase2MinimockCounter ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase2MinimockCounter() uint64
ExchangePhase2MinimockCounter returns a count of CommunicatorMock.ExchangePhase2Func invocations
func (*CommunicatorMock) ExchangePhase2MinimockPreCounter ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase2MinimockPreCounter() uint64
ExchangePhase2MinimockPreCounter returns the value of CommunicatorMock.ExchangePhase2 invocations
func (*CommunicatorMock) ExchangePhase3 ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase3(p context.Context, p1 []core.Node, p2 packets.Phase3Packet) (r map[core.RecordRef]*packets.Phase3Packet, r1 error)
ExchangePhase3 implements github.com/insolar/insolar/consensus/phases.Communicator interface
func (*CommunicatorMock) ExchangePhase3MinimockCounter ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase3MinimockCounter() uint64
ExchangePhase3MinimockCounter returns a count of CommunicatorMock.ExchangePhase3Func invocations
func (*CommunicatorMock) ExchangePhase3MinimockPreCounter ¶ added in v0.6.3
func (m *CommunicatorMock) ExchangePhase3MinimockPreCounter() uint64
ExchangePhase3MinimockPreCounter returns the value of CommunicatorMock.ExchangePhase3 invocations
func (*CommunicatorMock) Finish ¶ added in v0.6.3
func (m *CommunicatorMock) Finish()
Finish checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish or use Finish method of minimock.Controller
func (*CommunicatorMock) MinimockFinish ¶ added in v0.6.3
func (m *CommunicatorMock) MinimockFinish()
MinimockFinish checks that all mocked methods of the interface have been called at least once
func (*CommunicatorMock) MinimockWait ¶ added in v0.6.3
func (m *CommunicatorMock) MinimockWait(timeout time.Duration)
MinimockWait waits for all mocked methods to be called at least once this method is called by minimock.Controller
func (*CommunicatorMock) ValidateCallCounters ¶ added in v0.6.3
func (m *CommunicatorMock) ValidateCallCounters()
ValidateCallCounters checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller
func (*CommunicatorMock) Wait ¶ added in v0.6.3
func (m *CommunicatorMock) Wait(timeout time.Duration)
Wait waits for all mocked methods to be called at least once Deprecated: please use MinimockWait or use Wait method of minimock.Controller
type CommunicatorMockExchangePhase1Params ¶ added in v0.6.3
type CommunicatorMockExchangePhase1Params struct {
// contains filtered or unexported fields
}
CommunicatorMockExchangePhase1Params represents input parameters of the Communicator.ExchangePhase1
type CommunicatorMockExchangePhase2Params ¶ added in v0.6.3
type CommunicatorMockExchangePhase2Params struct {
// contains filtered or unexported fields
}
CommunicatorMockExchangePhase2Params represents input parameters of the Communicator.ExchangePhase2
type CommunicatorMockExchangePhase3Params ¶ added in v0.6.3
type CommunicatorMockExchangePhase3Params struct {
// contains filtered or unexported fields
}
CommunicatorMockExchangePhase3Params represents input parameters of the Communicator.ExchangePhase3
type FirstPhase ¶
type FirstPhase struct { NodeNetwork core.NodeNetwork `inject:""` Calculator merkle.Calculator `inject:""` Communicator Communicator `inject:""` Cryptography core.CryptographyService `inject:""` NodeKeeper network.NodeKeeper `inject:""` State *FirstPhaseState UnsyncList network.UnsyncList }
FirstPhase is a first phase.
func (*FirstPhase) Execute ¶ added in v0.6.3
func (fp *FirstPhase) Execute(ctx context.Context, pulse *core.Pulse) (*FirstPhaseState, error)
Execute do first phase
type FirstPhaseState ¶ added in v0.6.3
type FirstPhaseState struct { PulseEntry *merkle.PulseEntry PulseHash merkle.OriginHash PulseProof *merkle.PulseProof PulseProofSet map[core.Node]*merkle.PulseProof TimedOutNodes []core.Node DeviantNodes []core.Node UnsyncList network.UnsyncList }
type NaiveCommunicator ¶ added in v0.6.3
type NaiveCommunicator struct { ConsensusNetwork network.ConsensusNetwork `inject:""` PulseHandler network.PulseHandler `inject:""` Cryptography core.CryptographyService `inject:""` NodeNetwork core.NodeNetwork `inject:""` // contains filtered or unexported fields }
NaiveCommunicator is simple Communicator implementation which communicates with each participants
func NewNaiveCommunicator ¶ added in v0.6.3
func NewNaiveCommunicator() *NaiveCommunicator
NewNaiveCommunicator constructor creates new NaiveCommunicator
func (*NaiveCommunicator) ExchangePhase1 ¶ added in v0.6.3
func (nc *NaiveCommunicator) ExchangePhase1(ctx context.Context, participants []core.Node, packet packets.Phase1Packet) (map[core.RecordRef]*packets.Phase1Packet, error)
ExchangePhase1 used in first consensus phase to exchange data between participants
func (*NaiveCommunicator) ExchangePhase2 ¶ added in v0.6.3
func (nc *NaiveCommunicator) ExchangePhase2(ctx context.Context, participants []core.Node, packet packets.Phase2Packet) (map[core.RecordRef]*packets.Phase2Packet, error)
ExchangePhase2 used in second consensus phase to exchange data between participants
func (*NaiveCommunicator) ExchangePhase3 ¶ added in v0.6.3
func (nc *NaiveCommunicator) ExchangePhase3(ctx context.Context, participants []core.Node, packet packets.Phase3Packet) (map[core.RecordRef]*packets.Phase3Packet, error)
ExchangePhase3 used in third consensus step to exchange data between participants
type PhaseManager ¶
func NewPhaseManager ¶
func NewPhaseManager() PhaseManager
NewPhaseManager creates and returns a new phase manager.
type Phases ¶ added in v0.6.3
type Phases struct { FirstPhase *FirstPhase //`inject:""` SecondPhase *SecondPhase //`inject:""` ThirdPhase *ThirdPhase //`inject:""` PulseManager core.PulseManager `inject:""` NodeKeeper network.NodeKeeper `inject:""` }
type SecondPhase ¶
type SecondPhase struct { NodeNetwork core.NodeNetwork `inject:""` NodeKeeper network.NodeKeeper `inject:""` Network core.Network `inject:""` Calculator merkle.Calculator `inject:""` Communicator Communicator `inject:""` Cryptography core.CryptographyService `inject:""` }
SecondPhase is a second phase.
func (*SecondPhase) Execute ¶ added in v0.6.3
func (sp *SecondPhase) Execute(ctx context.Context, state *FirstPhaseState) (*SecondPhaseState, error)
type SecondPhaseState ¶ added in v0.6.3
type SecondPhaseState struct { *FirstPhaseState GlobuleEntry *merkle.GlobuleEntry GlobuleHash merkle.OriginHash GlobuleProof *merkle.GlobuleProof GlobuleProofSet map[core.Node]*merkle.GlobuleProof NodeListCount uint16 NodeListHash []byte DBitSet packets.BitSet }
type ThirdPhase ¶ added in v0.6.3
type ThirdPhase struct { Cryptography core.CryptographyService `inject:""` NodeNetwork core.NodeNetwork `inject:""` Communicator Communicator `inject:""` NodeKeeper network.NodeKeeper `inject:""` // contains filtered or unexported fields }
func (*ThirdPhase) Execute ¶ added in v0.6.3
func (tp *ThirdPhase) Execute(ctx context.Context, state *SecondPhaseState) error
type ThirdPhasePulseState ¶ added in v0.6.3
type ThirdPhasePulseState struct { }
type ThirdPhaseReferendumState ¶ added in v0.6.3
type ThirdPhaseReferendumState struct { }