Documentation ¶
Overview ¶
Package isaac runs consensus process
Index ¶
- Variables
- func DistributeWorkerWithSyncSourcePool(ctx context.Context, pool *SyncSourcePool, picksize int, semsize uint64, ...) error
- func ErrGroupWorkerWithSyncSourcePool(ctx context.Context, pool *SyncSourcePool, picksize int, semsize uint64, ...) error
- func FilterCandidates(height base.Height, candidates []base.SuffrageCandidateStateValue) []base.SuffrageCandidateStateValue
- func GetSuffrageFromDatabase(db Database, blockheight base.Height) (base.Suffrage, bool, error)
- func InCandidates(node base.Node, candidates []base.SuffrageCandidateStateValue) bool
- func IsNodeInLastConsensusNodes(node base.Node, proof base.SuffrageProof, st base.State) (base.Suffrage, bool, error)
- func IsSuffrageConfirmBallotFact(fact base.Fact) bool
- func IsValidVoteproofWithSuffrage(vp base.Voteproof, suf base.Suffrage) error
- func IsValidWithdrawWithSuffrage(height base.Height, withdraw base.SuffrageWithdrawOperation, suf base.Suffrage) error
- func IsValidWithdrawWithSuffrageLifespan(height base.Height, withdraw base.SuffrageWithdrawOperation, suf base.Suffrage, ...) error
- func LastCandidatesFromState(height base.Height, getStateFunc base.GetStateFunc) (base.Height, []base.SuffrageCandidateStateValue, error)
- func NewCandidatesOfMajoritySuffrageCandidateLimiterRule(ratio float64, getSuffrage func() (uint64, error)) (uint64, error)
- func NewFixedSuffrageCandidateLimiter(rule FixedSuffrageCandidateLimiterRule) base.SuffrageCandidateLimiter
- func NewMajoritySuffrageCandidateLimiter(rule MajoritySuffrageCandidateLimiterRule, getSuffrage func() (uint64, error)) base.SuffrageCandidateLimiter
- func NewNode(pub base.Publickey, addr base.Address) base.BaseNode
- func NewSuffrageFromState(st base.State) (suf base.Suffrage, _ error)
- func NewSuffrageWithWithdraws(suf base.Suffrage, threshold base.Threshold, ...) (base.Suffrage, error)
- type ACCEPTBallot
- func (bl ACCEPTBallot) BallotSignFact() base.ACCEPTBallotSignFact
- func (bl *ACCEPTBallot) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (bl ACCEPTBallot) HashBytes() []byte
- func (bl ACCEPTBallot) IsValid(networkID []byte) error
- func (bl ACCEPTBallot) MarshalJSON() ([]byte, error)
- func (bl ACCEPTBallot) Point() base.StagePoint
- func (bl ACCEPTBallot) SignFact() base.BallotSignFact
- func (bl ACCEPTBallot) Voteproof() base.Voteproof
- func (bl ACCEPTBallot) Withdraws() []base.SuffrageWithdrawOperation
- type ACCEPTBallotFact
- func (fact *ACCEPTBallotFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (fact ACCEPTBallotFact) IsValid([]byte) error
- func (fact ACCEPTBallotFact) MarshalJSON() ([]byte, error)
- func (fact ACCEPTBallotFact) NewBlock() util.Hash
- func (fact ACCEPTBallotFact) Point() base.StagePoint
- func (fact ACCEPTBallotFact) Proposal() util.Hash
- func (fact ACCEPTBallotFact) Stage() base.Stage
- func (fact ACCEPTBallotFact) WithdrawFacts() []util.Hash
- type ACCEPTBallotFactJSONMarshaler
- type ACCEPTBallotFactJSONUnmarshaler
- type ACCEPTBallotSignFact
- func (sf ACCEPTBallotSignFact) BallotFact() base.ACCEPTBallotFact
- func (sf *ACCEPTBallotSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (sf ACCEPTBallotSignFact) Fact() base.Fact
- func (sf ACCEPTBallotSignFact) HashBytes() []byte
- func (sf ACCEPTBallotSignFact) IsValid(networkID []byte) error
- func (sf ACCEPTBallotSignFact) MarshalJSON() ([]byte, error)
- func (sf ACCEPTBallotSignFact) Node() base.Address
- func (sf *ACCEPTBallotSignFact) NodeSign(priv base.Privatekey, networkID base.NetworkID, node base.Address) error
- func (sf ACCEPTBallotSignFact) NodeSigns() []base.NodeSign
- func (sf ACCEPTBallotSignFact) Signer() base.Publickey
- func (sf ACCEPTBallotSignFact) Signs() []base.Sign
- type ACCEPTStuckVoteproof
- func (vp *ACCEPTStuckVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp *ACCEPTStuckVoteproof) Finish() *ACCEPTStuckVoteproof
- func (vp ACCEPTStuckVoteproof) FinishedAt() time.Time
- func (vp ACCEPTStuckVoteproof) HashBytes() []byte
- func (vp ACCEPTStuckVoteproof) ID() string
- func (ACCEPTStuckVoteproof) IsStuckVoteproof() bool
- func (vp ACCEPTStuckVoteproof) IsValid(networkID []byte) error
- func (vp ACCEPTStuckVoteproof) Majority() base.BallotFact
- func (vp ACCEPTStuckVoteproof) MarshalJSON() ([]byte, error)
- func (vp ACCEPTStuckVoteproof) Point() base.StagePoint
- func (vp ACCEPTStuckVoteproof) Result() base.VoteResult
- func (vp *ACCEPTStuckVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
- func (vp *ACCEPTStuckVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
- func (vp *ACCEPTStuckVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
- func (vp *ACCEPTStuckVoteproof) SetThreshold(s base.Threshold) *baseVoteproof
- func (vp ACCEPTStuckVoteproof) SignFacts() []base.BallotSignFact
- func (vp ACCEPTStuckVoteproof) Threshold() base.Threshold
- type ACCEPTVoteproof
- func (vp ACCEPTVoteproof) BallotMajority() base.ACCEPTBallotFact
- func (vp ACCEPTVoteproof) BallotSignFacts() []base.ACCEPTBallotSignFact
- func (vp *ACCEPTVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp *ACCEPTVoteproof) Finish() baseVoteproof
- func (vp ACCEPTVoteproof) FinishedAt() time.Time
- func (vp ACCEPTVoteproof) HashBytes() []byte
- func (vp ACCEPTVoteproof) ID() string
- func (vp ACCEPTVoteproof) IsValid(networkID []byte) error
- func (vp ACCEPTVoteproof) Majority() base.BallotFact
- func (vp ACCEPTVoteproof) MarshalJSON() ([]byte, error)
- func (vp ACCEPTVoteproof) Point() base.StagePoint
- func (vp ACCEPTVoteproof) Result() base.VoteResult
- func (vp *ACCEPTVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
- func (vp *ACCEPTVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
- func (vp *ACCEPTVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
- func (vp *ACCEPTVoteproof) SetThreshold(s base.Threshold) *baseVoteproof
- func (vp ACCEPTVoteproof) SignFacts() []base.BallotSignFact
- func (vp ACCEPTVoteproof) Threshold() base.Threshold
- type ACCEPTWithdrawVoteproof
- func (vp *ACCEPTWithdrawVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp *ACCEPTWithdrawVoteproof) Finish() baseVoteproof
- func (vp ACCEPTWithdrawVoteproof) FinishedAt() time.Time
- func (vp ACCEPTWithdrawVoteproof) HashBytes() []byte
- func (vp ACCEPTWithdrawVoteproof) ID() string
- func (vp ACCEPTWithdrawVoteproof) IsValid(networkID []byte) error
- func (ACCEPTWithdrawVoteproof) IsWithdrawVoteproof() bool
- func (vp ACCEPTWithdrawVoteproof) Majority() base.BallotFact
- func (vp ACCEPTWithdrawVoteproof) MarshalJSON() ([]byte, error)
- func (vp ACCEPTWithdrawVoteproof) Point() base.StagePoint
- func (vp ACCEPTWithdrawVoteproof) Result() base.VoteResult
- func (vp *ACCEPTWithdrawVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
- func (vp *ACCEPTWithdrawVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
- func (vp *ACCEPTWithdrawVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
- func (vp *ACCEPTWithdrawVoteproof) SetThreshold(s base.Threshold) *baseVoteproof
- func (vp *ACCEPTWithdrawVoteproof) SetWithdraws(withdraws []base.SuffrageWithdrawOperation) *baseWithdrawVoteproof
- func (vp ACCEPTWithdrawVoteproof) SignFacts() []base.BallotSignFact
- func (vp ACCEPTWithdrawVoteproof) Threshold() base.Threshold
- func (vp ACCEPTWithdrawVoteproof) Withdraws() []base.SuffrageWithdrawOperation
- type BallotPool
- type BaseDatabase
- type BaseProposalSelector
- type BlockBasedProposerSelector
- type BlockImporter
- type BlockReader
- type BlockWriteDatabase
- type BlockWriter
- type Database
- type DefaultProposalProcessor
- func (p *DefaultProposalProcessor) Cancel() error
- func (p *DefaultProposalProcessor) Process(ctx context.Context, ivp base.INITVoteproof) (base.Manifest, error)
- func (p *DefaultProposalProcessor) Proposal() base.ProposalSignFact
- func (p *DefaultProposalProcessor) Save(ctx context.Context, avp base.ACCEPTVoteproof) error
- type FixedSuffrageCandidateLimiterRule
- func (l FixedSuffrageCandidateLimiterRule) HashBytes() []byte
- func (l FixedSuffrageCandidateLimiterRule) IsValid([]byte) error
- func (l FixedSuffrageCandidateLimiterRule) Limit() uint64
- func (l FixedSuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)
- func (l *FixedSuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error
- type FuncProposerSelector
- type GetLastSuffrageCandidateStateRemoteFunc
- type GetLastSuffrageProofFromRemoteFunc
- type GetSuffrageByBlockHeight
- type GetSuffrageProofFromRemoteFunc
- type INITBallot
- func (bl INITBallot) BallotSignFact() base.INITBallotSignFact
- func (bl *INITBallot) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (bl INITBallot) HashBytes() []byte
- func (bl INITBallot) IsValid(networkID []byte) error
- func (bl INITBallot) MarshalJSON() ([]byte, error)
- func (bl INITBallot) Point() base.StagePoint
- func (bl INITBallot) SignFact() base.BallotSignFact
- func (bl INITBallot) Voteproof() base.Voteproof
- func (bl INITBallot) Withdraws() []base.SuffrageWithdrawOperation
- type INITBallotFact
- func (fact *INITBallotFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (fact INITBallotFact) IsValid([]byte) error
- func (fact INITBallotFact) MarshalJSON() ([]byte, error)
- func (fact INITBallotFact) Point() base.StagePoint
- func (fact INITBallotFact) PreviousBlock() util.Hash
- func (fact INITBallotFact) Proposal() util.Hash
- func (fact INITBallotFact) Stage() base.Stage
- func (fact INITBallotFact) WithdrawFacts() []util.Hash
- type INITBallotFactJSONMarshaler
- type INITBallotFactJSONUnmarshaler
- type INITBallotSignFact
- func (sf INITBallotSignFact) BallotFact() base.INITBallotFact
- func (sf *INITBallotSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (sf INITBallotSignFact) Fact() base.Fact
- func (sf INITBallotSignFact) HashBytes() []byte
- func (sf INITBallotSignFact) IsValid(networkID []byte) error
- func (sf INITBallotSignFact) MarshalJSON() ([]byte, error)
- func (sf INITBallotSignFact) Node() base.Address
- func (sf *INITBallotSignFact) NodeSign(priv base.Privatekey, networkID base.NetworkID, node base.Address) error
- func (sf INITBallotSignFact) NodeSigns() []base.NodeSign
- func (sf INITBallotSignFact) Signer() base.Publickey
- func (sf INITBallotSignFact) Signs() []base.Sign
- type INITStuckVoteproof
- func (vp *INITStuckVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp *INITStuckVoteproof) Finish() *INITStuckVoteproof
- func (vp INITStuckVoteproof) FinishedAt() time.Time
- func (vp INITStuckVoteproof) HashBytes() []byte
- func (vp INITStuckVoteproof) ID() string
- func (INITStuckVoteproof) IsStuckVoteproof() bool
- func (vp INITStuckVoteproof) IsValid(networkID []byte) error
- func (vp INITStuckVoteproof) Majority() base.BallotFact
- func (vp INITStuckVoteproof) MarshalJSON() ([]byte, error)
- func (vp INITStuckVoteproof) Point() base.StagePoint
- func (vp INITStuckVoteproof) Result() base.VoteResult
- func (vp *INITStuckVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
- func (vp *INITStuckVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
- func (vp *INITStuckVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
- func (vp *INITStuckVoteproof) SetThreshold(s base.Threshold) *baseVoteproof
- func (vp INITStuckVoteproof) SignFacts() []base.BallotSignFact
- func (vp INITStuckVoteproof) Threshold() base.Threshold
- type INITVoteproof
- func (vp INITVoteproof) BallotMajority() base.INITBallotFact
- func (vp INITVoteproof) BallotSignFacts() []base.INITBallotSignFact
- func (vp *INITVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp *INITVoteproof) Finish() baseVoteproof
- func (vp INITVoteproof) FinishedAt() time.Time
- func (vp INITVoteproof) HashBytes() []byte
- func (vp INITVoteproof) ID() string
- func (vp INITVoteproof) IsValid(networkID []byte) error
- func (vp INITVoteproof) Majority() base.BallotFact
- func (vp INITVoteproof) MarshalJSON() ([]byte, error)
- func (vp INITVoteproof) Point() base.StagePoint
- func (vp INITVoteproof) Result() base.VoteResult
- func (vp *INITVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
- func (vp *INITVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
- func (vp *INITVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
- func (vp *INITVoteproof) SetThreshold(s base.Threshold) *baseVoteproof
- func (vp INITVoteproof) SignFacts() []base.BallotSignFact
- func (vp INITVoteproof) Threshold() base.Threshold
- type INITWithdrawVoteproof
- func (vp *INITWithdrawVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (vp *INITWithdrawVoteproof) Finish() baseVoteproof
- func (vp INITWithdrawVoteproof) FinishedAt() time.Time
- func (vp INITWithdrawVoteproof) HashBytes() []byte
- func (vp INITWithdrawVoteproof) ID() string
- func (vp INITWithdrawVoteproof) IsValid(networkID []byte) error
- func (INITWithdrawVoteproof) IsWithdrawVoteproof() bool
- func (vp INITWithdrawVoteproof) Majority() base.BallotFact
- func (vp INITWithdrawVoteproof) MarshalJSON() ([]byte, error)
- func (vp INITWithdrawVoteproof) Point() base.StagePoint
- func (vp INITWithdrawVoteproof) Result() base.VoteResult
- func (vp *INITWithdrawVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
- func (vp *INITWithdrawVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
- func (vp *INITWithdrawVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
- func (vp *INITWithdrawVoteproof) SetThreshold(s base.Threshold) *baseVoteproof
- func (vp *INITWithdrawVoteproof) SetWithdraws(withdraws []base.SuffrageWithdrawOperation) *baseWithdrawVoteproof
- func (vp INITWithdrawVoteproof) SignFacts() []base.BallotSignFact
- func (vp INITWithdrawVoteproof) Threshold() base.Threshold
- func (vp INITWithdrawVoteproof) Withdraws() []base.SuffrageWithdrawOperation
- type LastConsensusNodesWatcher
- func (u *LastConsensusNodesWatcher) Exists(node base.Node) (base.Suffrage, bool, error)
- func (u *LastConsensusNodesWatcher) GetSuffrage(height base.Height) (base.Suffrage, bool, error)
- func (u *LastConsensusNodesWatcher) Last() (base.SuffrageProof, base.State, error)
- func (u *LastConsensusNodesWatcher) SetWhenUpdated(...)
- type LocalNode
- type LocalParams
- func (p *LocalParams) BallotStuckResolveAfter() time.Duration
- func (p *LocalParams) BallotStuckWait() time.Duration
- func (p *LocalParams) ID() string
- func (p *LocalParams) IntervalBroadcastBallot() time.Duration
- func (p *LocalParams) IsValid(networkID []byte) error
- func (p *LocalParams) MarshalJSON() ([]byte, error)
- func (p *LocalParams) MaxMessageSize() uint64
- func (p *LocalParams) NetworkID() base.NetworkID
- func (p *LocalParams) SameMemberLimit() uint64
- func (p *LocalParams) SetBallotStuckResolveAfter(d time.Duration) *LocalParams
- func (p *LocalParams) SetBallotStuckWait(d time.Duration) *LocalParams
- func (p *LocalParams) SetIntervalBroadcastBallot(d time.Duration) *LocalParams
- func (p *LocalParams) SetMaxMessageSize(s uint64) *LocalParams
- func (p *LocalParams) SetNetworkID(n base.NetworkID) *LocalParams
- func (p *LocalParams) SetSameMemberLimit(s uint64) *LocalParams
- func (p *LocalParams) SetSyncSourceCheckerInterval(d time.Duration) *LocalParams
- func (p *LocalParams) SetThreshold(t base.Threshold) *LocalParams
- func (p *LocalParams) SetTimeoutRequestProposal(d time.Duration) *LocalParams
- func (p *LocalParams) SetValidProposalOperationExpire(d time.Duration) *LocalParams
- func (p *LocalParams) SetValidProposalSuffrageOperationsExpire(d time.Duration) *LocalParams
- func (p *LocalParams) SetWaitPreparingINITBallot(d time.Duration) *LocalParams
- func (p *LocalParams) SetWaitPreparingNextRoundINITBallot(d time.Duration) *LocalParams
- func (p *LocalParams) SyncSourceCheckerInterval() time.Duration
- func (p *LocalParams) Threshold() base.Threshold
- func (p *LocalParams) TimeoutRequestProposal() time.Duration
- func (p *LocalParams) UnmarshalJSON(b []byte) error
- func (p *LocalParams) ValidProposalOperationExpire() time.Duration
- func (p *LocalParams) ValidProposalSuffrageOperationsExpire() time.Duration
- func (p *LocalParams) WaitPreparingINITBallot() time.Duration
- func (p *LocalParams) WaitPreparingNextRoundINITBallot() time.Duration
- type MajoritySuffrageCandidateLimiterRule
- func (l MajoritySuffrageCandidateLimiterRule) HashBytes() []byte
- func (l MajoritySuffrageCandidateLimiterRule) IsValid([]byte) error
- func (l MajoritySuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)
- func (l MajoritySuffrageCandidateLimiterRule) Max() uint64
- func (l MajoritySuffrageCandidateLimiterRule) Min() uint64
- func (l MajoritySuffrageCandidateLimiterRule) Ratio() float64
- func (l *MajoritySuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error
- type Manifest
- func (m Manifest) Hash() util.Hash
- func (m Manifest) Height() base.Height
- func (m Manifest) IsValid([]byte) error
- func (m Manifest) MarshalJSON() ([]byte, error)
- func (m Manifest) OperationsTree() util.Hash
- func (m Manifest) Previous() util.Hash
- func (m Manifest) Proposal() util.Hash
- func (m Manifest) ProposedAt() time.Time
- func (m Manifest) StatesTree() util.Hash
- func (m Manifest) Suffrage() util.Hash
- func (m *Manifest) UnmarshalJSON(b []byte) error
- type ManifestJSONMarshaler
- type ManifestJSONUnmarshaler
- type NetworkClient
- type NetworkHeader
- type NetworkPolicy
- func (p *NetworkPolicy) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (p NetworkPolicy) HashBytes() []byte
- func (p NetworkPolicy) IsValid([]byte) error
- func (p NetworkPolicy) MarshalJSON() ([]byte, error)
- func (p NetworkPolicy) MaxOperationsInProposal() uint64
- func (p NetworkPolicy) MaxSuffrageSize() uint64
- func (p NetworkPolicy) SuffrageCandidateLifespan() base.Height
- func (p NetworkPolicy) SuffrageCandidateLimiterRule() base.SuffrageCandidateLimiterRule
- func (p NetworkPolicy) SuffrageWithdrawLifespan() base.Height
- type NetworkPolicyStateValue
- func (s *NetworkPolicyStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (s NetworkPolicyStateValue) HashBytes() []byte
- func (s NetworkPolicyStateValue) IsValid([]byte) error
- func (s NetworkPolicyStateValue) MarshalJSON() ([]byte, error)
- func (s NetworkPolicyStateValue) Policy() base.NetworkPolicy
- type NetworkPolicyStateValueJSONMarshaler
- type NetworkPolicyStateValueJSONUnmarshaler
- type NetworkResponseContentType
- type NetworkResponseHeader
- type NewBlockWriterFunc
- type NewOperationPool
- type NewOperationProcessorFunction
- type NodeConnInfo
- type NodeInConsensusNodesFunc
- type OperationProcessHandler
- type OperationProcessorGetOperationFunction
- type PermanentDatabase
- type PoolOperationRecordMeta
- type ProcessorProcessFunc
- type ProposalFact
- func (fact *ProposalFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (fact ProposalFact) IsValid([]byte) error
- func (fact ProposalFact) MarshalJSON() ([]byte, error)
- func (fact ProposalFact) Operations() []util.Hash
- func (fact ProposalFact) Point() base.Point
- func (fact ProposalFact) ProposedAt() time.Time
- func (fact ProposalFact) Proposer() base.Address
- type ProposalMaker
- type ProposalPool
- type ProposalProcessor
- type ProposalProcessors
- func (pps *ProposalProcessors) Cancel() error
- func (pps *ProposalProcessors) Process(ctx context.Context, facthash util.Hash, previous base.Manifest, ...) (ProcessorProcessFunc, error)
- func (pps *ProposalProcessors) Processor() ProposalProcessor
- func (pps *ProposalProcessors) Save(ctx context.Context, facthash util.Hash, avp base.ACCEPTVoteproof) error
- func (pps *ProposalProcessors) SetRetryInterval(i time.Duration) *ProposalProcessors
- func (pps *ProposalProcessors) SetRetryLimit(l int) *ProposalProcessors
- type ProposalSelector
- type ProposalSignFact
- func (sf *ProposalSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (sf ProposalSignFact) Fact() base.Fact
- func (sf ProposalSignFact) HashBytes() []byte
- func (sf ProposalSignFact) IsValid(networkID []byte) error
- func (sf ProposalSignFact) MarshalJSON() ([]byte, error)
- func (sf ProposalSignFact) Point() base.Point
- func (sf ProposalSignFact) ProposalFact() base.ProposalFact
- func (sf *ProposalSignFact) Sign(priv base.Privatekey, networkID base.NetworkID) error
- func (sf ProposalSignFact) Signs() []base.Sign
- type ProposerSelector
- type ReasonProcessedOperation
- type Suffrage
- type SuffrageCandidateJSONMarshaler
- type SuffrageCandidateJSONUnmarshaler
- type SuffrageCandidateStateValue
- func (suf SuffrageCandidateStateValue) Deadline() base.Height
- func (suf *SuffrageCandidateStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (suf SuffrageCandidateStateValue) HashBytes() []byte
- func (suf SuffrageCandidateStateValue) IsValid([]byte) error
- func (suf SuffrageCandidateStateValue) MarshalJSON() ([]byte, error)
- func (suf SuffrageCandidateStateValue) Start() base.Height
- type SuffrageCandidatesStateValue
- func (s *SuffrageCandidatesStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (s SuffrageCandidatesStateValue) HashBytes() []byte
- func (s SuffrageCandidatesStateValue) IsValid([]byte) error
- func (s SuffrageCandidatesStateValue) MarshalJSON() ([]byte, error)
- func (s SuffrageCandidatesStateValue) Nodes() []base.SuffrageCandidateStateValue
- type SuffrageConfirmBallotFact
- type SuffrageNodeStateValue
- func (s *SuffrageNodeStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (s SuffrageNodeStateValue) HashBytes() []byte
- func (s SuffrageNodeStateValue) Hint() hint.Hint
- func (s SuffrageNodeStateValue) IsValid([]byte) error
- func (s SuffrageNodeStateValue) MarshalJSON() ([]byte, error)
- func (s SuffrageNodeStateValue) Start() base.Height
- type SuffrageNodesStateValue
- func (s *SuffrageNodesStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (s SuffrageNodesStateValue) HashBytes() []byte
- func (s SuffrageNodesStateValue) Height() base.Height
- func (s SuffrageNodesStateValue) IsValid([]byte) error
- func (s SuffrageNodesStateValue) MarshalJSON() ([]byte, error)
- func (s SuffrageNodesStateValue) Nodes() []base.SuffrageNodeStateValue
- func (s SuffrageNodesStateValue) Suffrage() (base.Suffrage, error)
- type SuffrageStateBuilder
- type SuffrageVoteFunc
- type SuffrageVoting
- type SuffrageWithdrawFact
- func (fact *SuffrageWithdrawFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
- func (fact SuffrageWithdrawFact) IsValid([]byte) error
- func (fact SuffrageWithdrawFact) MarshalJSON() ([]byte, error)
- func (fact SuffrageWithdrawFact) Node() base.Address
- func (fact SuffrageWithdrawFact) Reason() string
- func (fact SuffrageWithdrawFact) WithdrawEnd() base.Height
- func (fact SuffrageWithdrawFact) WithdrawStart() base.Height
- type SuffrageWithdrawOperation
- type SuffrageWithdrawPool
- type SyncSourcePool
- func (p *SyncSourcePool) Actives(f func(NodeConnInfo) bool)
- func (p *SyncSourcePool) AddNonFixed(ncis ...NodeConnInfo) bool
- func (p *SyncSourcePool) IsInFixed(node base.Address) bool
- func (p *SyncSourcePool) IsInNonFixed(node base.Address) bool
- func (p *SyncSourcePool) Len() int
- func (p *SyncSourcePool) NodeConnInfo(node base.Address) []NodeConnInfo
- func (p *SyncSourcePool) NodeExists(node base.Address) bool
- func (p *SyncSourcePool) Pick() (NodeConnInfo, func(error), error)
- func (p *SyncSourcePool) PickMultiple(n int) ([]NodeConnInfo, []func(error), error)
- func (p *SyncSourcePool) RemoveNonFixed(nci NodeConnInfo) bool
- func (p *SyncSourcePool) RemoveNonFixedNode(nodes ...base.Address) bool
- func (p *SyncSourcePool) Retry(ctx context.Context, f func(NodeConnInfo) (bool, error), limit int, ...) error
- func (p *SyncSourcePool) Traverse(f func(NodeConnInfo) bool)
- func (p *SyncSourcePool) UpdateFixed(fixed []NodeConnInfo) bool
- type Syncer
- type TempDatabase
- type TempSyncPool
- type WithdrawBallotFact
Constants ¶
This section is empty.
Variables ¶
var ( INITBallotHint = hint.MustNewHint("init-ballot-v0.0.1") ACCEPTBallotHint = hint.MustNewHint("accept-ballot-v0.0.1") )
var ( INITBallotFactHint = hint.MustNewHint("init-ballot-fact-v0.0.1") ACCEPTBallotFactHint = hint.MustNewHint("accept-ballot-fact-v0.0.1") SuffrageConfirmBallotFactHint = hint.MustNewHint("suffrage-confirm-ballot-fact-v0.0.1") )
var ( INITBallotSignFactHint = hint.MustNewHint("init-ballot-sign-fact-v0.0.1") ACCEPTBallotSignFactHint = hint.MustNewHint("accept-ballot-sign-fact-v0.0.1") )
var ( NetworkPolicyHint = hint.MustNewHint("network-policy-v0.0.1") NetworkPolicyStateValueHint = hint.MustNewHint("network-policy-state-value-v0.0.1") DefaultMaxOperationsInProposal uint64 = 333 DefaultMaxSuffrageSize uint64 = 33 // NOTE suffrage candidate can be approved within lifespan height; almost 15 // days(based on 5 second for one block) DefaultSuffrageCandidateLifespan base.Height = 1 << 18 DefaultSuffrageWithdrawLifespan = base.Height(333) //nolint:gomnd //... )
var ( ProposalFactHint = hint.MustNewHint("proposal-fact-v0.0.1") ProposalSignFactHint = hint.MustNewHint("proposal-sign-fact-v0.0.1") )
var ( ErrOperationInProcessorNotFound = util.NewError("operation processor not found") ErrInvalidOperationInProcessor = util.NewError("invalid operation") ErrOperationNotFoundInProcessor = util.NewError("operation not found") ErrOperationAlreadyProcessedInProcessor = util.NewError("operation already processed") ErrStopProcessingRetry = util.NewError("stop processing retrying") ErrIgnoreStateValue = util.NewError("ignore state value") ErrSuspendOperation = util.NewError("suspend operation") ErrProcessorAlreadySaved = util.NewError("processor already saved") )
var ( ErrIgnoreErrorProposalProcessor = util.NewError("proposal processor somthing wrong; ignore") ErrNotProposalProcessorProcessed = util.NewError("proposal processor not processed") )
ErrIgnoreErrorProposalProcessor ignores error from proposalProcessor, it means not ErrIgnoreErrorProposalProcessor from proposalProcessor will break consensus.
var ( FixedSuffrageCandidateLimiterRuleHint = hint.MustNewHint("fixed-suffrage-candidate-limiter-rule-v0.0.1") MajoritySuffrageCandidateLimiterRuleHint = hint.MustNewHint("majority-suffrage-candidate-limiter-rule-v0.0.1") )
var ( SuffrageWithdrawFactHint = hint.MustNewHint("suffrage-withdraw-fact-v0.0.1") SuffrageWithdrawOperationHint = hint.MustNewHint("suffrage-withdraw-operation-v0.0.1") )
var ( SuffrageNodeStateValueHint = hint.MustNewHint("suffrage-node-state-value-v0.0.1") SuffrageNodesStateValueHint = hint.MustNewHint("suffrage-nodes-state-value-v0.0.1") SuffrageCandidateStateValueHint = hint.MustNewHint("suffrage-candidate-state-value-v0.0.1") SuffrageCandidatesStateValueHint = hint.MustNewHint("suffrage-candidates-state-value-v0.0.1") )
var ( SuffrageStateKey = "suffrage" SuffrageCandidateStateKey = "suffrage_candidate" NetworkPolicyStateKey = "network_policy" )
var ( ErrEmptySyncSources = util.NewError("empty sync sources; will retry") ErrRetrySyncSources = util.NewError("sync sources problem; will retry") )
var ( INITVoteproofHint = hint.MustNewHint("init-voteproof-v0.0.1") INITWithdrawVoteproofHint = hint.MustNewHint("init-withdraw-voteproof-v0.0.1") INITStuckVoteproofHint = hint.MustNewHint("init-stuck-voteproof-v0.0.1") ACCEPTVoteproofHint = hint.MustNewHint("accept-voteproof-v0.0.1") ACCEPTWithdrawVoteproofHint = hint.MustNewHint("accept-withdraw-voteproof-v0.0.1") ACCEPTStuckVoteproofHint = hint.MustNewHint("accept-stuck-voteproof-v0.0.1") )
var (
ErrEmptyAvailableNodes = util.NewError("empty available nodes for new proposal")
)
var LocalParamsHint = hint.MustNewHint("local-params-v0.0.1")
var ManifestHint = hint.MustNewHint("manifest-v0.0.1")
var NodeHint = hint.MustNewHint("node-v0.0.1")
Functions ¶
func FilterCandidates ¶
func FilterCandidates( height base.Height, candidates []base.SuffrageCandidateStateValue, ) []base.SuffrageCandidateStateValue
func GetSuffrageFromDatabase ¶
func InCandidates ¶
func InCandidates(node base.Node, candidates []base.SuffrageCandidateStateValue) bool
func IsValidWithdrawWithSuffrageLifespan ¶
func IsValidWithdrawWithSuffrageLifespan( height base.Height, withdraw base.SuffrageWithdrawOperation, suf base.Suffrage, lifespan base.Height, ) error
IsValidWithdrawWithSuffrageLifespan checks withdraw operation itself with suffrage and lifespan.
func LastCandidatesFromState ¶
func LastCandidatesFromState( height base.Height, getStateFunc base.GetStateFunc, ) (base.Height, []base.SuffrageCandidateStateValue, error)
func NewCandidatesOfMajoritySuffrageCandidateLimiterRule ¶
func NewCandidatesOfMajoritySuffrageCandidateLimiterRule( ratio float64, getSuffrage func() (uint64, error), ) (uint64, error)
NewCandidatesOfMajoritySuffrageCandidateLimiterRule find the number of new candidates to prevent the current suffrage majority.
func NewFixedSuffrageCandidateLimiter ¶
func NewFixedSuffrageCandidateLimiter(rule FixedSuffrageCandidateLimiterRule) base.SuffrageCandidateLimiter
func NewMajoritySuffrageCandidateLimiter ¶
func NewMajoritySuffrageCandidateLimiter( rule MajoritySuffrageCandidateLimiterRule, getSuffrage func() (uint64, error), ) base.SuffrageCandidateLimiter
Types ¶
type ACCEPTBallot ¶
type ACCEPTBallot struct {
// contains filtered or unexported fields
}
func NewACCEPTBallot ¶
func NewACCEPTBallot( ivp base.INITVoteproof, signfact ACCEPTBallotSignFact, withdraws []base.SuffrageWithdrawOperation, ) ACCEPTBallot
func (ACCEPTBallot) BallotSignFact ¶
func (bl ACCEPTBallot) BallotSignFact() base.ACCEPTBallotSignFact
func (*ACCEPTBallot) DecodeJSON ¶
func (ACCEPTBallot) IsValid ¶
func (bl ACCEPTBallot) IsValid(networkID []byte) error
func (ACCEPTBallot) MarshalJSON ¶
func (ACCEPTBallot) Point ¶
func (bl ACCEPTBallot) Point() base.StagePoint
func (ACCEPTBallot) SignFact ¶
func (bl ACCEPTBallot) SignFact() base.BallotSignFact
func (ACCEPTBallot) Withdraws ¶
func (bl ACCEPTBallot) Withdraws() []base.SuffrageWithdrawOperation
type ACCEPTBallotFact ¶
type ACCEPTBallotFact struct {
// contains filtered or unexported fields
}
func NewACCEPTBallotFact ¶
func (*ACCEPTBallotFact) DecodeJSON ¶
func (fact *ACCEPTBallotFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (ACCEPTBallotFact) IsValid ¶
func (fact ACCEPTBallotFact) IsValid([]byte) error
func (ACCEPTBallotFact) MarshalJSON ¶
func (fact ACCEPTBallotFact) MarshalJSON() ([]byte, error)
func (ACCEPTBallotFact) NewBlock ¶
func (fact ACCEPTBallotFact) NewBlock() util.Hash
func (ACCEPTBallotFact) Point ¶
func (fact ACCEPTBallotFact) Point() base.StagePoint
func (ACCEPTBallotFact) Proposal ¶
func (fact ACCEPTBallotFact) Proposal() util.Hash
func (ACCEPTBallotFact) WithdrawFacts ¶
type ACCEPTBallotFactJSONUnmarshaler ¶
type ACCEPTBallotFactJSONUnmarshaler struct { Proposal valuehash.HashDecoder `json:"proposal"` NewBlock valuehash.HashDecoder `json:"new_block"` // contains filtered or unexported fields }
type ACCEPTBallotSignFact ¶
type ACCEPTBallotSignFact struct {
// contains filtered or unexported fields
}
func NewACCEPTBallotSignFact ¶
func NewACCEPTBallotSignFact(fact ACCEPTBallotFact) ACCEPTBallotSignFact
func (ACCEPTBallotSignFact) BallotFact ¶
func (sf ACCEPTBallotSignFact) BallotFact() base.ACCEPTBallotFact
func (*ACCEPTBallotSignFact) DecodeJSON ¶
func (ACCEPTBallotSignFact) IsValid ¶
func (sf ACCEPTBallotSignFact) IsValid(networkID []byte) error
func (ACCEPTBallotSignFact) MarshalJSON ¶
type ACCEPTStuckVoteproof ¶
type ACCEPTStuckVoteproof struct { ACCEPTVoteproof // contains filtered or unexported fields }
func NewACCEPTStuckVoteproof ¶
func NewACCEPTStuckVoteproof(point base.Point) ACCEPTStuckVoteproof
func (*ACCEPTStuckVoteproof) DecodeJSON ¶
func (vp *ACCEPTStuckVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (*ACCEPTStuckVoteproof) Finish ¶
func (vp *ACCEPTStuckVoteproof) Finish() *ACCEPTStuckVoteproof
func (ACCEPTStuckVoteproof) FinishedAt ¶
func (ACCEPTStuckVoteproof) IsStuckVoteproof ¶
func (ACCEPTStuckVoteproof) IsStuckVoteproof() bool
func (ACCEPTStuckVoteproof) IsValid ¶
func (vp ACCEPTStuckVoteproof) IsValid(networkID []byte) error
func (ACCEPTStuckVoteproof) Majority ¶
func (vp ACCEPTStuckVoteproof) Majority() base.BallotFact
func (ACCEPTStuckVoteproof) MarshalJSON ¶
func (vp ACCEPTStuckVoteproof) MarshalJSON() ([]byte, error)
func (ACCEPTStuckVoteproof) Point ¶
func (vp ACCEPTStuckVoteproof) Point() base.StagePoint
func (ACCEPTStuckVoteproof) Result ¶
func (vp ACCEPTStuckVoteproof) Result() base.VoteResult
func (*ACCEPTStuckVoteproof) SetMajority ¶
func (vp *ACCEPTStuckVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
func (*ACCEPTStuckVoteproof) SetPoint ¶
func (vp *ACCEPTStuckVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
func (*ACCEPTStuckVoteproof) SetSignFacts ¶
func (vp *ACCEPTStuckVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
func (*ACCEPTStuckVoteproof) SetThreshold ¶
func (ACCEPTStuckVoteproof) SignFacts ¶
func (vp ACCEPTStuckVoteproof) SignFacts() []base.BallotSignFact
type ACCEPTVoteproof ¶
type ACCEPTVoteproof struct {
// contains filtered or unexported fields
}
func NewACCEPTVoteproof ¶
func NewACCEPTVoteproof(point base.Point) ACCEPTVoteproof
func (ACCEPTVoteproof) BallotMajority ¶
func (vp ACCEPTVoteproof) BallotMajority() base.ACCEPTBallotFact
func (ACCEPTVoteproof) BallotSignFacts ¶
func (vp ACCEPTVoteproof) BallotSignFacts() []base.ACCEPTBallotSignFact
func (*ACCEPTVoteproof) DecodeJSON ¶
func (ACCEPTVoteproof) FinishedAt ¶
func (ACCEPTVoteproof) IsValid ¶
func (vp ACCEPTVoteproof) IsValid(networkID []byte) error
func (ACCEPTVoteproof) Majority ¶
func (vp ACCEPTVoteproof) Majority() base.BallotFact
func (ACCEPTVoteproof) MarshalJSON ¶
func (ACCEPTVoteproof) Point ¶
func (vp ACCEPTVoteproof) Point() base.StagePoint
func (ACCEPTVoteproof) Result ¶
func (vp ACCEPTVoteproof) Result() base.VoteResult
func (*ACCEPTVoteproof) SetMajority ¶
func (vp *ACCEPTVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
func (*ACCEPTVoteproof) SetPoint ¶
func (vp *ACCEPTVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
func (*ACCEPTVoteproof) SetSignFacts ¶
func (vp *ACCEPTVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
func (*ACCEPTVoteproof) SetThreshold ¶
func (ACCEPTVoteproof) SignFacts ¶
func (vp ACCEPTVoteproof) SignFacts() []base.BallotSignFact
type ACCEPTWithdrawVoteproof ¶
type ACCEPTWithdrawVoteproof struct { ACCEPTVoteproof // contains filtered or unexported fields }
func NewACCEPTWithdrawVoteproof ¶
func NewACCEPTWithdrawVoteproof(point base.Point) ACCEPTWithdrawVoteproof
func (*ACCEPTWithdrawVoteproof) DecodeJSON ¶
func (vp *ACCEPTWithdrawVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (ACCEPTWithdrawVoteproof) FinishedAt ¶
func (ACCEPTWithdrawVoteproof) HashBytes ¶
func (vp ACCEPTWithdrawVoteproof) HashBytes() []byte
func (ACCEPTWithdrawVoteproof) IsValid ¶
func (vp ACCEPTWithdrawVoteproof) IsValid(networkID []byte) error
func (ACCEPTWithdrawVoteproof) IsWithdrawVoteproof ¶
func (ACCEPTWithdrawVoteproof) IsWithdrawVoteproof() bool
func (ACCEPTWithdrawVoteproof) Majority ¶
func (vp ACCEPTWithdrawVoteproof) Majority() base.BallotFact
func (ACCEPTWithdrawVoteproof) MarshalJSON ¶
func (vp ACCEPTWithdrawVoteproof) MarshalJSON() ([]byte, error)
func (ACCEPTWithdrawVoteproof) Point ¶
func (vp ACCEPTWithdrawVoteproof) Point() base.StagePoint
func (ACCEPTWithdrawVoteproof) Result ¶
func (vp ACCEPTWithdrawVoteproof) Result() base.VoteResult
func (*ACCEPTWithdrawVoteproof) SetMajority ¶
func (vp *ACCEPTWithdrawVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
func (*ACCEPTWithdrawVoteproof) SetPoint ¶
func (vp *ACCEPTWithdrawVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
func (*ACCEPTWithdrawVoteproof) SetSignFacts ¶
func (vp *ACCEPTWithdrawVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
func (*ACCEPTWithdrawVoteproof) SetThreshold ¶
func (*ACCEPTWithdrawVoteproof) SetWithdraws ¶
func (vp *ACCEPTWithdrawVoteproof) SetWithdraws(withdraws []base.SuffrageWithdrawOperation) *baseWithdrawVoteproof
func (ACCEPTWithdrawVoteproof) SignFacts ¶
func (vp ACCEPTWithdrawVoteproof) SignFacts() []base.BallotSignFact
func (ACCEPTWithdrawVoteproof) Withdraws ¶
func (vp ACCEPTWithdrawVoteproof) Withdraws() []base.SuffrageWithdrawOperation
type BallotPool ¶
type BallotPool interface { Ballot(_ base.Point, _ base.Stage, isSuffrageConfirm bool) (base.Ballot, bool, error) SetBallot(base.Ballot) (bool, error) }
BallotPool stores latest ballots of local
type BaseDatabase ¶
type BaseProposalSelector ¶
func NewBaseProposalSelector ¶
func NewBaseProposalSelector( local base.LocalNode, params *LocalParams, proposerSelector ProposerSelector, maker *ProposalMaker, getAvailableNodes func(base.Height) ([]base.Node, bool, error), request func(context.Context, base.Point, base.Address) (base.ProposalSignFact, error), pool ProposalPool, ) *BaseProposalSelector
func (*BaseProposalSelector) Select ¶
func (p *BaseProposalSelector) Select(ctx context.Context, point base.Point) (base.ProposalSignFact, error)
type BlockBasedProposerSelector ¶
type BlockBasedProposerSelector struct {
// contains filtered or unexported fields
}
type BlockImporter ¶
type BlockReader ¶
type BlockReader interface { BlockMap() (base.BlockMap, bool, error) Reader(base.BlockMapItemType) (io.ReadCloser, bool, error) ChecksumReader(base.BlockMapItemType) (util.ChecksumReader, bool, error) Item(base.BlockMapItemType) (interface{}, bool, error) Items(func(base.BlockMapItem, interface{}, bool, error) bool) error }
type BlockWriteDatabase ¶
type BlockWriteDatabase interface { Close() error Cancel() error BlockMap() (base.BlockMap, error) SetBlockMap(base.BlockMap) error SetStates(sts []base.State) error SetOperations(ops []util.Hash) error // NOTE operation hash, not operation fact hash SetSuffrageProof(base.SuffrageProof) error SuffrageState() base.State NetworkPolicy() base.NetworkPolicy Write() error TempDatabase() (TempDatabase, error) }
type BlockWriter ¶
type BlockWriter interface { SetOperationsSize(uint64) SetProcessResult( _ context.Context, index uint64, ophash, facthash util.Hash, instate bool, errorreason base.OperationProcessReasonError, ) error SetStates(_ context.Context, index uint64, values []base.StateMergeValue, operation base.Operation) error Manifest(_ context.Context, previous base.Manifest) (base.Manifest, error) SetINITVoteproof(context.Context, base.INITVoteproof) error SetACCEPTVoteproof(context.Context, base.ACCEPTVoteproof) error Save(context.Context) (base.BlockMap, error) Cancel() error }
type Database ¶
type Database interface { util.Daemon Close() error BlockMap(height base.Height) (base.BlockMap, bool, error) BlockMapBytes(base.Height) (hint.Hint, []byte, []byte, bool, error) LastBlockMap() (base.BlockMap, bool, error) LastBlockMapBytes() (hint.Hint, []byte, []byte, bool, error) LastSuffrageProof() (base.SuffrageProof, bool, error) LastSuffrageProofBytes() (hint.Hint, []byte, []byte, bool, base.Height, error) SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error) SuffrageProofBytes(suffrageHeight base.Height) (hint.Hint, []byte, []byte, bool, error) SuffrageProofByBlockHeight(blockheight base.Height) (base.SuffrageProof, bool, error) LastNetworkPolicy() base.NetworkPolicy State(key string) (base.State, bool, error) StateBytes(key string) (hint.Hint, []byte, []byte, bool, error) // NOTE ExistsInStateOperation has only operation facts, which is in state ExistsInStateOperation(operationFactHash util.Hash) (bool, error) // NOTE ExistsKnownOperation has the known operation hashes ExistsKnownOperation(operationHash util.Hash) (bool, error) NewBlockWriteDatabase(height base.Height) (BlockWriteDatabase, error) MergeBlockWriteDatabase(BlockWriteDatabase) error MergeAllPermanent() error RemoveBlocks(base.Height) (bool, error) }
Database serves BlockMapItem like blockmap, states and operations from TempDatabases and PermanentDatabase. It has several TempDatabases and one PermanentDatabase.
type DefaultProposalProcessor ¶
func NewDefaultProposalProcessor ¶
func NewDefaultProposalProcessor( proposal base.ProposalSignFact, previous base.Manifest, newWriter NewBlockWriterFunc, getStatef base.GetStateFunc, getOperationf OperationProcessorGetOperationFunction, newOperationProcessor NewOperationProcessorFunction, ) (*DefaultProposalProcessor, error)
func (*DefaultProposalProcessor) Cancel ¶
func (p *DefaultProposalProcessor) Cancel() error
func (*DefaultProposalProcessor) Process ¶
func (p *DefaultProposalProcessor) Process(ctx context.Context, ivp base.INITVoteproof) (base.Manifest, error)
func (*DefaultProposalProcessor) Proposal ¶
func (p *DefaultProposalProcessor) Proposal() base.ProposalSignFact
func (*DefaultProposalProcessor) Save ¶
func (p *DefaultProposalProcessor) Save(ctx context.Context, avp base.ACCEPTVoteproof) error
type FixedSuffrageCandidateLimiterRule ¶
type FixedSuffrageCandidateLimiterRule struct { hint.BaseHinter // contains filtered or unexported fields }
func NewFixedSuffrageCandidateLimiterRule ¶
func NewFixedSuffrageCandidateLimiterRule(limit uint64) FixedSuffrageCandidateLimiterRule
func (FixedSuffrageCandidateLimiterRule) HashBytes ¶
func (l FixedSuffrageCandidateLimiterRule) HashBytes() []byte
func (FixedSuffrageCandidateLimiterRule) IsValid ¶
func (l FixedSuffrageCandidateLimiterRule) IsValid([]byte) error
func (FixedSuffrageCandidateLimiterRule) Limit ¶
func (l FixedSuffrageCandidateLimiterRule) Limit() uint64
func (FixedSuffrageCandidateLimiterRule) MarshalJSON ¶
func (l FixedSuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)
func (*FixedSuffrageCandidateLimiterRule) UnmarshalJSON ¶
func (l *FixedSuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error
type FuncProposerSelector ¶
type FuncProposerSelector struct {
// contains filtered or unexported fields
}
type INITBallot ¶
type INITBallot struct {
// contains filtered or unexported fields
}
func NewINITBallot ¶
func NewINITBallot( vp base.Voteproof, signfact INITBallotSignFact, withdraws []base.SuffrageWithdrawOperation, ) INITBallot
func (INITBallot) BallotSignFact ¶
func (bl INITBallot) BallotSignFact() base.INITBallotSignFact
func (*INITBallot) DecodeJSON ¶
func (INITBallot) IsValid ¶
func (bl INITBallot) IsValid(networkID []byte) error
func (INITBallot) MarshalJSON ¶
func (INITBallot) Point ¶
func (bl INITBallot) Point() base.StagePoint
func (INITBallot) SignFact ¶
func (bl INITBallot) SignFact() base.BallotSignFact
func (INITBallot) Withdraws ¶
func (bl INITBallot) Withdraws() []base.SuffrageWithdrawOperation
type INITBallotFact ¶
type INITBallotFact struct {
// contains filtered or unexported fields
}
func NewINITBallotFact ¶
func (*INITBallotFact) DecodeJSON ¶
func (fact *INITBallotFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (INITBallotFact) IsValid ¶
func (fact INITBallotFact) IsValid([]byte) error
func (INITBallotFact) MarshalJSON ¶
func (fact INITBallotFact) MarshalJSON() ([]byte, error)
func (INITBallotFact) Point ¶
func (fact INITBallotFact) Point() base.StagePoint
func (INITBallotFact) PreviousBlock ¶
func (fact INITBallotFact) PreviousBlock() util.Hash
func (INITBallotFact) Proposal ¶
func (fact INITBallotFact) Proposal() util.Hash
func (INITBallotFact) WithdrawFacts ¶
type INITBallotFactJSONUnmarshaler ¶
type INITBallotFactJSONUnmarshaler struct { PreviousBlock valuehash.HashDecoder `json:"previous_block"` Proposal valuehash.HashDecoder `json:"proposal"` // contains filtered or unexported fields }
type INITBallotSignFact ¶
type INITBallotSignFact struct {
// contains filtered or unexported fields
}
func NewINITBallotSignFact ¶
func NewINITBallotSignFact(fact base.INITBallotFact) INITBallotSignFact
func (INITBallotSignFact) BallotFact ¶
func (sf INITBallotSignFact) BallotFact() base.INITBallotFact
func (*INITBallotSignFact) DecodeJSON ¶
func (INITBallotSignFact) IsValid ¶
func (sf INITBallotSignFact) IsValid(networkID []byte) error
func (INITBallotSignFact) MarshalJSON ¶
type INITStuckVoteproof ¶
type INITStuckVoteproof struct { INITVoteproof // contains filtered or unexported fields }
func NewINITStuckVoteproof ¶
func NewINITStuckVoteproof(point base.Point) INITStuckVoteproof
func (*INITStuckVoteproof) DecodeJSON ¶
func (vp *INITStuckVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (*INITStuckVoteproof) Finish ¶
func (vp *INITStuckVoteproof) Finish() *INITStuckVoteproof
func (INITStuckVoteproof) FinishedAt ¶
func (INITStuckVoteproof) IsStuckVoteproof ¶
func (INITStuckVoteproof) IsStuckVoteproof() bool
func (INITStuckVoteproof) IsValid ¶
func (vp INITStuckVoteproof) IsValid(networkID []byte) error
func (INITStuckVoteproof) Majority ¶
func (vp INITStuckVoteproof) Majority() base.BallotFact
func (INITStuckVoteproof) MarshalJSON ¶
func (vp INITStuckVoteproof) MarshalJSON() ([]byte, error)
func (INITStuckVoteproof) Point ¶
func (vp INITStuckVoteproof) Point() base.StagePoint
func (INITStuckVoteproof) Result ¶
func (vp INITStuckVoteproof) Result() base.VoteResult
func (*INITStuckVoteproof) SetMajority ¶
func (vp *INITStuckVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
func (*INITStuckVoteproof) SetPoint ¶
func (vp *INITStuckVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
func (*INITStuckVoteproof) SetSignFacts ¶
func (vp *INITStuckVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
func (*INITStuckVoteproof) SetThreshold ¶
func (INITStuckVoteproof) SignFacts ¶
func (vp INITStuckVoteproof) SignFacts() []base.BallotSignFact
type INITVoteproof ¶
type INITVoteproof struct {
// contains filtered or unexported fields
}
func NewINITVoteproof ¶
func NewINITVoteproof(point base.Point) INITVoteproof
func (INITVoteproof) BallotMajority ¶
func (vp INITVoteproof) BallotMajority() base.INITBallotFact
func (INITVoteproof) BallotSignFacts ¶
func (vp INITVoteproof) BallotSignFacts() []base.INITBallotSignFact
func (*INITVoteproof) DecodeJSON ¶
func (INITVoteproof) FinishedAt ¶
func (INITVoteproof) IsValid ¶
func (vp INITVoteproof) IsValid(networkID []byte) error
func (INITVoteproof) Majority ¶
func (vp INITVoteproof) Majority() base.BallotFact
func (INITVoteproof) MarshalJSON ¶
func (INITVoteproof) Point ¶
func (vp INITVoteproof) Point() base.StagePoint
func (INITVoteproof) Result ¶
func (vp INITVoteproof) Result() base.VoteResult
func (*INITVoteproof) SetMajority ¶
func (vp *INITVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
func (*INITVoteproof) SetPoint ¶
func (vp *INITVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
func (*INITVoteproof) SetSignFacts ¶
func (vp *INITVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
func (*INITVoteproof) SetThreshold ¶
func (INITVoteproof) SignFacts ¶
func (vp INITVoteproof) SignFacts() []base.BallotSignFact
type INITWithdrawVoteproof ¶
type INITWithdrawVoteproof struct { INITVoteproof // contains filtered or unexported fields }
func NewINITWithdrawVoteproof ¶
func NewINITWithdrawVoteproof(point base.Point) INITWithdrawVoteproof
func (*INITWithdrawVoteproof) DecodeJSON ¶
func (vp *INITWithdrawVoteproof) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (INITWithdrawVoteproof) FinishedAt ¶
func (INITWithdrawVoteproof) HashBytes ¶
func (vp INITWithdrawVoteproof) HashBytes() []byte
func (INITWithdrawVoteproof) IsValid ¶
func (vp INITWithdrawVoteproof) IsValid(networkID []byte) error
func (INITWithdrawVoteproof) IsWithdrawVoteproof ¶
func (INITWithdrawVoteproof) IsWithdrawVoteproof() bool
func (INITWithdrawVoteproof) Majority ¶
func (vp INITWithdrawVoteproof) Majority() base.BallotFact
func (INITWithdrawVoteproof) MarshalJSON ¶
func (vp INITWithdrawVoteproof) MarshalJSON() ([]byte, error)
func (INITWithdrawVoteproof) Point ¶
func (vp INITWithdrawVoteproof) Point() base.StagePoint
func (INITWithdrawVoteproof) Result ¶
func (vp INITWithdrawVoteproof) Result() base.VoteResult
func (*INITWithdrawVoteproof) SetMajority ¶
func (vp *INITWithdrawVoteproof) SetMajority(fact base.BallotFact) *baseVoteproof
func (*INITWithdrawVoteproof) SetPoint ¶
func (vp *INITWithdrawVoteproof) SetPoint(p base.StagePoint) *baseVoteproof
func (*INITWithdrawVoteproof) SetSignFacts ¶
func (vp *INITWithdrawVoteproof) SetSignFacts(sfs []base.BallotSignFact) *baseVoteproof
func (*INITWithdrawVoteproof) SetThreshold ¶
func (*INITWithdrawVoteproof) SetWithdraws ¶
func (vp *INITWithdrawVoteproof) SetWithdraws(withdraws []base.SuffrageWithdrawOperation) *baseWithdrawVoteproof
func (INITWithdrawVoteproof) SignFacts ¶
func (vp INITWithdrawVoteproof) SignFacts() []base.BallotSignFact
func (INITWithdrawVoteproof) Withdraws ¶
func (vp INITWithdrawVoteproof) Withdraws() []base.SuffrageWithdrawOperation
type LastConsensusNodesWatcher ¶
type LastConsensusNodesWatcher struct { *util.ContextDaemon *logging.Logging // contains filtered or unexported fields }
func NewLastConsensusNodesWatcher ¶
func NewLastConsensusNodesWatcher( getFromLocal func() (base.Height, base.SuffrageProof, base.State, bool, error), getFromRemote func(context.Context, base.State) (base.Height, []base.SuffrageProof, base.State, error), whenUpdatedf func(context.Context, base.SuffrageProof, base.SuffrageProof, base.State), checkInterval time.Duration, ) (*LastConsensusNodesWatcher, error)
func (*LastConsensusNodesWatcher) GetSuffrage ¶
func (*LastConsensusNodesWatcher) Last ¶
func (u *LastConsensusNodesWatcher) Last() (base.SuffrageProof, base.State, error)
func (*LastConsensusNodesWatcher) SetWhenUpdated ¶
func (u *LastConsensusNodesWatcher) SetWhenUpdated( whenUpdated func(context.Context, base.SuffrageProof, base.SuffrageProof, base.State), )
type LocalNode ¶
func NewLocalNode ¶
func NewLocalNode(priv base.Privatekey, addr base.Address) LocalNode
func (LocalNode) Privatekey ¶
func (n LocalNode) Privatekey() base.Privatekey
type LocalParams ¶
type LocalParams struct { util.DefaultJSONMarshaled hint.BaseHinter sync.RWMutex // contains filtered or unexported fields }
func DefaultLocalParams ¶
func DefaultLocalParams(networkID base.NetworkID) *LocalParams
func NewLocalParams ¶
func NewLocalParams(networkID base.NetworkID) *LocalParams
func (*LocalParams) BallotStuckResolveAfter ¶
func (p *LocalParams) BallotStuckResolveAfter() time.Duration
func (*LocalParams) BallotStuckWait ¶
func (p *LocalParams) BallotStuckWait() time.Duration
func (*LocalParams) ID ¶
func (p *LocalParams) ID() string
func (*LocalParams) IntervalBroadcastBallot ¶
func (p *LocalParams) IntervalBroadcastBallot() time.Duration
func (*LocalParams) IsValid ¶
func (p *LocalParams) IsValid(networkID []byte) error
func (*LocalParams) MarshalJSON ¶
func (p *LocalParams) MarshalJSON() ([]byte, error)
func (*LocalParams) MaxMessageSize ¶
func (p *LocalParams) MaxMessageSize() uint64
func (*LocalParams) NetworkID ¶
func (p *LocalParams) NetworkID() base.NetworkID
func (*LocalParams) SameMemberLimit ¶
func (p *LocalParams) SameMemberLimit() uint64
func (*LocalParams) SetBallotStuckResolveAfter ¶
func (p *LocalParams) SetBallotStuckResolveAfter(d time.Duration) *LocalParams
func (*LocalParams) SetBallotStuckWait ¶
func (p *LocalParams) SetBallotStuckWait(d time.Duration) *LocalParams
func (*LocalParams) SetIntervalBroadcastBallot ¶
func (p *LocalParams) SetIntervalBroadcastBallot(d time.Duration) *LocalParams
func (*LocalParams) SetMaxMessageSize ¶
func (p *LocalParams) SetMaxMessageSize(s uint64) *LocalParams
func (*LocalParams) SetNetworkID ¶
func (p *LocalParams) SetNetworkID(n base.NetworkID) *LocalParams
func (*LocalParams) SetSameMemberLimit ¶
func (p *LocalParams) SetSameMemberLimit(s uint64) *LocalParams
func (*LocalParams) SetSyncSourceCheckerInterval ¶
func (p *LocalParams) SetSyncSourceCheckerInterval(d time.Duration) *LocalParams
func (*LocalParams) SetThreshold ¶
func (p *LocalParams) SetThreshold(t base.Threshold) *LocalParams
func (*LocalParams) SetTimeoutRequestProposal ¶
func (p *LocalParams) SetTimeoutRequestProposal(d time.Duration) *LocalParams
func (*LocalParams) SetValidProposalOperationExpire ¶
func (p *LocalParams) SetValidProposalOperationExpire(d time.Duration) *LocalParams
func (*LocalParams) SetValidProposalSuffrageOperationsExpire ¶
func (p *LocalParams) SetValidProposalSuffrageOperationsExpire(d time.Duration) *LocalParams
func (*LocalParams) SetWaitPreparingINITBallot ¶
func (p *LocalParams) SetWaitPreparingINITBallot(d time.Duration) *LocalParams
func (*LocalParams) SetWaitPreparingNextRoundINITBallot ¶
func (p *LocalParams) SetWaitPreparingNextRoundINITBallot(d time.Duration) *LocalParams
func (*LocalParams) SyncSourceCheckerInterval ¶
func (p *LocalParams) SyncSourceCheckerInterval() time.Duration
func (*LocalParams) Threshold ¶
func (p *LocalParams) Threshold() base.Threshold
func (*LocalParams) TimeoutRequestProposal ¶
func (p *LocalParams) TimeoutRequestProposal() time.Duration
func (*LocalParams) UnmarshalJSON ¶
func (p *LocalParams) UnmarshalJSON(b []byte) error
func (*LocalParams) ValidProposalOperationExpire ¶
func (p *LocalParams) ValidProposalOperationExpire() time.Duration
func (*LocalParams) ValidProposalSuffrageOperationsExpire ¶
func (p *LocalParams) ValidProposalSuffrageOperationsExpire() time.Duration
func (*LocalParams) WaitPreparingINITBallot ¶
func (p *LocalParams) WaitPreparingINITBallot() time.Duration
func (*LocalParams) WaitPreparingNextRoundINITBallot ¶
func (p *LocalParams) WaitPreparingNextRoundINITBallot() time.Duration
type MajoritySuffrageCandidateLimiterRule ¶
type MajoritySuffrageCandidateLimiterRule struct { hint.BaseHinter // contains filtered or unexported fields }
func NewMajoritySuffrageCandidateLimiterRule ¶
func NewMajoritySuffrageCandidateLimiterRule(ratio float64, min, max uint64) MajoritySuffrageCandidateLimiterRule
func (MajoritySuffrageCandidateLimiterRule) HashBytes ¶
func (l MajoritySuffrageCandidateLimiterRule) HashBytes() []byte
func (MajoritySuffrageCandidateLimiterRule) IsValid ¶
func (l MajoritySuffrageCandidateLimiterRule) IsValid([]byte) error
func (MajoritySuffrageCandidateLimiterRule) MarshalJSON ¶
func (l MajoritySuffrageCandidateLimiterRule) MarshalJSON() ([]byte, error)
func (MajoritySuffrageCandidateLimiterRule) Max ¶
func (l MajoritySuffrageCandidateLimiterRule) Max() uint64
func (MajoritySuffrageCandidateLimiterRule) Min ¶
func (l MajoritySuffrageCandidateLimiterRule) Min() uint64
func (MajoritySuffrageCandidateLimiterRule) Ratio ¶
func (l MajoritySuffrageCandidateLimiterRule) Ratio() float64
func (*MajoritySuffrageCandidateLimiterRule) UnmarshalJSON ¶
func (l *MajoritySuffrageCandidateLimiterRule) UnmarshalJSON(b []byte) error
type Manifest ¶
type Manifest struct { hint.BaseHinter // contains filtered or unexported fields }
func NewManifest ¶
func (Manifest) MarshalJSON ¶
func (Manifest) OperationsTree ¶
func (Manifest) ProposedAt ¶
func (Manifest) StatesTree ¶
func (*Manifest) UnmarshalJSON ¶
type ManifestJSONMarshaler ¶
type ManifestJSONMarshaler struct { ProposedAt time.Time `json:"proposed_at"` StatesTree util.Hash `json:"states_tree"` Hash util.Hash `json:"hash"` Previous util.Hash `json:"previous"` Proposal util.Hash `json:"proposal"` OperationsTree util.Hash `json:"operations_tree"` Suffrage util.Hash `json:"suffrage"` hint.BaseHinter Height base.Height `json:"height"` }
type ManifestJSONUnmarshaler ¶
type ManifestJSONUnmarshaler struct { ProposedAt localtime.Time `json:"proposed_at"` Hash valuehash.HashDecoder `json:"hash"` Previous valuehash.HashDecoder `json:"previous"` Proposal valuehash.HashDecoder `json:"proposal"` OperationsTree valuehash.HashDecoder `json:"operations_tree"` StatesTree valuehash.HashDecoder `json:"states_tree"` Suffrage valuehash.HashDecoder `json:"suffrage"` Height base.HeightDecoder `json:"height"` }
type NetworkClient ¶
type NetworkClient interface { Request(context.Context, quicstream.UDPConnInfo, NetworkHeader, io.Reader) (NetworkResponseHeader, interface{}, func() error, error) Operation(_ context.Context, _ quicstream.UDPConnInfo, operationhash util.Hash) (base.Operation, bool, error) SendOperation(context.Context, quicstream.UDPConnInfo, base.Operation) (bool, error) RequestProposal(_ context.Context, connInfo quicstream.UDPConnInfo, point base.Point, propser base.Address) (base.ProposalSignFact, bool, error) Proposal(_ context.Context, connInfo quicstream.UDPConnInfo, facthash util.Hash) (base.ProposalSignFact, bool, error) LastSuffrageProof(_ context.Context, connInfo quicstream.UDPConnInfo, state util.Hash) (lastheight base.Height, _ base.SuffrageProof, updated bool, _ error) SuffrageProof(_ context.Context, connInfo quicstream.UDPConnInfo, suffrageheight base.Height) (_ base.SuffrageProof, found bool, _ error) LastBlockMap(_ context.Context, _ quicstream.UDPConnInfo, manifest util.Hash) (_ base.BlockMap, updated bool, _ error) BlockMap(context.Context, quicstream.UDPConnInfo, base.Height) (_ base.BlockMap, updated bool, _ error) BlockMapItem(context.Context, quicstream.UDPConnInfo, base.Height, base.BlockMapItemType) (io.ReadCloser, func() error, bool, error) NodeChallenge(_ context.Context, _ quicstream.UDPConnInfo, _ base.NetworkID, _ base.Address, _ base.Publickey, input []byte) (base.Signature, error) SuffrageNodeConnInfo(context.Context, quicstream.UDPConnInfo) ([]NodeConnInfo, error) SyncSourceConnInfo(context.Context, quicstream.UDPConnInfo) ([]NodeConnInfo, error) State(_ context.Context, _ quicstream.UDPConnInfo, key string, _ util.Hash) (base.State, bool, error) ExistsInStateOperation(_ context.Context, _ quicstream.UDPConnInfo, facthash util.Hash) (bool, error) SendBallots(context.Context, quicstream.UDPConnInfo, []base.BallotSignFact) error }
revive:disable:line-length-limit
type NetworkHeader ¶
type NetworkPolicy ¶
type NetworkPolicy struct { util.DefaultJSONMarshaled hint.BaseHinter // contains filtered or unexported fields }
func DefaultNetworkPolicy ¶
func DefaultNetworkPolicy() NetworkPolicy
func (*NetworkPolicy) DecodeJSON ¶
func (p *NetworkPolicy) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (NetworkPolicy) HashBytes ¶
func (p NetworkPolicy) HashBytes() []byte
func (NetworkPolicy) IsValid ¶
func (p NetworkPolicy) IsValid([]byte) error
func (NetworkPolicy) MarshalJSON ¶
func (p NetworkPolicy) MarshalJSON() ([]byte, error)
func (NetworkPolicy) MaxOperationsInProposal ¶
func (p NetworkPolicy) MaxOperationsInProposal() uint64
func (NetworkPolicy) MaxSuffrageSize ¶
func (p NetworkPolicy) MaxSuffrageSize() uint64
func (NetworkPolicy) SuffrageCandidateLifespan ¶
func (p NetworkPolicy) SuffrageCandidateLifespan() base.Height
func (NetworkPolicy) SuffrageCandidateLimiterRule ¶
func (p NetworkPolicy) SuffrageCandidateLimiterRule() base.SuffrageCandidateLimiterRule
func (NetworkPolicy) SuffrageWithdrawLifespan ¶
func (p NetworkPolicy) SuffrageWithdrawLifespan() base.Height
type NetworkPolicyStateValue ¶
type NetworkPolicyStateValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewNetworkPolicyStateValue ¶
func NewNetworkPolicyStateValue(policy base.NetworkPolicy) NetworkPolicyStateValue
func (*NetworkPolicyStateValue) DecodeJSON ¶
func (s *NetworkPolicyStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (NetworkPolicyStateValue) HashBytes ¶
func (s NetworkPolicyStateValue) HashBytes() []byte
func (NetworkPolicyStateValue) IsValid ¶
func (s NetworkPolicyStateValue) IsValid([]byte) error
func (NetworkPolicyStateValue) MarshalJSON ¶
func (s NetworkPolicyStateValue) MarshalJSON() ([]byte, error)
func (NetworkPolicyStateValue) Policy ¶
func (s NetworkPolicyStateValue) Policy() base.NetworkPolicy
type NetworkPolicyStateValueJSONMarshaler ¶
type NetworkPolicyStateValueJSONMarshaler struct { Policy base.NetworkPolicy `json:"policy"` hint.BaseHinter }
type NetworkPolicyStateValueJSONUnmarshaler ¶
type NetworkPolicyStateValueJSONUnmarshaler struct {
Policy json.RawMessage `json:"policy"`
}
type NetworkResponseContentType ¶
type NetworkResponseContentType string
var ( NetworkResponseHinterContentType NetworkResponseContentType NetworkResponseRawContentType NetworkResponseContentType = "raw" )
type NetworkResponseHeader ¶
type NetworkResponseHeader interface { NetworkHeader Err() error OK() bool Type() NetworkResponseContentType }
type NewBlockWriterFunc ¶
type NewBlockWriterFunc func(base.ProposalSignFact, base.GetStateFunc) (BlockWriter, error)
type NewOperationPool ¶
type NewOperationPool interface { NewOperation(_ context.Context, operationhash util.Hash) (base.Operation, bool, error) NewOperationBytes(_ context.Context, operationhash util.Hash) (hint.Hint, []byte, []byte, bool, error) NewOperationHashes( _ context.Context, _ base.Height, limit uint64, filter func(PoolOperationRecordMeta) (ok bool, err error), ) ([]util.Hash, error) SetNewOperation(context.Context, base.Operation) (bool, error) }
type NodeConnInfo ¶
type NodeConnInfo interface { base.Node network.ConnInfo UDPConnInfo() (quicstream.UDPConnInfo, error) }
type OperationProcessHandler ¶
type OperationProcessorGetOperationFunction ¶
type OperationProcessorGetOperationFunction func(_ context.Context, operationhash util.Hash) (base.Operation, error)
OperationProcessorGetOperationFunction works, - if operation is invalid, getOperation should return nil, InvalidOperationInProcessorError; it will be not processed and it's fact hash will be stored. - if operation is not found in remote, getOperation should return nil, OperationNotFoundInProcessorError; it will be ignored. - if operation is known, return nil, OperationAlreadyProcessedInProcessorError; it will be ignored.
type PermanentDatabase ¶
type PermanentDatabase interface { BaseDatabase Close() error Clean() error LastBlockMap() (base.BlockMap, bool, error) LastBlockMapBytes() (hint.Hint, []byte, []byte, bool, error) LastSuffrageProof() (base.SuffrageProof, bool, error) LastSuffrageProofBytes() (hint.Hint, []byte, []byte, bool, error) SuffrageProof(suffrageHeight base.Height) (base.SuffrageProof, bool, error) SuffrageProofBytes(suffrageHeight base.Height) (hint.Hint, []byte, []byte, bool, error) SuffrageProofByBlockHeight(blockheight base.Height) (base.SuffrageProof, bool, error) BlockMap(base.Height) (base.BlockMap, bool, error) BlockMapBytes(base.Height) (hint.Hint, []byte, []byte, bool, error) LastNetworkPolicy() base.NetworkPolicy MergeTempDatabase(context.Context, TempDatabase) error }
PermanentDatabase stores BlockMapItem permanently.
type PoolOperationRecordMeta ¶
type ProposalFact ¶
func NewProposalFact ¶
func (*ProposalFact) DecodeJSON ¶
func (fact *ProposalFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (ProposalFact) IsValid ¶
func (fact ProposalFact) IsValid([]byte) error
func (ProposalFact) MarshalJSON ¶
func (fact ProposalFact) MarshalJSON() ([]byte, error)
func (ProposalFact) Operations ¶
func (fact ProposalFact) Operations() []util.Hash
func (ProposalFact) Point ¶
func (fact ProposalFact) Point() base.Point
func (ProposalFact) ProposedAt ¶
func (fact ProposalFact) ProposedAt() time.Time
func (ProposalFact) Proposer ¶
func (fact ProposalFact) Proposer() base.Address
type ProposalMaker ¶
func NewProposalMaker ¶
func NewProposalMaker( local base.LocalNode, params base.LocalParams, getOperations func(context.Context, base.Height) ([]util.Hash, error), pool ProposalPool, ) *ProposalMaker
func (*ProposalMaker) Empty ¶
func (p *ProposalMaker) Empty(_ context.Context, point base.Point) (base.ProposalSignFact, error)
func (*ProposalMaker) New ¶
func (p *ProposalMaker) New(ctx context.Context, point base.Point) (base.ProposalSignFact, error)
type ProposalPool ¶
type ProposalProcessor ¶
type ProposalProcessor interface { Proposal() base.ProposalSignFact Process(context.Context, base.INITVoteproof) (base.Manifest, error) Save(context.Context, base.ACCEPTVoteproof) error Cancel() error }
type ProposalProcessors ¶
type ProposalProcessors struct { *logging.Logging sync.RWMutex // contains filtered or unexported fields }
func NewProposalProcessors ¶
func NewProposalProcessors( makenew func(base.ProposalSignFact, base.Manifest) (ProposalProcessor, error), getproposal func(context.Context, util.Hash) (base.ProposalSignFact, error), ) *ProposalProcessors
func (*ProposalProcessors) Cancel ¶
func (pps *ProposalProcessors) Cancel() error
func (*ProposalProcessors) Process ¶
func (pps *ProposalProcessors) Process( ctx context.Context, facthash util.Hash, previous base.Manifest, ivp base.INITVoteproof, ) (ProcessorProcessFunc, error)
func (*ProposalProcessors) Processor ¶
func (pps *ProposalProcessors) Processor() ProposalProcessor
func (*ProposalProcessors) Save ¶
func (pps *ProposalProcessors) Save(ctx context.Context, facthash util.Hash, avp base.ACCEPTVoteproof) error
func (*ProposalProcessors) SetRetryInterval ¶
func (pps *ProposalProcessors) SetRetryInterval(i time.Duration) *ProposalProcessors
func (*ProposalProcessors) SetRetryLimit ¶
func (pps *ProposalProcessors) SetRetryLimit(l int) *ProposalProcessors
type ProposalSelector ¶
type ProposalSelector interface {
Select(context.Context, base.Point) (base.ProposalSignFact, error)
}
ProposalSelector fetchs proposal from selected proposer
type ProposalSignFact ¶
type ProposalSignFact struct { util.DefaultJSONMarshaled hint.BaseHinter // contains filtered or unexported fields }
func NewProposalSignFact ¶
func NewProposalSignFact(fact ProposalFact) ProposalSignFact
func (*ProposalSignFact) DecodeJSON ¶
func (sf *ProposalSignFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (ProposalSignFact) Fact ¶
func (sf ProposalSignFact) Fact() base.Fact
func (ProposalSignFact) HashBytes ¶
func (sf ProposalSignFact) HashBytes() []byte
func (ProposalSignFact) IsValid ¶
func (sf ProposalSignFact) IsValid(networkID []byte) error
func (ProposalSignFact) MarshalJSON ¶
func (sf ProposalSignFact) MarshalJSON() ([]byte, error)
func (ProposalSignFact) Point ¶
func (sf ProposalSignFact) Point() base.Point
func (ProposalSignFact) ProposalFact ¶
func (sf ProposalSignFact) ProposalFact() base.ProposalFact
func (*ProposalSignFact) Sign ¶
func (sf *ProposalSignFact) Sign(priv base.Privatekey, networkID base.NetworkID) error
func (ProposalSignFact) Signs ¶
func (sf ProposalSignFact) Signs() []base.Sign
type ProposerSelector ¶
type ProposerSelector interface {
Select(context.Context, base.Point, []base.Node) (base.Node, error)
}
ProposerSelector selects proposer between suffrage nodes
type ReasonProcessedOperation ¶
func NewReasonProcessedOperation ¶
func NewReasonProcessedOperation( op, facthash util.Hash, reason base.OperationProcessReasonError, ) ReasonProcessedOperation
func (ReasonProcessedOperation) FactHash ¶
func (op ReasonProcessedOperation) FactHash() util.Hash
func (ReasonProcessedOperation) OperationHash ¶
func (op ReasonProcessedOperation) OperationHash() util.Hash
func (ReasonProcessedOperation) Reason ¶
func (op ReasonProcessedOperation) Reason() base.OperationProcessReasonError
type Suffrage ¶
type Suffrage struct {
// contains filtered or unexported fields
}
func (Suffrage) ExistsPublickey ¶
func (Suffrage) MarshalJSON ¶
type SuffrageCandidateJSONUnmarshaler ¶
type SuffrageCandidateJSONUnmarshaler struct { Node json.RawMessage `json:"node"` Start base.HeightDecoder `json:"start"` Deadline base.HeightDecoder `json:"deadline"` }
type SuffrageCandidateStateValue ¶
type SuffrageCandidateStateValue struct { base.Node hint.BaseHinter // contains filtered or unexported fields }
func NewSuffrageCandidateStateValue ¶
func NewSuffrageCandidateStateValue(node base.Node, start, deadline base.Height) SuffrageCandidateStateValue
func (SuffrageCandidateStateValue) Deadline ¶
func (suf SuffrageCandidateStateValue) Deadline() base.Height
func (*SuffrageCandidateStateValue) DecodeJSON ¶
func (suf *SuffrageCandidateStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (SuffrageCandidateStateValue) HashBytes ¶
func (suf SuffrageCandidateStateValue) HashBytes() []byte
func (SuffrageCandidateStateValue) IsValid ¶
func (suf SuffrageCandidateStateValue) IsValid([]byte) error
func (SuffrageCandidateStateValue) MarshalJSON ¶
func (suf SuffrageCandidateStateValue) MarshalJSON() ([]byte, error)
func (SuffrageCandidateStateValue) Start ¶
func (suf SuffrageCandidateStateValue) Start() base.Height
type SuffrageCandidatesStateValue ¶
type SuffrageCandidatesStateValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewSuffrageCandidatesStateValue ¶
func NewSuffrageCandidatesStateValue(nodes []base.SuffrageCandidateStateValue) SuffrageCandidatesStateValue
func (*SuffrageCandidatesStateValue) DecodeJSON ¶
func (s *SuffrageCandidatesStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (SuffrageCandidatesStateValue) HashBytes ¶
func (s SuffrageCandidatesStateValue) HashBytes() []byte
func (SuffrageCandidatesStateValue) IsValid ¶
func (s SuffrageCandidatesStateValue) IsValid([]byte) error
func (SuffrageCandidatesStateValue) MarshalJSON ¶
func (s SuffrageCandidatesStateValue) MarshalJSON() ([]byte, error)
func (SuffrageCandidatesStateValue) Nodes ¶
func (s SuffrageCandidatesStateValue) Nodes() []base.SuffrageCandidateStateValue
type SuffrageConfirmBallotFact ¶
type SuffrageConfirmBallotFact struct {
INITBallotFact
}
func (SuffrageConfirmBallotFact) IsValid ¶
func (fact SuffrageConfirmBallotFact) IsValid([]byte) error
func (SuffrageConfirmBallotFact) Point ¶
func (fact SuffrageConfirmBallotFact) Point() base.StagePoint
func (SuffrageConfirmBallotFact) WithdrawFacts ¶
type SuffrageNodeStateValue ¶
type SuffrageNodeStateValue struct { base.Node hint.BaseHinter // contains filtered or unexported fields }
func NewSuffrageNodeStateValue ¶
func NewSuffrageNodeStateValue(node base.Node, start base.Height) SuffrageNodeStateValue
func (*SuffrageNodeStateValue) DecodeJSON ¶
func (s *SuffrageNodeStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (SuffrageNodeStateValue) HashBytes ¶
func (s SuffrageNodeStateValue) HashBytes() []byte
func (SuffrageNodeStateValue) Hint ¶
func (s SuffrageNodeStateValue) Hint() hint.Hint
func (SuffrageNodeStateValue) IsValid ¶
func (s SuffrageNodeStateValue) IsValid([]byte) error
func (SuffrageNodeStateValue) MarshalJSON ¶
func (s SuffrageNodeStateValue) MarshalJSON() ([]byte, error)
func (SuffrageNodeStateValue) Start ¶
func (s SuffrageNodeStateValue) Start() base.Height
type SuffrageNodesStateValue ¶
type SuffrageNodesStateValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewSuffrageNodesStateValue ¶
func NewSuffrageNodesStateValue( suffrageheight base.Height, nodes []base.SuffrageNodeStateValue, ) SuffrageNodesStateValue
func (*SuffrageNodesStateValue) DecodeJSON ¶
func (s *SuffrageNodesStateValue) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (SuffrageNodesStateValue) HashBytes ¶
func (s SuffrageNodesStateValue) HashBytes() []byte
func (SuffrageNodesStateValue) Height ¶
func (s SuffrageNodesStateValue) Height() base.Height
func (SuffrageNodesStateValue) IsValid ¶
func (s SuffrageNodesStateValue) IsValid([]byte) error
func (SuffrageNodesStateValue) MarshalJSON ¶
func (s SuffrageNodesStateValue) MarshalJSON() ([]byte, error)
func (SuffrageNodesStateValue) Nodes ¶
func (s SuffrageNodesStateValue) Nodes() []base.SuffrageNodeStateValue
type SuffrageStateBuilder ¶
type SuffrageStateBuilder struct {
// contains filtered or unexported fields
}
SuffrageStateBuilder tries to sync suffrage states from remote nodes. It will rebuild the entire suffrage states history. SuffrageProof from getSuffrageProof should be valid(IsValid()).
func NewSuffrageStateBuilder ¶
func NewSuffrageStateBuilder( networkID base.NetworkID, lastSuffrageProof GetLastSuffrageProofFromRemoteFunc, getSuffrageProof GetSuffrageProofFromRemoteFunc, lastSuffrageCandidateState GetLastSuffrageCandidateStateRemoteFunc, ) *SuffrageStateBuilder
type SuffrageVoteFunc ¶
type SuffrageVoteFunc func(base.SuffrageWithdrawOperation) (bool, error)
type SuffrageVoting ¶
type SuffrageVoting struct {
// contains filtered or unexported fields
}
func NewSuffrageVoting ¶
func NewSuffrageVoting( local base.Address, db SuffrageWithdrawPool, existsInState func(util.Hash) (bool, error), votedCallback func(base.SuffrageWithdrawOperation) error, ) *SuffrageVoting
func (*SuffrageVoting) Find ¶
func (s *SuffrageVoting) Find( ctx context.Context, height base.Height, suf base.Suffrage, ) ([]base.SuffrageWithdrawOperation, error)
func (*SuffrageVoting) Vote ¶
func (s *SuffrageVoting) Vote(op base.SuffrageWithdrawOperation) (bool, error)
type SuffrageWithdrawFact ¶
func NewSuffrageWithdrawFact ¶
func (*SuffrageWithdrawFact) DecodeJSON ¶
func (fact *SuffrageWithdrawFact) DecodeJSON(b []byte, enc *jsonenc.Encoder) error
func (SuffrageWithdrawFact) IsValid ¶
func (fact SuffrageWithdrawFact) IsValid([]byte) error
func (SuffrageWithdrawFact) MarshalJSON ¶
func (fact SuffrageWithdrawFact) MarshalJSON() ([]byte, error)
func (SuffrageWithdrawFact) Node ¶
func (fact SuffrageWithdrawFact) Node() base.Address
func (SuffrageWithdrawFact) Reason ¶
func (fact SuffrageWithdrawFact) Reason() string
func (SuffrageWithdrawFact) WithdrawEnd ¶
func (fact SuffrageWithdrawFact) WithdrawEnd() base.Height
func (SuffrageWithdrawFact) WithdrawStart ¶
func (fact SuffrageWithdrawFact) WithdrawStart() base.Height
type SuffrageWithdrawOperation ¶
type SuffrageWithdrawOperation struct {
base.BaseNodeOperation
}
func NewSuffrageWithdrawOperation ¶
func NewSuffrageWithdrawOperation(fact SuffrageWithdrawFact) SuffrageWithdrawOperation
func (SuffrageWithdrawOperation) IsValid ¶
func (op SuffrageWithdrawOperation) IsValid(networkID []byte) error
func (SuffrageWithdrawOperation) NodeSigns ¶
func (op SuffrageWithdrawOperation) NodeSigns() []base.NodeSign
func (*SuffrageWithdrawOperation) SetToken ¶
func (op *SuffrageWithdrawOperation) SetToken(base.Token) error
func (SuffrageWithdrawOperation) WithdrawFact ¶
func (op SuffrageWithdrawOperation) WithdrawFact() base.SuffrageWithdrawFact
type SuffrageWithdrawPool ¶
type SuffrageWithdrawPool interface { SuffrageWithdrawOperation(base.Height, base.Address) (base.SuffrageWithdrawOperation, bool, error) SetSuffrageWithdrawOperation(base.SuffrageWithdrawOperation) error TraverseSuffrageWithdrawOperations( context.Context, base.Height, SuffrageVoteFunc, ) error RemoveSuffrageWithdrawOperationsByFact([]base.SuffrageWithdrawFact) error RemoveSuffrageWithdrawOperationsByHeight(base.Height) error }
type SyncSourcePool ¶
func NewSyncSourcePool ¶
func NewSyncSourcePool(fixed []NodeConnInfo) *SyncSourcePool
func (*SyncSourcePool) Actives ¶
func (p *SyncSourcePool) Actives(f func(NodeConnInfo) bool)
func (*SyncSourcePool) AddNonFixed ¶
func (p *SyncSourcePool) AddNonFixed(ncis ...NodeConnInfo) bool
func (*SyncSourcePool) IsInNonFixed ¶
func (p *SyncSourcePool) IsInNonFixed(node base.Address) bool
func (*SyncSourcePool) Len ¶
func (p *SyncSourcePool) Len() int
func (*SyncSourcePool) NodeConnInfo ¶
func (p *SyncSourcePool) NodeConnInfo(node base.Address) []NodeConnInfo
func (*SyncSourcePool) NodeExists ¶
func (p *SyncSourcePool) NodeExists(node base.Address) bool
func (*SyncSourcePool) Pick ¶
func (p *SyncSourcePool) Pick() (NodeConnInfo, func(error), error)
func (*SyncSourcePool) PickMultiple ¶
func (p *SyncSourcePool) PickMultiple(n int) ([]NodeConnInfo, []func(error), error)
func (*SyncSourcePool) RemoveNonFixed ¶
func (p *SyncSourcePool) RemoveNonFixed(nci NodeConnInfo) bool
func (*SyncSourcePool) RemoveNonFixedNode ¶
func (p *SyncSourcePool) RemoveNonFixedNode(nodes ...base.Address) bool
func (*SyncSourcePool) Retry ¶
func (p *SyncSourcePool) Retry( ctx context.Context, f func(NodeConnInfo) (bool, error), limit int, interval time.Duration, ) error
func (*SyncSourcePool) Traverse ¶
func (p *SyncSourcePool) Traverse(f func(NodeConnInfo) bool)
func (*SyncSourcePool) UpdateFixed ¶
func (p *SyncSourcePool) UpdateFixed(fixed []NodeConnInfo) bool
type TempDatabase ¶
type TempDatabase interface { BaseDatabase Height() base.Height Close() error Remove() error Merge() error LastBlockMap() (base.BlockMap, bool, error) BlockMapBytes() (hint.Hint, []byte, []byte, error) SuffrageHeight() base.Height SuffrageProof() (base.SuffrageProof, bool, error) LastSuffrageProofBytes() (hint.Hint, []byte, []byte, bool, error) NetworkPolicy() base.NetworkPolicy }
TempDatabase is the temporary database; it contains only blockmap and others of one block for storing BlockMapItem fast.
type TempSyncPool ¶
type WithdrawBallotFact ¶
Source Files ¶
- ballot.go
- ballot_fact.go
- ballot_fact_json.go
- ballot_json.go
- ballot_sign.go
- ballot_sign_json.go
- block.go
- block_json.go
- block_writer.go
- database.go
- doc.go
- last_consensus_nodes_watcher.go
- local_params.go
- network.go
- network_policy.go
- network_policy_json.go
- node.go
- operation.go
- proposal.go
- proposal_json.go
- proposal_processor.go
- proposal_processors.go
- proposal_selector.go
- suffrage.go
- suffrage_builder.go
- suffrage_json.go
- suffrage_limiter.go
- suffrage_limiter_json.go
- suffrage_operation.go
- suffrage_operation_json.go
- suffrage_state.go
- suffrage_voting.go
- syncer.go
- voteproof.go
- voteproof_isvalid.go
- voteproof_json.go
Directories ¶
Path | Synopsis |
---|---|
Package isaacblock handles data of block.
|
Package isaacblock handles data of block. |
Package isaacdatabase handles data for isaac
|
Package isaacdatabase handles data for isaac |
Package isaacnetwork provides network.
|
Package isaacnetwork provides network. |
Package isaacoperation provides the base operations.
|
Package isaacoperation provides the base operations. |
Package isaacstates handles node states
|
Package isaacstates handles node states |