Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrVoteAlreadyOngoing is returned if a vote is already going on for the given ID. ErrVoteAlreadyOngoing = errors.New("a vote is already ongoing for the given ID") // ErrNoOpinionGiversAvailable is returned if a round cannot be performed as no opinion gives are available. ErrNoOpinionGiversAvailable = errors.New("can't perform round as no opinion givers are available") )
Functions ¶
Types ¶
type FPC ¶
type FPC struct {
// contains filtered or unexported fields
}
FPC is a DRNGRoundBasedVoter which uses the Opinion of other entities in order to finalize an Opinion.
func New ¶
func New(opinionGiverFunc opinion.OpinionGiverFunc, paras ...*Parameters) *FPC
New creates a new FPC instance.
func (*FPC) IntermediateOpinion ¶
IntermediateOpinion returns the last formed opinion. If the vote is not found for the specified ID, it returns with error ErrVotingNotFound.
type Parameters ¶
type Parameters struct { // The lower bound liked percentage threshold at the first round. Also called 'a'. FirstRoundLowerBoundThreshold float64 // The upper bound liked percentage threshold at the first round. Also called 'b'. FirstRoundUpperBoundThreshold float64 // The lower bound liked percentage threshold used after the first round. SubsequentRoundsLowerBoundThreshold float64 // The upper bound liked percentage threshold used after the first round. SubsequentRoundsUpperBoundThreshold float64 // The amount of opinions to query on each round for a given vote context. Also called 'k'. QuerySampleSize int // The amount of rounds a vote context's opinion needs to stay the same to be considered final. Also called 'l'. FinalizationThreshold int // The amount of rounds for which to ignore any finalization checks for. Also called 'm'. CoolingOffPeriod int // The max amount of rounds to execute per vote context before aborting them. MaxRoundsPerVoteContext int // The max amount of time a query is allowed to take. QueryTimeout time.Duration }
Parameters define the parameters of an FPC instance.
func DefaultParameters ¶
func DefaultParameters() *Parameters
DefaultParameters returns the default parameters used in FPC.
Click to show internal directories.
Click to hide internal directories.