core

package
v0.0.0-...-05bc493 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FullRealm

type FullRealm struct {
	// contains filtered or unexported fields
}

func (*FullRealm) AddPoll

func (r *FullRealm) AddPoll(fn api.MaintenancePollFunc)

polling fn must be fast, and it will remain in polling until it returns false

func (*FullRealm) AdjustedAfter

func (r *FullRealm) AdjustedAfter(d time.Duration) time.Duration

func (*FullRealm) ApplyLocalState

func (r *FullRealm) ApplyLocalState(nsh proofs.NodeStateHash) bool

func (*FullRealm) Blames

func (r *FullRealm) Blames() misbehavior.BlameFactory

func (*FullRealm) BuildNextPopulation

func (r *FullRealm) BuildNextPopulation(ctx context.Context, ranks []profiles.PopulationRank,
	gsh proofs.GlobulaStateHash, csh proofs.CloudStateHash) bool

func (*FullRealm) CommitPulseChange

func (r *FullRealm) CommitPulseChange()

func (*FullRealm) CreateAnnouncement

func (r *FullRealm) CreateAnnouncement(n *pop.NodeAppearance, isJoinerProfileRequired bool) *transport.NodeAnnouncementProfile

func (*FullRealm) CreateLocalAnnouncement

func (r *FullRealm) CreateLocalAnnouncement() *transport.NodeAnnouncementProfile

func (*FullRealm) CreateLocalPhase0Announcement

func (r *FullRealm) CreateLocalPhase0Announcement() *transport.NodeAnnouncementProfile

func (*FullRealm) Frauds

func (r *FullRealm) Frauds() misbehavior.FraudFactory

func (*FullRealm) GetDigestFactory

func (r *FullRealm) GetDigestFactory() transport.ConsensusDigestFactory

func (*FullRealm) GetLastCloudStateHash

func (r *FullRealm) GetLastCloudStateHash() proofs.CloudStateHash

func (*FullRealm) GetLocalConfig

func (r *FullRealm) GetLocalConfig() api.LocalNodeConfiguration

func (*FullRealm) GetLocalProfile

func (r *FullRealm) GetLocalProfile() profiles.LocalNode

func (*FullRealm) GetNeighbourhoodSizes

func (r *FullRealm) GetNeighbourhoodSizes() transport.NeighbourhoodSizes

func (*FullRealm) GetNextPulseNumber

func (r *FullRealm) GetNextPulseNumber() pulse.Number

func (*FullRealm) GetNodeCount

func (r *FullRealm) GetNodeCount() int

func (*FullRealm) GetOriginalPulse

func (r *FullRealm) GetOriginalPulse() proofs.OriginalPulsarPacket

func (*FullRealm) GetPacketBuilder

func (r *FullRealm) GetPacketBuilder() transport.PacketBuilder

func (*FullRealm) GetPacketSender

func (r *FullRealm) GetPacketSender() transport.PacketSender

func (*FullRealm) GetPopulation

func (r *FullRealm) GetPopulation() pop.RealmPopulation

func (*FullRealm) GetProfileFactory

func (r *FullRealm) GetProfileFactory() profiles.Factory

func (*FullRealm) GetPulseData

func (r *FullRealm) GetPulseData() pulse.Data

func (*FullRealm) GetPulseDataDigest

func (r *FullRealm) GetPulseDataDigest() cryptkit.DigestHolder

func (*FullRealm) GetPulseNumber

func (r *FullRealm) GetPulseNumber() pulse.Number

func (*FullRealm) GetPurgatory

func (r *FullRealm) GetPurgatory() *purgatory.RealmPurgatory

func (*FullRealm) GetRoundContext

func (r *FullRealm) GetRoundContext() context.Context

func (*FullRealm) GetSelf

func (r *FullRealm) GetSelf() *pop.NodeAppearance

func (*FullRealm) GetSelfNodeID

func (r *FullRealm) GetSelfNodeID() node.ShortNodeID

func (*FullRealm) GetSignatureVerifier

func (r *FullRealm) GetSignatureVerifier(pks cryptkit.PublicKeyStore) cryptkit.SignatureVerifier

func (*FullRealm) GetSigner

func (r *FullRealm) GetSigner() cryptkit.DigestSigner

func (*FullRealm) GetStartedAt

func (r *FullRealm) GetStartedAt() time.Time

func (*FullRealm) GetStrategy

func (r *FullRealm) GetStrategy() RoundStrategy

func (*FullRealm) GetTimings

func (r *FullRealm) GetTimings() api.RoundTimings

func (*FullRealm) GetVerifierFactory

func (r *FullRealm) GetVerifierFactory() cryptkit.SignatureVerifierFactory

func (*FullRealm) GetWelcomePackage

func (r *FullRealm) GetWelcomePackage() *proofs.NodeWelcomePackage

func (*FullRealm) IsJoiner

func (r *FullRealm) IsJoiner() bool

func (*FullRealm) IsLocalStateful

func (r *FullRealm) IsLocalStateful() bool

func (*FullRealm) MonitorOtherPulses

func (r *FullRealm) MonitorOtherPulses(packet transport.PulsePacketReader, from endpoints.Inbound) error

func (*FullRealm) NotifyRoundStopped

func (r *FullRealm) NotifyRoundStopped(ctx context.Context)

func (*FullRealm) PreparePulseChange

func (r *FullRealm) PreparePulseChange() (bool, <-chan api.UpstreamState)

func (*FullRealm) VerifyPacketAuthenticity

func (r *FullRealm) VerifyPacketAuthenticity(ctx context.Context, packet transport.PacketParser,
	from endpoints.Inbound, sourceNode packetdispatch.MemberPacketReceiver, unverifiedFlag coreapi.PacketVerifyFlags,
	pd population.PacketDispatcher, verifyFlags coreapi.PacketVerifyFlags) (coreapi.PacketVerifyFlags, error)

func (*FullRealm) VerifyPacketPulseNumber

func (r *FullRealm) VerifyPacketPulseNumber(ctx context.Context, packet transport.PacketParser, from endpoints.Inbound,
	filterPN, nextPN pulse.Number, details string) (bool, error)

type HostPacketDispatcherTemplate

type HostPacketDispatcherTemplate struct {
}

func (*HostPacketDispatcherTemplate) DispatchMemberPacket

func (*HostPacketDispatcherTemplate) HasCustomVerifyForHost

func (*HostPacketDispatcherTemplate) HasCustomVerifyForHost(from endpoints.Inbound, verifyFlags coreapi.PacketVerifyFlags) bool

func (*HostPacketDispatcherTemplate) TriggerUnknownMember

func (*HostPacketDispatcherTemplate) TriggerUnknownMember(ctx context.Context, memberID node.ShortNodeID,
	packet transport.MemberPacketReader, from endpoints.Inbound) (bool, error)

type MemberPacketDispatcherTemplate

type MemberPacketDispatcherTemplate struct {
}

func (*MemberPacketDispatcherTemplate) DispatchHostPacket

func (*MemberPacketDispatcherTemplate) HasCustomVerifyForHost

func (*MemberPacketDispatcherTemplate) HasCustomVerifyForHost(from endpoints.Inbound, verifyFlags coreapi.PacketVerifyFlags) bool

func (*MemberPacketDispatcherTemplate) TriggerUnknownMember

type NodeUpdateCallback

type NodeUpdateCallback interface {
	population.EventDispatcher
}

type PerNodePacketDispatcherFactory

type PerNodePacketDispatcherFactory interface {
	CreatePerNodePacketHandler(perNodeContext context.Context, node *population.NodeAppearance) (context.Context, population.DispatchMemberPacketFunc)
}

type PhaseController

type PhaseController interface {
	GetPacketType() []phases.PacketType
	CreatePacketDispatcher(pt phases.PacketType, ctlIndex int, realm *FullRealm) (population.PacketDispatcher, PerNodePacketDispatcherFactory)

	BeforeStart(ctx context.Context, realm *FullRealm)
	StartWorker(ctx context.Context, realm *FullRealm)
}

realm is provided for this handler to avoid being replicated in individual handlers

type PhaseControllerTemplate

type PhaseControllerTemplate struct {
}

func (*PhaseControllerTemplate) BeforeStart

func (c *PhaseControllerTemplate) BeforeStart(ctx context.Context, realm *FullRealm)

func (*PhaseControllerTemplate) StartWorker

func (*PhaseControllerTemplate) StartWorker(ctx context.Context, realm *FullRealm)

type PhaseControllersBundle

type PhaseControllersBundle interface {
	IsDynamicPopulationRequired() bool
	CreatePrepPhaseControllers() []PrepPhaseController
	CreateFullPhaseControllers(nodeCount int) ([]PhaseController, NodeUpdateCallback)
}

type PhaseControllersBundleFactory

type PhaseControllersBundleFactory interface {
	CreateControllersBundle(population census.OnlinePopulation, config api.LocalNodeConfiguration) PhaseControllersBundle
}

type PhasedRoundController

type PhasedRoundController struct {
	// contains filtered or unexported fields
}

func NewPhasedRoundController

func NewPhasedRoundController(strategy RoundStrategy, chronicle api.ConsensusChronicles, bundle PhaseControllersBundle,
	transport transport.Factory, config api.LocalNodeConfiguration,
	controlFeeder api.ConsensusControlFeeder, candidateFeeder api.CandidateControlFeeder, ephemeralFeeder api.EphemeralControlFeeder,
) *PhasedRoundController

func (*PhasedRoundController) HandlePacket

func (*PhasedRoundController) IsRunning

func (r *PhasedRoundController) IsRunning() bool

func (*PhasedRoundController) PrepareConsensusRound

func (r *PhasedRoundController) PrepareConsensusRound(upstream api.UpstreamController)

func (*PhasedRoundController) StopConsensusRound

func (r *PhasedRoundController) StopConsensusRound()

type PhasedRoundControllerFactory

type PhasedRoundControllerFactory struct {
	// contains filtered or unexported fields
}

func (*PhasedRoundControllerFactory) CreateConsensusRound

func (c *PhasedRoundControllerFactory) CreateConsensusRound(chronicle api.ConsensusChronicles, controlFeeder api.ConsensusControlFeeder,
	candidateFeeder api.CandidateControlFeeder, ephemeralFeeder api.EphemeralControlFeeder) api.RoundController

func (*PhasedRoundControllerFactory) GetLocalConfiguration

func (c *PhasedRoundControllerFactory) GetLocalConfiguration() api.LocalNodeConfiguration

type PrepPhaseController

type PrepPhaseController interface {
	GetPacketType() []phases.PacketType
	CreatePacketDispatcher(pt phases.PacketType, realm *PrepRealm) population.PacketDispatcher

	BeforeStart(ctx context.Context, realm *PrepRealm)
	StartWorker(ctx context.Context, realm *PrepRealm)
}

type PrepPhaseControllerTemplate

type PrepPhaseControllerTemplate struct {
}

func (*PrepPhaseControllerTemplate) BeforeStart

func (c *PrepPhaseControllerTemplate) BeforeStart(ctx context.Context, realm *PrepRealm)

func (*PrepPhaseControllerTemplate) StartWorker

func (*PrepPhaseControllerTemplate) StartWorker(ctx context.Context, realm *PrepRealm)

type PrepRealm

type PrepRealm struct {
	// contains filtered or unexported fields
}

PrepRealm is a functionally limited and temporary realm that is used when this node doesn't know pulse or last consensus. It can ONLY pre-processed packets, but is disallowed to send them.

Pre-processed packets as postponed by default and processing will be repeated when FullRealm is activated.

func (PrepRealm) AddPoll

func (r PrepRealm) AddPoll(fn api.MaintenancePollFunc)

polling fn must be fast, and it will remain in polling until it returns false

func (PrepRealm) AdjustedAfter

func (r PrepRealm) AdjustedAfter(d time.Duration) time.Duration

func (*PrepRealm) ApplyCloudIntro

func (p *PrepRealm) ApplyCloudIntro(lastCloudStateHash cryptkit.DigestHolder, populationCount int, from endpoints.Inbound)

func (*PrepRealm) ApplyPulseData

func (p *PrepRealm) ApplyPulseData(ctx context.Context, startedAt time.Time, pp transport.PulsePacketReader, fromPulsar bool, from endpoints.Inbound) error

func (PrepRealm) GetDigestFactory

func (r PrepRealm) GetDigestFactory() transport.ConsensusDigestFactory

func (PrepRealm) GetLocalConfig

func (r PrepRealm) GetLocalConfig() api.LocalNodeConfiguration

func (*PrepRealm) GetMandateRegistry

func (p *PrepRealm) GetMandateRegistry() census.MandateRegistry

func (*PrepRealm) GetOriginalPulse

func (p *PrepRealm) GetOriginalPulse() proofs.OriginalPulsarPacket

func (PrepRealm) GetRoundContext

func (r PrepRealm) GetRoundContext() context.Context

func (PrepRealm) GetSignatureVerifier

func (r PrepRealm) GetSignatureVerifier(pks cryptkit.PublicKeyStore) cryptkit.SignatureVerifier

func (PrepRealm) GetSigner

func (r PrepRealm) GetSigner() cryptkit.DigestSigner

func (PrepRealm) GetStartedAt

func (r PrepRealm) GetStartedAt() time.Time

func (PrepRealm) GetStrategy

func (r PrepRealm) GetStrategy() RoundStrategy

func (PrepRealm) GetVerifierFactory

func (r PrepRealm) GetVerifierFactory() cryptkit.SignatureVerifierFactory

func (PrepRealm) VerifyPacketAuthenticity

func (r PrepRealm) VerifyPacketAuthenticity(ctx context.Context, packet transport.PacketParser,
	from endpoints.Inbound, sourceNode packetdispatch.MemberPacketReceiver, unverifiedFlag coreapi.PacketVerifyFlags,
	pd population.PacketDispatcher, verifyFlags coreapi.PacketVerifyFlags) (coreapi.PacketVerifyFlags, error)

func (PrepRealm) VerifyPacketPulseNumber

func (r PrepRealm) VerifyPacketPulseNumber(ctx context.Context, packet transport.PacketParser, from endpoints.Inbound,
	filterPN, nextPN pulse.Number, details string) (bool, error)

type RoundState

type RoundState uint8
const (
	RoundInactive RoundState = iota
	RoundAwaitingPulse
	RoundPulseDetected
	RoundPulseAccepted
	RoundPulsePreparing
	RoundPulseCommitted
	RoundConsensusFinished
	RoundStopped
	RoundTimedOut
	RoundAborted
)

type RoundStateMachineWorker

type RoundStateMachineWorker struct {
	api.UpstreamController
	// contains filtered or unexported fields
}

func (*RoundStateMachineWorker) CancelPulseChange

func (p *RoundStateMachineWorker) CancelPulseChange()

func (*RoundStateMachineWorker) CommitPulseChange

func (p *RoundStateMachineWorker) CommitPulseChange(report api.UpstreamReport, pd pulse.Data, activeCensus census.Operational)

func (*RoundStateMachineWorker) CommitPulseChangeByStateless

func (p *RoundStateMachineWorker) CommitPulseChangeByStateless(report api.UpstreamReport, pd pulse.Data, activeCensus census.Operational)

func (*RoundStateMachineWorker) ConsensusFinished

func (p *RoundStateMachineWorker) ConsensusFinished(report api.UpstreamReport, expectedCensus census.Operational)

func (*RoundStateMachineWorker) EnsureRunning

func (p *RoundStateMachineWorker) EnsureRunning()

func (*RoundStateMachineWorker) GetState

func (p *RoundStateMachineWorker) GetState() RoundState

func (*RoundStateMachineWorker) IsRunning

func (p *RoundStateMachineWorker) IsRunning() bool

func (*RoundStateMachineWorker) IsStartedAndRunning

func (p *RoundStateMachineWorker) IsStartedAndRunning() (bool, bool)

func (*RoundStateMachineWorker) OnFullRoundStarting

func (p *RoundStateMachineWorker) OnFullRoundStarting()

func (*RoundStateMachineWorker) OnPrepRoundFailed

func (p *RoundStateMachineWorker) OnPrepRoundFailed()

func (*RoundStateMachineWorker) OnPulseDetected

func (p *RoundStateMachineWorker) OnPulseDetected()

func (*RoundStateMachineWorker) OnRoundStopped

func (p *RoundStateMachineWorker) OnRoundStopped(ctx context.Context)

func (*RoundStateMachineWorker) PreparePulseChange

func (p *RoundStateMachineWorker) PreparePulseChange(report api.UpstreamReport, ch chan<- api.UpstreamState)

func (*RoundStateMachineWorker) SafeStartAndGetIsRunning

func (p *RoundStateMachineWorker) SafeStartAndGetIsRunning() bool

func (*RoundStateMachineWorker) SetTimeout

func (p *RoundStateMachineWorker) SetTimeout(deadline time.Time)

func (*RoundStateMachineWorker) Start

func (p *RoundStateMachineWorker) Start()

func (*RoundStateMachineWorker) Stop

func (p *RoundStateMachineWorker) Stop()

type RoundStrategy

type RoundStrategy interface {
	GetBaselineWeightForNeighbours() uint32
	ShuffleNodeSequence(n int, swap func(i, j int))

	ConfigureRoundContext(ctx context.Context, expectedPulse pulse.Number, self profiles.LocalNode) context.Context
}

type RoundStrategyFactory

type RoundStrategyFactory interface {
	CreateRoundStrategy(online census.OnlinePopulation, config api.LocalNodeConfiguration) (RoundStrategy, PhaseControllersBundle)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL