quota

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Normal operation: consumers allocated/deallocated; tree updates in cache
	Normal = iota
	// Maintenance operation: consumers forced allocated; tree updates in cache
	Maintenance
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumerInfo

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

ConsumerInfo : A consumer model including specifications

func NewConsumerInfo

func NewConsumerInfo(consumerStruct utils.JConsumer) (*ConsumerInfo, error)

NewConsumerInfo : create a new ConsumerInfo from Json struct

func NewConsumerInfoFromFile

func NewConsumerInfoFromFile(consumerFileName string) (*ConsumerInfo, error)

NewConsumerInfoFromFile : create a new ConsumerInfo from Json file

func NewConsumerInfoFromString

func NewConsumerInfoFromString(consumerString string) (*ConsumerInfo, error)

NewConsumerInfoFromString : create a new ConsumerInfo from Json string

func (*ConsumerInfo) CreateForestConsumer

func (ci *ConsumerInfo) CreateForestConsumer(forestName string, resourceNames map[string][]string) (*core.ForestConsumer, error)

CreateForestConsumer : create a forest consumer for a given forest

func (*ConsumerInfo) CreateTreeConsumer

func (ci *ConsumerInfo) CreateTreeConsumer(treeName string, resourceNames []string) (*core.Consumer, error)

CreateTreeConsumer : create a tree consumer for a given tree

func (*ConsumerInfo) GetID

func (ci *ConsumerInfo) GetID() string

GetID : get the ID of the consumer

func (*ConsumerInfo) String

func (ci *ConsumerInfo) String() string

String : a print out of the consumer info

type Manager

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

Manager : A quota manager of quota trees; This should be the main interface to quota management

func NewManager

func NewManager() *Manager

NewManager : create a new quota manager

func (*Manager) AddConsumer

func (m *Manager) AddConsumer(consumerInfo *ConsumerInfo) (bool, error)

AddConsumer : add a consumer info

func (*Manager) AddForest

func (m *Manager) AddForest(forestName string) error

AddForest : add a new forest

func (*Manager) AddTreeByName

func (m *Manager) AddTreeByName(treeName string) (string, error)

AddTreeByName : add an empty tree with a given name

func (*Manager) AddTreeFromString

func (m *Manager) AddTreeFromString(treeSring string) (string, error)

AddTreeFromString : add a quota tree from the string JSON representation of the tree

func (*Manager) AddTreeFromStruct

func (m *Manager) AddTreeFromStruct(jQuotaTree utils.JQuotaTree) (string, error)

AddTreeFromStruct : add a quota tree from the JSON struct of the tree

func (*Manager) AddTreeToForest

func (m *Manager) AddTreeToForest(forestName string, treeName string) error

AddTreeToForest : add an already defined tree to a forest

func (*Manager) Allocate

func (m *Manager) Allocate(treeName string, consumerID string) (response *core.AllocationResponse, err error)

Allocate : allocate a consumer on a tree

func (*Manager) AllocateForest

func (m *Manager) AllocateForest(forestName string, consumerID string) (response *core.AllocationResponse, err error)

AllocateForest : allocate a consumer on a forest

func (*Manager) DeAllocate

func (m *Manager) DeAllocate(treeName string, consumerID string) bool

DeAllocate : de-allocate a consumer from a tree

func (*Manager) DeAllocateForest

func (m *Manager) DeAllocateForest(forestName string, consumerID string) bool

DeAllocateForest : de-allocate a consumer from a forest

func (*Manager) DeleteForest

func (m *Manager) DeleteForest(forestName string) error

DeleteForest : delete a forest

func (*Manager) DeleteTree

func (m *Manager) DeleteTree(treeName string) error

DeleteTree : delete a quota tree

func (*Manager) DeleteTreeFromForest

func (m *Manager) DeleteTreeFromForest(forestName string, treeName string) error

DeleteTreeFromForest : delete a tree from a forest

func (*Manager) GetAllConsumerIDs

func (m *Manager) GetAllConsumerIDs() []string

GetAllConsumerIDs : get IDs of all consumers added

func (*Manager) GetForestController added in v1.34.0

func (m *Manager) GetForestController(forestName string) *core.ForestController

GetForestController : get the forest controller for a given forest

func (*Manager) GetForestNames

func (m *Manager) GetForestNames() []string

GetForestNames : get the names of all forests

func (*Manager) GetForestTreeNames

func (m *Manager) GetForestTreeNames() map[string][]string

GetForestTreeNames : get the tree names for all forests

func (*Manager) GetMode

func (m *Manager) GetMode() Mode

GetMode : get the mode of the quota manager

func (*Manager) GetModeString

func (m *Manager) GetModeString() string

GetMode : get the mode of the quota manager

func (*Manager) GetTreeCache

func (m *Manager) GetTreeCache(treeName string) *core.TreeCache

GetTreeCache : get the tree cache corresponding to a tree; nil if does not exist

func (*Manager) GetTreeController added in v1.34.0

func (m *Manager) GetTreeController(treeName string) *core.Controller

GetTreeController : get the tree controller for a given tree

func (*Manager) GetTreeNames

func (m *Manager) GetTreeNames() []string

GetTreeNames : get the names of all the trees

func (*Manager) IsAllocated

func (m *Manager) IsAllocated(treeName string, consumerID string) bool

IsAllocated : check if a consumer is allocated on a tree

func (*Manager) IsAllocatedForest

func (m *Manager) IsAllocatedForest(forestName string, consumerID string) bool

IsAllocatedForest : check if a consumer is allocated on a forest

func (*Manager) RemoveConsumer

func (m *Manager) RemoveConsumer(consumerID string) (bool, error)

RemoveConsumer : remove a consumer info, does not de-allocate any currently allocated consumers

func (*Manager) SetMode

func (m *Manager) SetMode(mode Mode) bool

SetMode : set the mode of the quota manager

func (*Manager) String

func (m *Manager) String() string

String : printout

func (*Manager) TryAllocate added in v1.34.0

func (m *Manager) TryAllocate(treeName string, consumerID string) (response *core.AllocationResponse, err error)

TryAllocate : try allocating a consumer on a tree

func (*Manager) TryAllocateForest added in v1.34.0

func (m *Manager) TryAllocateForest(forestName string, consumerID string) (response *core.AllocationResponse, err error)

TryAllocateForest : allocate a consumer on a forest

func (*Manager) UndoAllocate added in v1.34.0

func (m *Manager) UndoAllocate(treeName string, consumerID string) (err error)

UndoAllocate : undo the most recent allocation trial on a tree

func (*Manager) UndoAllocateForest added in v1.34.0

func (m *Manager) UndoAllocateForest(forestName string, consumerID string) (err error)

UndoAllocate : undo the most recent allocation trial on a tree

func (*Manager) UpdateAll

func (m *Manager) UpdateAll() (treeUnallocatedConsumerIDs map[string][]string,
	treeResponse map[string]*core.TreeCacheCreateResponse,
	forestUnallocatedConsumerIDs map[string][]string,
	forestResponse map[string]map[string]*core.TreeCacheCreateResponse,
	err error)

UpdateAll : update all trees and forests from caches

func (*Manager) UpdateForest

func (m *Manager) UpdateForest(forestName string) (unallocatedConsumerIDs []string,
	response map[string]*core.TreeCacheCreateResponse, err error)

UpdateForest : update forest from cache

func (*Manager) UpdateTree

func (m *Manager) UpdateTree(treeName string) (unallocatedConsumerIDs []string, response *core.TreeCacheCreateResponse, err error)

UpdateTree : update tree from cache

type Mode

type Mode int

Mode : the mode of a quota tree

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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