Documentation ¶
Overview ¶
Package rate contains functionality to deal with rates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a rate controller.
func NewController ¶
func NewController(rate float64, per time.Duration) *Controller
NewController creates a new Controller.
func (*Controller) Heartbeat ¶
func (c *Controller) Heartbeat() time.Duration
Heartbeat returns a duration between two pathways based on rate and per values. If the rate is set to zero, returns the maximum duration value.
func (*Controller) InitialElapsed ¶
func (c *Controller) InitialElapsed() time.Duration
InitialElapsed returns a value of the heartbeat, if the rate is not zero. Otherwise, returns zero.
func (*Controller) RateChanged ¶
func (c *Controller) RateChanged() <-chan bool
RateChanged returns a channel, where the changes of the rate are signaled.
func (*Controller) ServeHTTP ¶
func (c *Controller) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles the requests made from the slider on the control dashboard.
Click to show internal directories.
Click to hide internal directories.