namespace

package
v0.0.0-...-3e52749 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefinitionTable is a constant to indicate the inventory operation should be
	// performed against the inventory definition table for the item of interest.
	//
	DefinitionTable TableName = "definition"

	// DefinitionTableStdTest is a constant to indicate the inventory operation should be
	// performed against the test inventory definition table for the standard test
	// inventory for the item of interest.
	//
	DefinitionTableStdTest TableName = "definitionstdtest"

	// ActualTable is a constant to indicate the inventory operation should be
	// performed against the inventory actual state table for the item of interest.
	//
	ActualTable TableName = "actual"

	// ObservedTable is a constant to indicate the inventory operation should be
	// performed against the inventory observed state table for the item of interest.
	//
	ObservedTable TableName = "observed"

	// TargetTable is a constant to indicate the inventory operation should be
	// performed against the inventory target state table for the item of interest.
	//
	TargetTable TableName = "target"

	// InvalidTable is a default value for the case where a TableName in not one
	// of the valid set.
	//
	InvalidTable TableName = ""

	// InvalidRegion is used when a return value is needed for a region but where
	// the value cannot be used in any way other than for comparison.
	//
	InvalidRegion string = ""

	// InvalidZone is used when a return value is needed for a zone but where
	// the value cannot be used in any way other than for comparison.
	//
	InvalidZone string = ""

	// InvalidRack is used when a return value is needed for a rack but where
	// the value cannot be used in any way other than for comparison.
	//
	InvalidRack string = ""

	// InvalidPdu is used when a return value is needed for a pdu but where
	// the value cannot be used in any way other than for comparison.
	//
	InvalidPdu int64 = -1

	// InvalidBlade is used when a return value is needed for a blade but where
	// the value cannot be used in any way other than for comparison.
	//
	InvalidBlade int64 = -1
)

Variables

This section is empty.

Functions

func FullyQualifyName

func FullyQualifyName(table TableName, relativeName string) string

FullyQualifyName applies the table name to the relative key string. It returns a key string that has been specialized to the table name.

func GetKeyForBlade

func GetKeyForBlade(region string, zone string, rack string, blade int64) (string, error)

GetKeyForBlade generates the key to operate on the record for a blade by any specific table (definition, actual, observed, target)

func GetKeyForIndexBlades

func GetKeyForIndexBlades(region string, zone string, rack string) (string, error)

GetKeyForIndexBlades generates the key to discover the list of blades by any specific table (definition, actual, observed, target)

func GetKeyForIndexEntryBlade

func GetKeyForIndexEntryBlade(region string, zone string, rack string, blade int64) (string, error)

GetKeyForIndexEntryBlade generates the key to create an index entry for a blade by any specific table (definition, actual, observed, target)

func GetKeyForIndexEntryPdu

func GetKeyForIndexEntryPdu(region string, zone string, rack string, pdu int64) (string, error)

GetKeyForIndexEntryPdu generates the key to create an index entry for a pdu by any specific table (definition, actual, observed, target)

func GetKeyForIndexEntryRack

func GetKeyForIndexEntryRack(region string, zone string, rack string) (string, error)

GetKeyForIndexEntryRack generates the key to create an index entry for a rack by any specific table (definition, actual, observed, target)

func GetKeyForIndexEntryRegion

func GetKeyForIndexEntryRegion(region string) (string, error)

GetKeyForIndexEntryRegion generates the key to create an index entry for a region by any specific table (definition, actual, observed, target)

func GetKeyForIndexEntryTor

func GetKeyForIndexEntryTor(region string, zone string, rack string, tor int64) (string, error)

GetKeyForIndexEntryTor generates the key to create an index entry for a tor by any specific table (definition, actual, observed, target)

func GetKeyForIndexEntryZone

func GetKeyForIndexEntryZone(region string, zone string) (string, error)

GetKeyForIndexEntryZone generates the key to create an index entry for a zone by any specific table (definition, actual, observed, target)

func GetKeyForIndexPdus

func GetKeyForIndexPdus(region string, zone string, rack string) (string, error)

GetKeyForIndexPdus generates the key to discover the list of pdus by any specific table (definition, actual, observed, target)

func GetKeyForIndexRacks

func GetKeyForIndexRacks(region string, zone string) (string, error)

GetKeyForIndexRacks generates the key to discover the list of racks by any specific table (definition, actual, observed, target)

func GetKeyForIndexRegions

func GetKeyForIndexRegions() string

GetKeyForIndexRegions generates the key to discover the list of regions by any specific table (definition, actual, observed, target)

func GetKeyForIndexTors

func GetKeyForIndexTors(region string, zone string, rack string) (string, error)

GetKeyForIndexTors generates the key to discover the list of tors by any specific table (definition, actual, observed, target)

func GetKeyForIndexZones

func GetKeyForIndexZones(region string) (string, error)

GetKeyForIndexZones generates the key to discover the list of zones by any specific table (definition, actual, observed, target)

func GetKeyForPdu

func GetKeyForPdu(region string, zone string, rack string, pdu int64) (string, error)

GetKeyForPdu generates the key to operate on the record for a pdu by any specific table (definition, actual, observed, target)

func GetKeyForRack

func GetKeyForRack(region string, zone string, rack string) (string, error)

GetKeyForRack generates the key to operate on the record for a rack by any specific table (definition, actual, observed, target)

func GetKeyForRegion

func GetKeyForRegion(region string) (string, error)

GetKeyForRegion generates the key to operate on the record for a region by any specific table (definition, actual, observed, target)

func GetKeyForTor

func GetKeyForTor(region string, zone string, rack string, tor int64) (string, error)

GetKeyForTor generates the key to operate on the record for a tor by any specific table (definition, actual, observed, target)

func GetKeyForZone

func GetKeyForZone(region string, zone string) (string, error)

GetKeyForZone generates the key to operate on the record for a zone by any specific table (definition, actual, observed, target)

func GetKeyFromKeyRootAndName

func GetKeyFromKeyRootAndName(r KeyRoot, n string) string

func GetKeyFromUsername

func GetKeyFromUsername(name string) string

GetKeyFromUsername is a utility function to convert a supplied username to a store usable key for use when operating with user records.

func GetNameFromKeyRootAndKey

func GetNameFromKeyRootAndKey(r KeyRoot, k string) string

func GetNamespacePrefixFromKeyRoot

func GetNamespacePrefixFromKeyRoot(r KeyRoot) string

func GetNormalizedName

func GetNormalizedName(name string) string

GetNormalizedName is a utility function to prepare a name for use when building a key suitable for operating with records in the store

Types

type Address

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

func GetAddressFromKey

func GetAddressFromKey(key string) (*Address, error)

GetAddressFromKey is a function to parse a key string, typically as returned by a watch event and generate a generic address for that string.

Keys follow a number of rules

must contain no spaces use fields separated by a "/" character must begin with either "index" or "data" must contain a second field which is one of the legal table names must contain a set of 1 or more pairs of fields where the first field is the item type and the second field is the item instance. The item type is one of

  • "region"
  • "zone"
  • "rack"
  • "pdu"
  • "tor"
  • "blade"

Item type region, zone, and rack have string instance fields. Item types pdu, tor and blade have integer instance fields

func NewBlade

func NewBlade(table TableName, region string, zone string, rack string, blade int64) *Address

func NewPdu

func NewPdu(table TableName, region string, zone string, rack string, pdu int64) *Address

func NewRack

func NewRack(table TableName, region string, zone string, rack string) *Address

func NewRegion

func NewRegion(table TableName, region string) *Address

func NewTor

func NewTor(table TableName, region string, zone string, rack string, tor int64) *Address

func NewZone

func NewZone(table TableName, region string, zone string) *Address

func (*Address) Blade

func (a *Address) Blade() int64

func (*Address) Pdu

func (a *Address) Pdu() int64

func (*Address) Rack

func (a *Address) Rack() string

func (*Address) Region

func (a *Address) Region() string

func (*Address) String

func (a *Address) String() string

func (*Address) Table

func (a *Address) Table() TableName

func (*Address) Tor

func (a *Address) Tor() int64

func (*Address) Type

func (a *Address) Type() AddressType

func (*Address) Validate

func (a *Address) Validate() error

func (*Address) Zone

func (a *Address) Zone() string

type AddressType

type AddressType int64
const (
	AddressTypeInvalid AddressType = iota
	AddressTypeRegion
	AddressTypeZone
	AddressTypeRack
	AddressTypePdu
	AddressTypeTor
	AddressTypeBlade
)

type KeyRoot

type KeyRoot int

KeyRoot is used to describe which part of the store namespace should be used for the corresponding record access.

const (
	KeyRootStoreTest KeyRoot = iota
	KeyRootUsers
	KeyRootInventory
	KeyRootWorkloads
)

The set of available namespace roots used by various record types

type TableName

type TableName string

func (TableName) NormalizeName

func (t TableName) NormalizeName() string

func (TableName) String

func (t TableName) String() string

type TableNameSet

type TableNameSet interface {
	Definition() TableName
	Actual() TableName
	Observed() TableName
	Target() TableName
}

TableNameSet specifies the table names to use for each of the different views.

func NewTableNameSet

func NewTableNameSet(
	definition TableName,
	actual TableName,
	observed TableName,
	target TableName) (TableNameSet, error)

NewTableNameSet creates a table name set with the specified set of table names for the different views. The table names must not be empty.

Jump to

Keyboard shortcuts

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