rate

package
v0.0.0-...-a467797 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

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