photon

package
v1.22.25 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package photon chooses a K-sized committee each round.

The metaphor: we "emit" K rays into the validator space and read back votes. In code, this is just a reproducible, unbiased selection over a population. No physics is implied or required.

Typical use: engines pass a seed/phase to produce a stable committee for a round; wave applies thresholds over the observed tallies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	// Emit emits a message to selected nodes
	Emit(msg interface{}) ([]types.NodeID, error)

	// EmitTo emits a message to specific nodes
	EmitTo(nodes []types.NodeID, msg interface{}) error
}

Emitter emits consensus messages

type EmitterOptions

type EmitterOptions struct {
	K       int // Committee size
	Fanout  int // Number of nodes to emit to
	Timeout int // Timeout in milliseconds
}

EmitterOptions defines emitter options

func DefaultEmitterOptions

func DefaultEmitterOptions() EmitterOptions

DefaultEmitterOptions returns default emitter options

type Luminance

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

Luminance tracks node brightness based on consensus participation. More successful votes = higher lux = brighter emission probability.

func NewLuminance

func NewLuminance() *Luminance

NewLuminance creates a new brightness tracker

func (*Luminance) Brightness

func (l *Luminance) Brightness(id types.NodeID) float64

Brightness returns emission weight based on lux level (0.1 to 10.0)

func (*Luminance) Illuminate

func (l *Luminance) Illuminate(id types.NodeID, success bool)

Illuminate increases or decreases node brightness based on performance

type UniformEmitter

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

UniformEmitter implements uniform random emission

func NewUniformEmitter

func NewUniformEmitter(nodes []types.NodeID, options EmitterOptions) *UniformEmitter

NewUniformEmitter creates a new uniform emitter

func (*UniformEmitter) Emit

func (e *UniformEmitter) Emit(msg interface{}) ([]types.NodeID, error)

Emit emits a message to selected nodes

func (*UniformEmitter) EmitTo

func (e *UniformEmitter) EmitTo(nodes []types.NodeID, msg interface{}) error

EmitTo emits a message to specific nodes

Jump to

Keyboard shortcuts

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