Documentation
¶
Index ¶
- type MockedVotePower
- type Opinion
- type TestFramework
- func (t *TestFramework) CreateValidator(alias string, weight int64)
- func (t *TestFramework) CreateValidatorWithID(alias string, id identity.ID, weight int64, skipWeightUpdate ...bool)
- func (t *TestFramework) Validator(alias string) (v identity.ID)
- func (t *TestFramework) ValidatorsSet(aliases ...string) (validators *advancedset.AdvancedSet[identity.ID])
- type Vote
- func (v *Vote[ConflictIDType, VotePowerType]) WithConflictID(conflictID ConflictIDType) (voteWithConflictID *Vote[ConflictIDType, VotePowerType])
- func (v *Vote[ConflictIDType, VotePowerType]) WithOpinion(opinion Opinion) (voteWithOpinion *Vote[ConflictIDType, VotePowerType])
- func (v *Vote[ConflictIDType, VotePowerType]) WithVotePower(power VotePowerType) (voteWithOpinion *Vote[ConflictIDType, VotePowerType])
- type Votes
- func (v *Votes[ConflictIDType, VotePowerType]) Add(vote *Vote[ConflictIDType, VotePowerType]) (added bool, opinionChanged bool)
- func (v *Votes[ConflictIDType, VotePowerType]) Delete(vote *Vote[ConflictIDType, VotePowerType]) (deleted bool)
- func (v *Votes[ConflictIDType, VotePowerType]) Vote(voter identity.ID) (vote *Vote[ConflictIDType, VotePowerType], exists bool)
- func (v *Votes[ConflictIDType, VotePowerType]) Voters() (voters *advancedset.AdvancedSet[identity.ID])
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockedVotePower ¶
type MockedVotePower struct {
VotePower int
}
func (MockedVotePower) Compare ¶
func (p MockedVotePower) Compare(other MockedVotePower) int
type Opinion ¶
type Opinion uint8
Opinion is a type that represents the Opinion of a node on a certain Conflict.
type TestFramework ¶
type TestFramework struct {
Validators *sybilprotection.WeightedSet
// contains filtered or unexported fields
}
func NewTestFramework ¶
func NewTestFramework(test *testing.T, validators *sybilprotection.WeightedSet) *TestFramework
NewTestFramework is the constructor of the TestFramework.
func (*TestFramework) CreateValidator ¶
func (t *TestFramework) CreateValidator(alias string, weight int64)
func (*TestFramework) CreateValidatorWithID ¶
func (*TestFramework) ValidatorsSet ¶
func (t *TestFramework) ValidatorsSet(aliases ...string) (validators *advancedset.AdvancedSet[identity.ID])
type Vote ¶
type Vote[ConflictIDType comparable, VotePowerType constraints.Comparable[VotePowerType]] struct { Voter identity.ID ConflictID ConflictIDType Opinion Opinion VotePower VotePowerType }
func NewVote ¶
func NewVote[ConflictIDType comparable, VotePowerType constraints.Comparable[VotePowerType]](voter identity.ID, votePower VotePowerType, opinion Opinion) (voteWithOpinion *Vote[ConflictIDType, VotePowerType])
NewVote derives a Vote for th.
func (*Vote[ConflictIDType, VotePowerType]) WithConflictID ¶
func (v *Vote[ConflictIDType, VotePowerType]) WithConflictID(conflictID ConflictIDType) (voteWithConflictID *Vote[ConflictIDType, VotePowerType])
WithConflictID derives a vote for the given ConflictID.
func (*Vote[ConflictIDType, VotePowerType]) WithOpinion ¶
func (v *Vote[ConflictIDType, VotePowerType]) WithOpinion(opinion Opinion) (voteWithOpinion *Vote[ConflictIDType, VotePowerType])
WithOpinion derives a vote for the given Opinion.
func (*Vote[ConflictIDType, VotePowerType]) WithVotePower ¶
func (v *Vote[ConflictIDType, VotePowerType]) WithVotePower(power VotePowerType) (voteWithOpinion *Vote[ConflictIDType, VotePowerType])
WithVotePower derives a vote for the given VotePower.
type Votes ¶
type Votes[ConflictIDType comparable, VotePowerType constraints.Comparable[VotePowerType]] struct { // contains filtered or unexported fields }
func NewVotes ¶
func NewVotes[ConflictIDType comparable, VotePowerType constraints.Comparable[VotePowerType]]() *Votes[ConflictIDType, VotePowerType]
func (*Votes[ConflictIDType, VotePowerType]) Voters ¶
func (v *Votes[ConflictIDType, VotePowerType]) Voters() (voters *advancedset.AdvancedSet[identity.ID])
Click to show internal directories.
Click to hide internal directories.