Documentation
¶
Overview ¶
Package wave computes per-round thresholds and drives a poll.
Each round has two thresholds—α_pref and α_conf—that gate preference and confidence. The default selector is FPC: a phase-dependent threshold chosen from [θ_min, θ_max], reproducibly derived from a PRF.
Wave doesn't decide anything alone; it transforms a committee's tallies into a boolean (preferOK, confOK) that downstream focus can integrate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
K int // Sample size
Alpha float64 // Threshold ratio (used when FPC disabled)
Beta uint32 // Confidence threshold
RoundTO time.Duration // Round timeout
EnableFPC bool // Enable Fast Probabilistic Consensus
ThetaMin float64 // FPC minimum threshold (default: 0.5)
ThetaMax float64 // FPC maximum threshold (default: 0.8)
}
Config holds configuration for wave consensus
type State ¶
type State[ID comparable] struct { // The item ID ID ID // Confidence score Confidence int // Whether the item is finalized Finalized bool // Parent IDs Parents []ID // Height in the consensus graph Height uint64 }
State represents the consensus state for an item
func NewState ¶
func NewState[ID comparable](id ID) State[ID]
NewState creates a new consensus state
func (*State[ID]) IncrementConfidence ¶
func (s *State[ID]) IncrementConfidence()
IncrementConfidence increments the confidence score
func (State[ID]) IsPreferred ¶
IsPreferred returns whether this state is preferred
type Transport ¶
type Transport[T comparable] interface { RequestVotes(ctx context.Context, peers []types.NodeID, item T) <-chan Photon[T] MakeLocalPhoton(item T, prefer bool) Photon[T] }
Transport handles network communication for voting
type Wave ¶
type Wave[T comparable] struct { // contains filtered or unexported fields }
Wave manages threshold voting and confidence building
func (*Wave[T]) Preference ¶
Preference returns the current preference for an item