sequencetracker

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: 14 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 SequenceTracker

type SequenceTracker[VotePowerType constraints.Comparable[VotePowerType]] struct {
	Events *Events
	// contains filtered or unexported fields
}

func NewSequenceTracker

func NewSequenceTracker[VotePowerType constraints.Comparable[VotePowerType]](validators *sybilprotection.WeightedSet, sequenceCallback func(id markers.SequenceID) (sequence *markers.Sequence, exists bool), cutoffIndexCallback func(sequenceID markers.SequenceID) markers.Index) *SequenceTracker[VotePowerType]

func (*SequenceTracker[VotePowerType]) EvictSequence

func (s *SequenceTracker[VotePowerType]) EvictSequence(sequenceID markers.SequenceID)

func (*SequenceTracker[VotePowerType]) TrackVotes

func (s *SequenceTracker[VotePowerType]) TrackVotes(pastMarkers *markers.Markers, voterID identity.ID, power VotePowerType)

func (*SequenceTracker[VotePowerType]) Voters

func (s *SequenceTracker[VotePowerType]) Voters(marker markers.Marker) (voters *advancedset.AdvancedSet[identity.ID])

func (*SequenceTracker[VotePowerType]) VotersWithPower

func (s *SequenceTracker[VotePowerType]) VotersWithPower(marker markers.Marker) (voters map[identity.ID]VotePowerType)

type TestFramework

type TestFramework[VotePowerType constraints.Comparable[VotePowerType]] struct {
	Instance *SequenceTracker[VotePowerType]

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

func NewTestFramework

func NewTestFramework[VotePowerType constraints.Comparable[VotePowerType]](test *testing.T, votesTF *votes.TestFramework, sequenceTracker *SequenceTracker[VotePowerType], sequenceManager *markers.SequenceManager) *TestFramework[VotePowerType]

NewTestFramework is the constructor of the TestFramework.

func (*TestFramework[VotePowerType]) ValidateStructureDetailsVoters

func (t *TestFramework[VotePowerType]) ValidateStructureDetailsVoters(expectedVoters map[string]*advancedset.AdvancedSet[identity.ID])

type VoterUpdatedEvent

type VoterUpdatedEvent struct {
	Voter                 identity.ID
	NewMaxSupportedIndex  markers.Index
	PrevMaxSupportedIndex markers.Index
	SequenceID            markers.SequenceID
}

Jump to

Keyboard shortcuts

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