Documentation
¶
Index ¶
- type BinaryFocusTracker
- func (b *BinaryFocusTracker) GetBeta() int
- func (b *BinaryFocusTracker) GetChoice() ids.ID
- func (b *BinaryFocusTracker) GetConfidence() int
- func (b *BinaryFocusTracker) GetFocusState() *FocusState
- func (b *BinaryFocusTracker) GetSuccessRate() int
- func (b *BinaryFocusTracker) IsFocused() bool
- func (b *BinaryFocusTracker) RecordPoll(successful bool, choice ids.ID)
- func (b *BinaryFocusTracker) Reset()
- type Confidence
- type Config
- type Factory
- type FocusState
- type FocusType
- type Parameters
- type UnaryFocusTracker
- func (u *UnaryFocusTracker) GetBeta() int
- func (u *UnaryFocusTracker) GetChoice() ids.ID
- func (u *UnaryFocusTracker) GetConfidence() int
- func (u *UnaryFocusTracker) GetRecentSuccessRate() int
- func (u *UnaryFocusTracker) IsFocused() bool
- func (u *UnaryFocusTracker) RecordPoll(successful bool, choice ids.ID)
- func (u *UnaryFocusTracker) Reset()
- func (u *UnaryFocusTracker) TimeSinceLastPoll() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryFocusTracker ¶
type BinaryFocusTracker struct {
// contains filtered or unexported fields
}
BinaryFocusTracker tracks confidence for binary consensus (Previously BinaryConfidence in Avalanche)
Binary focus tracking is like a lens focusing between two possible states - as consensus forms, focus sharpens on one choice through beta consecutive rounds.
func NewBinaryFocusTracker ¶
func NewBinaryFocusTracker(beta int) *BinaryFocusTracker
NewBinaryFocusTracker creates a new binary focus tracker
func (*BinaryFocusTracker) GetBeta ¶
func (b *BinaryFocusTracker) GetBeta() int
GetBeta returns the beta parameter
func (*BinaryFocusTracker) GetChoice ¶
func (b *BinaryFocusTracker) GetChoice() ids.ID
GetChoice returns the choice we're focusing on
func (*BinaryFocusTracker) GetConfidence ¶
func (b *BinaryFocusTracker) GetConfidence() int
GetConfidence returns current confidence level (0 to Beta)
func (*BinaryFocusTracker) GetFocusState ¶
func (b *BinaryFocusTracker) GetFocusState() *FocusState
GetFocusState returns the current focus state
func (*BinaryFocusTracker) GetSuccessRate ¶
func (b *BinaryFocusTracker) GetSuccessRate() int
GetSuccessRate returns the overall success rate (0-100)
func (*BinaryFocusTracker) IsFocused ¶
func (b *BinaryFocusTracker) IsFocused() bool
IsFocused returns true if fully focused (beta rounds achieved)
func (*BinaryFocusTracker) RecordPoll ¶
func (b *BinaryFocusTracker) RecordPoll(successful bool, choice ids.ID)
RecordPoll records the result of a photon sampling round
func (*BinaryFocusTracker) Reset ¶
func (b *BinaryFocusTracker) Reset()
Reset clears confidence state
type Confidence ¶
type Confidence interface {
// RecordPoll records the result of a photon sampling round
RecordPoll(successful bool, choice ids.ID)
// GetConfidence returns current confidence level (0 to Beta)
GetConfidence() int
// IsFocused returns true if fully focused (beta rounds achieved)
IsFocused() bool
// GetBeta returns the beta parameter
GetBeta() int
// GetChoice returns the choice we're focusing on
GetChoice() ids.ID
// Reset clears confidence state
Reset()
}
Confidence represents focus intensity for beta-round tracking (Previously known as Confidence in Avalanche consensus)
As photonic consensus progresses, the "focus" intensifies through beta consecutive rounds of agreement, eventually achieving finality when fully focused.
func NewFromConfig ¶
func NewFromConfig(cfg Config) Confidence
NewFromConfig creates a focus tracker from configuration
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory creates focus tracking mechanisms (Previously ConfidenceFactory in Avalanche)
func (*Factory) New ¶
func (f *Factory) New(focusType FocusType) Confidence
New creates a focus tracker of the specified type
func (*Factory) NewBinary ¶
func (f *Factory) NewBinary() Confidence
NewBinary creates a binary focus tracker
func (*Factory) NewUnary ¶
func (f *Factory) NewUnary() Confidence
NewUnary creates a unary focus tracker
type FocusState ¶
type FocusState struct {
Choice ids.ID // The choice being focused on
ConsecutivePolls int // Number of consecutive successful polls
Beta int // Required consecutive polls for focus
TotalPolls int // Total polls conducted
SuccessfulPolls int // Total successful polls
}
FocusState represents the current focusing state (Previously ConfidenceState)
func (*FocusState) GetIntensity ¶
func (f *FocusState) GetIntensity() int
GetIntensity returns focus intensity as percentage (0-100)
func (*FocusState) IsFocused ¶
func (f *FocusState) IsFocused() bool
IsFocused returns true if we've achieved focus
type Parameters ¶
type Parameters struct {
K int // Photon sample size
AlphaPreference int // Wave threshold for preference
AlphaConfidence int // Wave threshold for confidence
Beta int // Focus rounds for finality
}
Parameters holds all photonic consensus parameters (Maps to Avalanche consensus Parameters)
type UnaryFocusTracker ¶
type UnaryFocusTracker struct {
// contains filtered or unexported fields
}
UnaryFocusTracker tracks confidence for unary consensus (Previously UnaryConfidence in Avalanche)
Unary focus tracking is like measuring photon intensity - we're not choosing between options but confirming presence through repeated observations.
func NewUnaryFocusTracker ¶
func NewUnaryFocusTracker(beta int) *UnaryFocusTracker
NewUnaryFocusTracker creates a new unary focus tracker
func (*UnaryFocusTracker) GetBeta ¶
func (u *UnaryFocusTracker) GetBeta() int
GetBeta returns the beta parameter
func (*UnaryFocusTracker) GetChoice ¶
func (u *UnaryFocusTracker) GetChoice() ids.ID
GetChoice returns the choice we're focusing on
func (*UnaryFocusTracker) GetConfidence ¶
func (u *UnaryFocusTracker) GetConfidence() int
GetConfidence returns current confidence level (0 to Beta)
func (*UnaryFocusTracker) GetRecentSuccessRate ¶
func (u *UnaryFocusTracker) GetRecentSuccessRate() int
GetRecentSuccessRate returns success rate over recent history
func (*UnaryFocusTracker) IsFocused ¶
func (u *UnaryFocusTracker) IsFocused() bool
IsFocused returns true if fully focused (beta rounds achieved)
func (*UnaryFocusTracker) RecordPoll ¶
func (u *UnaryFocusTracker) RecordPoll(successful bool, choice ids.ID)
RecordPoll records the result of a photon sampling round
func (*UnaryFocusTracker) TimeSinceLastPoll ¶
func (u *UnaryFocusTracker) TimeSinceLastPoll() time.Duration
TimeSinceLastPoll returns duration since last poll