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 map[core.RecordRef]string, ...)
- func (m *CommunicatorMock) ExchangePhase1Finished() bool
- 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) ExchangePhase2Finished() bool
- 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) ExchangePhase3Finished() bool
- 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 CommunicatorMockExchangePhase1Expectation
- type CommunicatorMockExchangePhase1Input
- type CommunicatorMockExchangePhase1Result
- type CommunicatorMockExchangePhase2Expectation
- type CommunicatorMockExchangePhase2Input
- type CommunicatorMockExchangePhase2Result
- type CommunicatorMockExchangePhase3Expectation
- type CommunicatorMockExchangePhase3Input
- type CommunicatorMockExchangePhase3Result
- type FirstPhase
- type FirstPhaseState
- type NaiveCommunicator
- func (nc *NaiveCommunicator) ExchangePhase1(ctx context.Context, participants []core.Node, packet *packets.Phase1Packet) (map[core.RecordRef]*packets.Phase1Packet, map[core.RecordRef]string, 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 = 2.0 / 3.0
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, map[core.RecordRef]string, 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 map[core.RecordRef]string, r2 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 map[core.RecordRef]string, r2 error)
ExchangePhase1 implements github.com/insolar/insolar/consensus/phases.Communicator interface
func (*CommunicatorMock) ExchangePhase1Finished ¶ added in v0.7.5
func (m *CommunicatorMock) ExchangePhase1Finished() bool
ExchangePhase1Finished returns true if mock invocations count is ok
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) ExchangePhase2Finished ¶ added in v0.7.5
func (m *CommunicatorMock) ExchangePhase2Finished() bool
ExchangePhase2Finished returns true if mock invocations count is ok
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) ExchangePhase3Finished ¶ added in v0.7.5
func (m *CommunicatorMock) ExchangePhase3Finished() bool
ExchangePhase3Finished returns true if mock invocations count is ok
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 CommunicatorMockExchangePhase1Expectation ¶ added in v0.7.5
type CommunicatorMockExchangePhase1Expectation struct {
// contains filtered or unexported fields
}
type CommunicatorMockExchangePhase1Input ¶ added in v0.7.5
type CommunicatorMockExchangePhase1Input struct {
// contains filtered or unexported fields
}
type CommunicatorMockExchangePhase1Result ¶ added in v0.7.5
type CommunicatorMockExchangePhase1Result struct {
// contains filtered or unexported fields
}
type CommunicatorMockExchangePhase2Expectation ¶ added in v0.7.5
type CommunicatorMockExchangePhase2Expectation struct {
// contains filtered or unexported fields
}
func (*CommunicatorMockExchangePhase2Expectation) Return ¶ added in v0.7.5
func (e *CommunicatorMockExchangePhase2Expectation) Return(r map[core.RecordRef]*packets.Phase2Packet, r1 error)
type CommunicatorMockExchangePhase2Input ¶ added in v0.7.5
type CommunicatorMockExchangePhase2Input struct {
// contains filtered or unexported fields
}
type CommunicatorMockExchangePhase2Result ¶ added in v0.7.5
type CommunicatorMockExchangePhase2Result struct {
// contains filtered or unexported fields
}
type CommunicatorMockExchangePhase3Expectation ¶ added in v0.7.5
type CommunicatorMockExchangePhase3Expectation struct {
// contains filtered or unexported fields
}
func (*CommunicatorMockExchangePhase3Expectation) Return ¶ added in v0.7.5
func (e *CommunicatorMockExchangePhase3Expectation) Return(r map[core.RecordRef]*packets.Phase3Packet, r1 error)
type CommunicatorMockExchangePhase3Input ¶ added in v0.7.5
type CommunicatorMockExchangePhase3Input struct {
// contains filtered or unexported fields
}
type CommunicatorMockExchangePhase3Result ¶ added in v0.7.5
type CommunicatorMockExchangePhase3Result struct {
// contains filtered or unexported fields
}
type FirstPhase ¶
type FirstPhase interface {
Execute(ctx context.Context, pulse *core.Pulse) (*FirstPhaseState, error)
}
func NewFirstPhase ¶ added in v0.7.5
func NewFirstPhase() FirstPhase
type FirstPhaseState ¶ added in v0.6.3
type FirstPhaseState struct { PulseEntry *merkle.PulseEntry PulseHash merkle.OriginHash PulseProof *merkle.PulseProof ValidProofs map[core.Node]*merkle.PulseProof FaultProofs map[core.RecordRef]*merkle.PulseProof 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, map[core.RecordRef]string, 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:"subcomponent"` SecondPhase SecondPhase `inject:"subcomponent"` ThirdPhase ThirdPhase `inject:"subcomponent"` PulseManager core.PulseManager `inject:""` NodeKeeper network.NodeKeeper `inject:""` }
type SecondPhase ¶
type SecondPhase interface {
Execute(ctx context.Context, state *FirstPhaseState) (*SecondPhaseState, error)
}
func NewSecondPhase ¶ added in v0.7.5
func NewSecondPhase() SecondPhase
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 interface {
Execute(ctx context.Context, state *SecondPhaseState) error
}
func NewThirdPhase ¶ added in v0.7.5
func NewThirdPhase() ThirdPhase
type ThirdPhasePulseState ¶ added in v0.6.3
type ThirdPhasePulseState struct { }
type ThirdPhaseReferendumState ¶ added in v0.6.3
type ThirdPhaseReferendumState struct { }