qos

package
v0.0.0-...-711078c Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(iom *IOMap)

Setup ... This associates the IOMap with rest endpoints

Types

type ByteLimit

type ByteLimit struct {
	Bytes    uint64
	Limit    uint64
	Mutex    *sync.RWMutex
	Notifier *sync.Cond
}

ByteLimit ... Controls how many bytes can be consumed

func (*ByteLimit) Available

func (bl *ByteLimit) Available() uint64

Available ... Returns the amoutn of bytes that are still available

func (*ByteLimit) Reset

func (bl *ByteLimit) Reset()

Reset ... This will reset the allocation of bytes (should get run at the end of every duration)

type IOC

type IOC struct {
	Mutex    sync.RWMutex
	Notifier *sync.Cond
	// contains filtered or unexported fields
}

IOC Input / Ouput Constraint

func NewIOC

func NewIOC(duration time.Duration, rLimit, wLimit uint64) *IOC

NewIOC ... Create a new IOC

func (*IOC) Active

func (ioc *IOC) Active() bool

Active ... Check to see if there is already a goroutine running checks

func (*IOC) Checkout

func (ioc *IOC) Checkout(bl *ByteLimit, requested uint64, stream chan uint64) error

Checkout ... quick way to get a stream of bytes

func (*IOC) CheckoutRead

func (ioc *IOC) CheckoutRead(requested uint64, stream chan uint64) error

CheckoutRead ... gets a read

func (*IOC) CheckoutWrite

func (ioc *IOC) CheckoutWrite(requested uint64, stream chan uint64) error

CheckoutWrite ... gets a stream ow writes

func (*IOC) Start

func (ioc *IOC) Start()

Start ...start wil provision out bytes as needed

func (*IOC) Stop

func (ioc *IOC) Stop()

Stop ... This top the goroutine

func (*IOC) Update

func (ioc *IOC) Update(duration time.Duration, read, write uint64)

Update ... changes duration and read

type IOMap

type IOMap struct {
	Map   map[string]*IOC
	Mutex sync.RWMutex
}

IOMap ... Mapping of key to IOC

func LoadIOCConfig

func LoadIOCConfig(f io.Reader) *IOMap

LoadIOCConfig ... Takes an io.Reader expecting csv file and returns a *IOMap

func NewIOMap

func NewIOMap() *IOMap

NewIOMap ... Creates a new IOMap with default params

func (*IOMap) Add

func (iom *IOMap) Add(key string, duration time.Duration, read, write uint64)

Add ... Add a IOC with a specific key to the map

func (*IOMap) FindPath

func (iom *IOMap) FindPath(p string) *IOC

FindPath ... Search the keys space for first path to match

func (*IOMap) Get

func (iom *IOMap) Get(key string) (*IOC, bool)

Get ... Retrieve based on a key

func (*IOMap) Remove

func (iom *IOMap) Remove(key string)

Remove ... Remove a key

func (*IOMap) Update

func (iom *IOMap) Update(key string, duration time.Duration, read, write uint64)

Update ... Update existing entry

type Rest

type Rest struct {
	// contains filtered or unexported fields
}

Rest ... Structure that should make it easier to modify an IOMap mount at runtime

func NewRest

func NewRest(m *IOMap) *Rest

NewRest ... Create an new instance of the Rest struct

func (*Rest) Default

func (r *Rest) Default(w http.ResponseWriter, req *http.Request)

Default ... Default handler for a mounted system

Jump to

Keyboard shortcuts

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