resources

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: Apache-2.0 Imports: 8 Imported by: 27

Documentation

Index

Constants

View Source
const (
	// AutoSubnetResource is the name of the resource, for storing state.
	AutoSubnetResource = "auto-subnet"
)
View Source
const (
	// AutoVLANResource is the name of the resource, for storing state.
	AutoVLANResource = "auto-vlan"
)
View Source
const (
	// AutoVXLANResource is a string description of the type of resource.
	AutoVXLANResource = "auto-vxlan"
)

Variables

This section is empty.

Functions

func ReleaseStateResourceManager

func ReleaseStateResourceManager()

ReleaseStateResourceManager releases the singleton instance of the state based resource manager

Types

type AutoSubnetCfgResource

type AutoSubnetCfgResource struct {
	core.CommonState
	SubnetPool     net.IP `json:"subnetPool"`
	SubnetPoolLen  uint   `json:"subnetPoolLen"`
	AllocSubnetLen uint   `json:"allocSubnetLen"`
}

AutoSubnetCfgResource is an implementation of core.State and core.Resource for configuration of the subnet.

func (*AutoSubnetCfgResource) Allocate

func (r *AutoSubnetCfgResource) Allocate() (interface{}, error)

Allocate a new subnet. Returns an interface{} which for this method is always SubnetIPLenPair.

func (*AutoSubnetCfgResource) Clear

func (r *AutoSubnetCfgResource) Clear() error

Clear the state

func (*AutoSubnetCfgResource) Deallocate

func (r *AutoSubnetCfgResource) Deallocate(value interface{}) error

Deallocate the resource. Must be passed a SubnetIPLenPair.

func (*AutoSubnetCfgResource) Deinit

func (r *AutoSubnetCfgResource) Deinit()

Deinit the state

func (*AutoSubnetCfgResource) Description

func (r *AutoSubnetCfgResource) Description() string

Description returns a string that describe the type of state.

func (*AutoSubnetCfgResource) Init

func (r *AutoSubnetCfgResource) Init(rsrcCfg interface{}) error

Init the state from configuration.

func (*AutoSubnetCfgResource) Read

func (r *AutoSubnetCfgResource) Read(id string) error

Read the state

func (*AutoSubnetCfgResource) ReadAll

func (r *AutoSubnetCfgResource) ReadAll() ([]core.State, error)

ReadAll state from the resource prefix.

func (*AutoSubnetCfgResource) Write

func (r *AutoSubnetCfgResource) Write() error

Write the state

type AutoSubnetOperResource

type AutoSubnetOperResource struct {
	core.CommonState
	FreeSubnets *bitset.BitSet `json:"freeSubnets"`
}

AutoSubnetOperResource is an implementation of core.State relating to subnets.

func (*AutoSubnetOperResource) Clear

func (r *AutoSubnetOperResource) Clear() error

Clear the state.

func (*AutoSubnetOperResource) Read

func (r *AutoSubnetOperResource) Read(id string) error

Read the state.

func (*AutoSubnetOperResource) ReadAll

func (r *AutoSubnetOperResource) ReadAll() ([]core.State, error)

ReadAll state under the prefix.

func (*AutoSubnetOperResource) Write

func (r *AutoSubnetOperResource) Write() error

Write the state.

type AutoVLANCfgResource

type AutoVLANCfgResource struct {
	core.CommonState
	VLANs *bitset.BitSet `json:"vlans"`
}

AutoVLANCfgResource implements the Resource interface for an 'auto-vlan' resource. 'auto-vlan' resource allocates a vlan from a range of vlan encaps specified at time of resource instantiation

func (*AutoVLANCfgResource) Allocate

func (r *AutoVLANCfgResource) Allocate() (interface{}, error)

Allocate a resource.

func (*AutoVLANCfgResource) Clear

func (r *AutoVLANCfgResource) Clear() error

Clear the state.

func (*AutoVLANCfgResource) Deallocate

func (r *AutoVLANCfgResource) Deallocate(value interface{}) error

Deallocate the resource.

func (*AutoVLANCfgResource) Deinit

func (r *AutoVLANCfgResource) Deinit()

Deinit the resource.

func (*AutoVLANCfgResource) Description

func (r *AutoVLANCfgResource) Description() string

Description is a description of this resource. returns AutoVLANResource.

func (*AutoVLANCfgResource) Init

func (r *AutoVLANCfgResource) Init(rsrcCfg interface{}) error

Init the Resource. Requires a *bitset.BitSet.

func (*AutoVLANCfgResource) Read

func (r *AutoVLANCfgResource) Read(id string) error

Read the state.

func (*AutoVLANCfgResource) ReadAll

func (r *AutoVLANCfgResource) ReadAll() ([]core.State, error)

ReadAll the state for this resource.

func (*AutoVLANCfgResource) Write

func (r *AutoVLANCfgResource) Write() error

Write the state.

type AutoVLANOperResource

type AutoVLANOperResource struct {
	core.CommonState
	FreeVLANs *bitset.BitSet `json:"freeVLANs"`
}

AutoVLANOperResource is an implementation of core.State.

func (*AutoVLANOperResource) Clear

func (r *AutoVLANOperResource) Clear() error

Clear the state.

func (*AutoVLANOperResource) Read

func (r *AutoVLANOperResource) Read(id string) error

Read the state.

func (*AutoVLANOperResource) ReadAll

func (r *AutoVLANOperResource) ReadAll() ([]core.State, error)

ReadAll state for this path.

func (*AutoVLANOperResource) Write

func (r *AutoVLANOperResource) Write() error

Write the state.

type AutoVXLANCfgResource

type AutoVXLANCfgResource struct {
	core.CommonState
	VXLANs     *bitset.BitSet `json:"vxlans"`
	LocalVLANs *bitset.BitSet `json:"LocalVLANs"`
}

AutoVXLANCfgResource implements the Resource interface for an 'auto-vxlan' resource. 'auto-vxlan' resource allocates a vxlan from a range of vxlan encaps specified at time of resource instantiation

func (*AutoVXLANCfgResource) Allocate

func (r *AutoVXLANCfgResource) Allocate() (interface{}, error)

Allocate allocates a new resource.

func (*AutoVXLANCfgResource) Clear

func (r *AutoVXLANCfgResource) Clear() error

Clear the state.

func (*AutoVXLANCfgResource) Deallocate

func (r *AutoVXLANCfgResource) Deallocate(value interface{}) error

Deallocate removes and cleans up a resource.

func (*AutoVXLANCfgResource) Deinit

func (r *AutoVXLANCfgResource) Deinit()

Deinit the resource.

func (*AutoVXLANCfgResource) Description

func (r *AutoVXLANCfgResource) Description() string

Description is a string description of the resource. Returns AutoVXLANResource.

func (*AutoVXLANCfgResource) Init

func (r *AutoVXLANCfgResource) Init(rsrcCfg interface{}) error

Init the resource.

func (*AutoVXLANCfgResource) Read

func (r *AutoVXLANCfgResource) Read(id string) error

Read the state.

func (*AutoVXLANCfgResource) ReadAll

func (r *AutoVXLANCfgResource) ReadAll() ([]core.State, error)

ReadAll reads all the state from the resource.

func (*AutoVXLANCfgResource) Write

func (r *AutoVXLANCfgResource) Write() error

Write the state.

type AutoVXLANOperResource

type AutoVXLANOperResource struct {
	core.CommonState
	FreeVXLANs     *bitset.BitSet `json:"freeVXLANs"`
	FreeLocalVLANs *bitset.BitSet `json:"freeLocalVLANs"`
}

AutoVXLANOperResource is an implementation of core.State

func (*AutoVXLANOperResource) Clear

func (r *AutoVXLANOperResource) Clear() error

Clear the state.

func (*AutoVXLANOperResource) Read

func (r *AutoVXLANOperResource) Read(id string) error

Read the state.

func (*AutoVXLANOperResource) ReadAll

func (r *AutoVXLANOperResource) ReadAll() ([]core.State, error)

ReadAll the state for the given type.

func (*AutoVXLANOperResource) Write

func (r *AutoVXLANOperResource) Write() error

Write the state.

type StateResourceManager

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

StateResourceManager implements the core.ResourceManager interface. It manages the resources in a logically centralized manner using serialized writes to underlying state store.

func GetStateResourceManager

func GetStateResourceManager() (*StateResourceManager, error)

GetStateResourceManager returns the singleton instance of the state based resource manager

func NewStateResourceManager

func NewStateResourceManager(sd core.StateDriver) (*StateResourceManager, error)

NewStateResourceManager instantiates a state based resource manager

func (*StateResourceManager) AllocateResourceVal

func (rm *StateResourceManager) AllocateResourceVal(id, desc string) (interface{},
	error)

AllocateResourceVal yields the core.Resource for the id and description.

func (*StateResourceManager) DeallocateResourceVal

func (rm *StateResourceManager) DeallocateResourceVal(id, desc string,
	value interface{}) error

DeallocateResourceVal removes a value from the resource.

func (*StateResourceManager) DefineResource

func (rm *StateResourceManager) DefineResource(id, desc string,
	rsrcCfg interface{}) error

DefineResource initializes a new resource.

func (*StateResourceManager) Deinit

func (rm *StateResourceManager) Deinit()

Deinit cleans up the resource manager

func (*StateResourceManager) Init

func (rm *StateResourceManager) Init() error

Init initializes the resource manager

func (*StateResourceManager) UndefineResource

func (rm *StateResourceManager) UndefineResource(id, desc string) error

UndefineResource deinitializes a resource.

type SubnetIPLenPair

type SubnetIPLenPair struct {
	IP  net.IP
	Len uint
}

SubnetIPLenPair structurally represents a CIDR notated address.

type VXLANVLANPair

type VXLANVLANPair struct {
	VXLAN uint
	VLAN  uint
}

VXLANVLANPair Pairs a VXLAN tag with a VLAN tag.

Jump to

Keyboard shortcuts

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