metering

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Credits added in v1.4.0

func Credits(email string) (int, bool)

Credits by email

Types

type Meter

type Meter struct {
	ID string
	// contains filtered or unexported fields
}

Meter will keep track of resources for a given minion or daemon

func NewMeter

func NewMeter(id string, token string, expiration int, credits int) (*Meter, error)

NewMeter returns a new Meter for the given token Database is structured as follows: Each token has a Bucket with the email as name. Each Bucket has the following properties: * Credits

func (*Meter) Credits

func (m *Meter) Credits() (int, error)

Credits returns the remaining credits for the meter

func (*Meter) Inspect

func (m *Meter) Inspect() (*Status, error)

Inspect returns the status of the meter, incl: * Credits - the remaining credits

func (*Meter) Record

func (m *Meter) Record(credits int) error

Record will record the usage of the given amount of credits

type Status

type Status struct {
	Credits int
}

Status contains information about the current status of the resources of a token

Jump to

Keyboard shortcuts

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