slottracker

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: Apache-2.0, BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		VotersUpdated: event.New1[*VoterUpdatedEvent](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

This section is empty.

Types

type Events

type Events struct {
	VotersUpdated *event.Event1[*VoterUpdatedEvent]

	event.Group[Events, *Events]
}

type SlotTracker

type SlotTracker struct {
	Events *Events
	// contains filtered or unexported fields
}

func NewSlotTracker

func NewSlotTracker(cutoffIndexCallback func() slot.Index) *SlotTracker

func (*SlotTracker) EvictSlot

func (s *SlotTracker) EvictSlot(indexToEvict slot.Index)

func (*SlotTracker) TrackVotes

func (s *SlotTracker) TrackVotes(slotIndex slot.Index, voterID identity.ID, power SlotVotePower)

func (*SlotTracker) Voters

func (s *SlotTracker) Voters(slotIndex slot.Index) *advancedset.AdvancedSet[identity.ID]

type SlotVotePower

type SlotVotePower struct {
	Index slot.Index
}

func (SlotVotePower) Compare

func (p SlotVotePower) Compare(other SlotVotePower) int

type TestFramework

type TestFramework struct {
	SlotTracker *SlotTracker

	Votes *votes.TestFramework
	// contains filtered or unexported fields
}

func NewDefaultTestFramework

func NewDefaultTestFramework(t *testing.T) *TestFramework

func NewTestFramework

func NewTestFramework(test *testing.T, slotTracker *SlotTracker, votesTF *votes.TestFramework) *TestFramework

NewTestFramework is the constructor of the TestFramework.

func (*TestFramework) ValidateSlotVoters

func (t *TestFramework) ValidateSlotVoters(expectedVoters map[slot.Index]*advancedset.AdvancedSet[identity.ID])

type VoterUpdatedEvent

type VoterUpdatedEvent struct {
	Voter               identity.ID
	NewLatestSlotIndex  slot.Index
	PrevLatestSlotIndex slot.Index
}

Jump to

Keyboard shortcuts

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