metering

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 token id 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