score

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Max float64 = 9007199254740992

TODO: keeping these as variables to get their reference and use less memory. Is this really necessary? TODO: benchmark this

View Source
var Min float64 = 0
View Source
var Undefined float64 = -1

Functions

func GetAddScore

func GetAddScore(addRequestScore float64) float64

Results in the score to be used when a new message is added to the queue

requestScore: the requested score for the message

If the requestScore is 0, the value will be set with the current timestamp in milliseconds.

The maximum score accepted by Deckard is 9007199254740992 and the minimum is 0, so the requestScore will be capped to these values.

Negative scores are not allowed and will be converted to 0

func GetPullMaxScore

func GetPullMaxScore(score float64) *float64

GetPullMaxScore returns the upper threshold priority filter for a pull request. If the score is zero, it returns nil. If the score is greater than Max, it returns Max. If the score is less than Min, it returns Min. Otherwise, it returns the score.

func GetPullMinScore

func GetPullMinScore(score float64) *float64

GetPullMinScore returns the lower threshold priority filter for a pull request. If the score is zero, it returns nil. If the score is less than or equal to Min, it returns Min. If the score is greater than Max, it returns Max. Otherwise, it returns the score.

func GetScoreByDefaultAlgorithm

func GetScoreByDefaultAlgorithm() float64

GetScoreByDefaultAlgorithm returns the score using the default algorithm. The default score is the current timestamp in milliseconds.

func GetScoreFromTime

func GetScoreFromTime(time *time.Time) float64

GetScoreFromTime returns the score for a given time. The score is milliseconds representation of the time.

func IsUndefined

func IsUndefined(score float64) bool

IsUndefined returns true if the score is equal to Undefined A score is undefined if it is equal to -1

Types

This section is empty.

Jump to

Keyboard shortcuts

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