Documentation ¶
Index ¶
- type CandidateControlFeeder
- type CandidateControlFeederMock
- func (m *CandidateControlFeederMock) MinimockFinish()
- func (m *CandidateControlFeederMock) MinimockPickNextJoinCandidateDone() bool
- func (m *CandidateControlFeederMock) MinimockPickNextJoinCandidateInspect()
- func (m *CandidateControlFeederMock) MinimockRemoveJoinCandidateDone() bool
- func (m *CandidateControlFeederMock) MinimockRemoveJoinCandidateInspect()
- func (m *CandidateControlFeederMock) MinimockWait(timeout mm_time.Duration)
- func (mmPickNextJoinCandidate *CandidateControlFeederMock) PickNextJoinCandidate() (c1 profiles.CandidateProfile, d1 cryptkit.DigestHolder)
- func (mmPickNextJoinCandidate *CandidateControlFeederMock) PickNextJoinCandidateAfterCounter() uint64
- func (mmPickNextJoinCandidate *CandidateControlFeederMock) PickNextJoinCandidateBeforeCounter() uint64
- func (mmRemoveJoinCandidate *CandidateControlFeederMock) RemoveJoinCandidate(candidateAdded bool, nodeID node.ShortNodeID) (b1 bool)
- func (mmRemoveJoinCandidate *CandidateControlFeederMock) RemoveJoinCandidateAfterCounter() uint64
- func (mmRemoveJoinCandidate *CandidateControlFeederMock) RemoveJoinCandidateBeforeCounter() uint64
- type CandidateControlFeederMockPickNextJoinCandidateExpectation
- type CandidateControlFeederMockPickNextJoinCandidateResults
- type CandidateControlFeederMockRemoveJoinCandidateExpectation
- type CandidateControlFeederMockRemoveJoinCandidateParams
- type CandidateControlFeederMockRemoveJoinCandidateResults
- type ConsensusChronicles
- type ConsensusControlFeeder
- type ConsensusController
- type EphemeralControlFeeder
- type EphemeralMode
- type LocalNodeConfiguration
- type MaintenancePollFunc
- type PulseControlFeeder
- type RoundControlCode
- type RoundController
- type RoundControllerFactory
- type RoundStateCallback
- type RoundTimings
- type TrafficControlFeeder
- type UpstreamController
- type UpstreamReport
- type UpstreamState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CandidateControlFeeder ¶
type CandidateControlFeeder interface { PickNextJoinCandidate() (profiles.CandidateProfile, cryptkit.DigestHolder) RemoveJoinCandidate(candidateAdded bool, nodeID node.ShortNodeID) bool }
type CandidateControlFeederMock ¶
type CandidateControlFeederMock struct { PickNextJoinCandidateMock mCandidateControlFeederMockPickNextJoinCandidate RemoveJoinCandidateMock mCandidateControlFeederMockRemoveJoinCandidate // contains filtered or unexported fields }
CandidateControlFeederMock implements CandidateControlFeeder
func NewCandidateControlFeederMock ¶
func NewCandidateControlFeederMock(t minimock.Tester) *CandidateControlFeederMock
NewCandidateControlFeederMock returns a mock for CandidateControlFeeder
func (*CandidateControlFeederMock) MinimockFinish ¶
func (m *CandidateControlFeederMock) MinimockFinish()
MinimockFinish checks that all mocked methods have been called the expected number of times
func (*CandidateControlFeederMock) MinimockPickNextJoinCandidateDone ¶
func (m *CandidateControlFeederMock) MinimockPickNextJoinCandidateDone() bool
MinimockPickNextJoinCandidateDone returns true if the count of the PickNextJoinCandidate invocations corresponds the number of defined expectations
func (*CandidateControlFeederMock) MinimockPickNextJoinCandidateInspect ¶
func (m *CandidateControlFeederMock) MinimockPickNextJoinCandidateInspect()
MinimockPickNextJoinCandidateInspect logs each unmet expectation
func (*CandidateControlFeederMock) MinimockRemoveJoinCandidateDone ¶
func (m *CandidateControlFeederMock) MinimockRemoveJoinCandidateDone() bool
MinimockRemoveJoinCandidateDone returns true if the count of the RemoveJoinCandidate invocations corresponds the number of defined expectations
func (*CandidateControlFeederMock) MinimockRemoveJoinCandidateInspect ¶
func (m *CandidateControlFeederMock) MinimockRemoveJoinCandidateInspect()
MinimockRemoveJoinCandidateInspect logs each unmet expectation
func (*CandidateControlFeederMock) MinimockWait ¶
func (m *CandidateControlFeederMock) MinimockWait(timeout mm_time.Duration)
MinimockWait waits for all mocked methods to be called the expected number of times
func (*CandidateControlFeederMock) PickNextJoinCandidate ¶
func (mmPickNextJoinCandidate *CandidateControlFeederMock) PickNextJoinCandidate() (c1 profiles.CandidateProfile, d1 cryptkit.DigestHolder)
PickNextJoinCandidate implements CandidateControlFeeder
func (*CandidateControlFeederMock) PickNextJoinCandidateAfterCounter ¶
func (mmPickNextJoinCandidate *CandidateControlFeederMock) PickNextJoinCandidateAfterCounter() uint64
PickNextJoinCandidateAfterCounter returns a count of finished CandidateControlFeederMock.PickNextJoinCandidate invocations
func (*CandidateControlFeederMock) PickNextJoinCandidateBeforeCounter ¶
func (mmPickNextJoinCandidate *CandidateControlFeederMock) PickNextJoinCandidateBeforeCounter() uint64
PickNextJoinCandidateBeforeCounter returns a count of CandidateControlFeederMock.PickNextJoinCandidate invocations
func (*CandidateControlFeederMock) RemoveJoinCandidate ¶
func (mmRemoveJoinCandidate *CandidateControlFeederMock) RemoveJoinCandidate(candidateAdded bool, nodeID node.ShortNodeID) (b1 bool)
RemoveJoinCandidate implements CandidateControlFeeder
func (*CandidateControlFeederMock) RemoveJoinCandidateAfterCounter ¶
func (mmRemoveJoinCandidate *CandidateControlFeederMock) RemoveJoinCandidateAfterCounter() uint64
RemoveJoinCandidateAfterCounter returns a count of finished CandidateControlFeederMock.RemoveJoinCandidate invocations
func (*CandidateControlFeederMock) RemoveJoinCandidateBeforeCounter ¶
func (mmRemoveJoinCandidate *CandidateControlFeederMock) RemoveJoinCandidateBeforeCounter() uint64
RemoveJoinCandidateBeforeCounter returns a count of CandidateControlFeederMock.RemoveJoinCandidate invocations
type CandidateControlFeederMockPickNextJoinCandidateExpectation ¶
type CandidateControlFeederMockPickNextJoinCandidateExpectation struct { Counter uint64 // contains filtered or unexported fields }
CandidateControlFeederMockPickNextJoinCandidateExpectation specifies expectation struct of the CandidateControlFeeder.PickNextJoinCandidate
type CandidateControlFeederMockPickNextJoinCandidateResults ¶
type CandidateControlFeederMockPickNextJoinCandidateResults struct {
// contains filtered or unexported fields
}
CandidateControlFeederMockPickNextJoinCandidateResults contains results of the CandidateControlFeeder.PickNextJoinCandidate
type CandidateControlFeederMockRemoveJoinCandidateExpectation ¶
type CandidateControlFeederMockRemoveJoinCandidateExpectation struct { Counter uint64 // contains filtered or unexported fields }
CandidateControlFeederMockRemoveJoinCandidateExpectation specifies expectation struct of the CandidateControlFeeder.RemoveJoinCandidate
func (*CandidateControlFeederMockRemoveJoinCandidateExpectation) Then ¶
func (e *CandidateControlFeederMockRemoveJoinCandidateExpectation) Then(b1 bool) *CandidateControlFeederMock
Then sets up CandidateControlFeeder.RemoveJoinCandidate return parameters for the expectation previously defined by the When method
type CandidateControlFeederMockRemoveJoinCandidateParams ¶
type CandidateControlFeederMockRemoveJoinCandidateParams struct {
// contains filtered or unexported fields
}
CandidateControlFeederMockRemoveJoinCandidateParams contains parameters of the CandidateControlFeeder.RemoveJoinCandidate
type CandidateControlFeederMockRemoveJoinCandidateResults ¶
type CandidateControlFeederMockRemoveJoinCandidateResults struct {
// contains filtered or unexported fields
}
CandidateControlFeederMockRemoveJoinCandidateResults contains results of the CandidateControlFeeder.RemoveJoinCandidate
type ConsensusChronicles ¶
type ConsensusChronicles interface { GetProfileFactory(ksf cryptkit.KeyStoreFactory) profiles.Factory GetActiveCensus() census.Active GetExpectedCensus() census.Expected GetLatestCensus() (lastCensus census.Operational, expectedCensus bool) GetRecentCensus(pn pulse.Number) census.Operational }
type ConsensusControlFeeder ¶
type ConsensusControlFeeder interface { TrafficControlFeeder PulseControlFeeder GetRequiredPowerLevel() power.Request OnAppliedMembershipProfile(mode member.OpMode, pw member.Power, effectiveSince pulse.Number) GetRequiredGracefulLeave() (bool, uint32) OnAppliedGracefulLeave(exitCode uint32, effectiveSince pulse.Number) OnPulseDetected() // this method is not currently invoked }
type ConsensusController ¶
type EphemeralControlFeeder ¶
type EphemeralControlFeeder interface { PulseControlFeeder GetEphemeralTimings(LocalNodeConfiguration) RoundTimings /* Minimum time after the last ephemeral round before checking for another candidate */ GetMinDuration() time.Duration /* Maximum time to wait for a candidate before starting a next ephemeral round */ GetMaxDuration() time.Duration /* if true, then a new round can be triggered by a joiner candidate */ IsActive() bool CreateEphemeralPulsePacket(census census.Operational) proofs.OriginalPulsarPacket OnNonEphemeralPacket(ctx context.Context, parser transport.PacketParser, inbound endpoints.Inbound) error /* Applied when an ephemeral node gets a non-ephemeral pulse data from another member */ CanStopEphemeralByPulse(pd pulse.Data, localNode profiles.ActiveNode) bool /* Applied when an ephemeral node finishes consensus */ CanStopEphemeralByCensus(expected census.Expected) bool EphemeralConsensusFinished(isNextEphemeral bool, roundStartedAt time.Time, expected census.Operational) /* is called: (1) immediately after TryConvertFromEphemeral returned true (2) at start of full realm, when ephemeral mode was cancelled by Phase0/Phase1 packets */ OnEphemeralCancelled() }
type EphemeralMode ¶
type EphemeralMode uint8
const ( EphemeralNotAllowed EphemeralMode = iota EphemeralAllowed // can generate ephemeral pulses )
func (EphemeralMode) IsEnabled ¶
func (mode EphemeralMode) IsEnabled() bool
type LocalNodeConfiguration ¶
type LocalNodeConfiguration interface { GetConsensusTimings(nextPulseDelta uint16) RoundTimings GetEphemeralTimings(nextPulseDelta uint16) RoundTimings GetSecretKeyStore() cryptkit.SecretKeyStore GetParentContext() context.Context GetNodeCountHint() int }
type MaintenancePollFunc ¶
type PulseControlFeeder ¶
type RoundControlCode ¶
type RoundControlCode uint8
const ( KeepRound RoundControlCode = iota StartNextRound // NextRoundPrepare NextRoundTerminate )
type RoundController ¶
type RoundController interface { PrepareConsensusRound(upstream UpstreamController) StopConsensusRound() HandlePacket(ctx context.Context, packet transport.PacketParser, from endpoints.Inbound) (RoundControlCode, error) }
type RoundControllerFactory ¶
type RoundControllerFactory interface { CreateConsensusRound(chronicle ConsensusChronicles, controlFeeder ConsensusControlFeeder, candidateFeeder CandidateControlFeeder, ephemeralFeeder EphemeralControlFeeder) RoundController GetLocalConfiguration() LocalNodeConfiguration }
type RoundStateCallback ¶
type RoundStateCallback interface { UpstreamController /* Called on receiving seem-to-be-valid Pulsar or Phase0 packets. Can be called multiple time in sequence. Application MUST NOT consider it as a new pulse. */ OnPulseDetected() OnFullRoundStarting() // A special case for a stateless, as it doesnt request NSH with PreparePulseChange CommitPulseChangeByStateless(report UpstreamReport, pd pulse.Data, activeCensus census.Operational) /* Called by the longest phase worker on termination */ OnRoundStopped(ctx context.Context) }
type RoundTimings ¶
type RoundTimings struct { // Time to wait since NSH is requested before starting Phase0. StartPhase0At time.Duration // When Phase2 can be finished sooner by number of covered nodes, termination of Phase2 will be delayed // by BeforeInPhase2ChasingDelay after every Phase2 packet. No extra delays when = 0. // Total Phase2 time can NOT exceed EndOfPhase2 BeforeInPhase2ChasingDelay time.Duration // When Phase3 can be finished sooner by number of covered nodes, termination of Phase2 will be delayed // by BeforeInPhase3ChasingDelay after every Phase3 packet. No extra delays when = 0. // Total Phase3 time can NOT exceed EndOfPhase3 BeforeInPhase3ChasingDelay time.Duration // Time to finish receiving of Phase1 packets from other nodes and to finish producing Phase2 packets as well // since start of the consensus round EndOfPhase1 time.Duration // Time to wait before re-sending Phase1 packets (marked as requests) to missing nodes // since start of the consensus round. No retries when = 0 StartPhase1RetryAt time.Duration // Time to finish receiving Phase2 packets from other nodes and START producing Phase3 packets // Phase3 can start sooner if there is enough number of nodes covered by Phase2 EndOfPhase2 time.Duration // Time to finish receiving Phase3 packets from other nodes EndOfPhase3 time.Duration // Hard stop for all consensus operations EndOfConsensus time.Duration }
func (RoundTimings) String ¶
func (t RoundTimings) String() string
type TrafficControlFeeder ¶
type TrafficControlFeeder interface { /* Application traffic should be stopped or throttled down for the given duration LevelMax and LevelNormal should be considered equal, and duration doesnt apply to them */ SetTrafficLimit(level capacity.Level, duration time.Duration) /* Application traffic can be resumed at full */ ResumeTraffic() }
type UpstreamController ¶
type UpstreamController interface { /* Called on a valid Pulse, but the pulse can yet be rolled back. Application should return immediately and start preparation of NodeState hash. NodeState should be sent into the channel when ready, but the channel will not be read if CancelPulseChange() has happened. The provided channel is guaranteed to have a buffer for one element. */ PreparePulseChange(report UpstreamReport, ch chan<- UpstreamState) /* Called on a confirmed Pulse and indicates final change of Pulse for the application. */ CommitPulseChange(report UpstreamReport, pd pulse.Data, activeCensus census.Operational) /* Called on a rollback of Pulse and indicates continuation of the previous Pulse for the application. */ CancelPulseChange() /* Consensus is finished. If expectedCensus == nil then this node was evicted from consensus. */ ConsensusFinished(report UpstreamReport, expectedCensus census.Operational) /* Consensus was stopped abnormally */ ConsensusAborted() }
type UpstreamReport ¶
type UpstreamState ¶
type UpstreamState struct {
NodeState proofs.NodeStateHash
}