inventory

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultRegion is used to provide a value for the non-existing region name
	// while the transition to the new inventory extended schema continues.
	// Eventually these will disappear as the front-end and higher layers learn
	// abouts regions, zones, multiple pdus and tors.
	//
	DefaultRegion = "standard"

	// DefaultZone is used to provide a value for the non-existing zone name
	// while the transition to the new inventory extended schema continues.
	// Eventually these will disappear as the front-end and higher layers learn
	// abouts regions, zones, multiple pdus and tors.
	//
	DefaultZone = "standard"
)

Variables

This section is empty.

Functions

func ReadInventoryDefinitionFromFile

func ReadInventoryDefinitionFromFile(ctx context.Context, path string) (*pb.Definition_Root, error)

ReadInventoryDefinitionFromFile imports the inventory from an external YAML file and transforms it into the internal Cloud chamber binary format.

Types

type ActualCabledViewOperations

type ActualCabledViewOperations interface {
	ActualLeafViewOperations

	GetCables() map[int64]*inventory.Cable
	SetCables(cables map[int64]*inventory.Cable)
}

type ActualLeafViewOperations

type ActualLeafViewOperations interface {
	GetCondition() inventory.Condition
	SetCondition(cond inventory.Condition)
	GetCore() *inventory.MachineCore
	SetCore(item *inventory.MachineCore)
}

type Blade

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

Blade is a structure representing a blade object. This object can be used to operate on the associated blade records in the underlying store. The object can hold information fetched from the underlying store, or as a staging area in preparation for updates to the store.

Blade is a specialization of a child object for a rack parent.

func (*Blade) Actual

func (b *Blade) Actual() BladeViewActualOperations

Actual returns the 'actual' view for this instance. Like Definition, the view is created on first access, and retained throughout the lifecycle of the blade instance.

func (*Blade) Definition

func (b *Blade) Definition() BladeViewDefinitionOperations

Definition returns the 'definition' view for this instance. It is created on first access, and then retained throughout the lifespan of the blade instance.

func (*Blade) Moniker

func (b *Blade) Moniker() string

func (*Blade) Observed

func (b *Blade) Observed() BladeViewObservedOperations

Observed returns the 'observed' view for this instance. This is last state seen by the simulated controller. Structurally, the observed views are the actual views with an additional timestamp recording when that data was seen by the controller.

Finally, like Definition, the view is created on first access, and retained throughout the lifecycle of the blade instance.

type BladeOperations

type BladeOperations interface {
	Moniker() string
	Definition() BladeViewDefinitionOperations
	Actual() BladeViewActualOperations
	Observed() BladeViewObservedOperations
}

type BladeViewActual

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

BladeViewActual is a struct that contains the data that is specific to the 'actual' state of a blade instance: from the table/key path through to the view-specific data fields.

func (*BladeViewActual) Equal

func (b *BladeViewActual) Equal(x *pb.Actual_Blade) bool

Equal is used to provide a simple equality check that is used to determine if the current view matches the supplied actual state. Typically, this is used when looking to see if the record has been changed.

func (*BladeViewActual) GetAllUsage

func (b *BladeViewActual) GetAllUsage() map[string]*pb.Usage

GetAllUsage returns the full set of workload usage requirements.

func (*BladeViewActual) GetAvail

func (b *BladeViewActual) GetAvail() *pb.BladeCapacity

GetAvail returns the available (unused) capacity for the blade.

func (*BladeViewActual) GetState

func (b *BladeViewActual) GetState() pb.BladeState_SM

GetState returns the identifier for the blade state machine state held in this view.

func (*BladeViewActual) GetStoreData

func (b *BladeViewActual) GetStoreData() *pb.Actual_Blade

GetStoreData returns a copy of the blade's actual state based on the contents of the current object.

func (*BladeViewActual) GetTimer

func (b *BladeViewActual) GetTimer() *pb.ActiveTimer

GetTimer returns the deadline information if a timer was active at the time the state was stored, or nil, if no timer was active.

func (*BladeViewActual) GetUsage

func (b *BladeViewActual) GetUsage(id string) *pb.Usage

GetUsage returns the workload usage for the workload specified by the id parameter. If the workload is not found, a nil is returned.

func (*BladeViewActual) NotEqual

func (b *BladeViewActual) NotEqual(x *pb.Actual_Blade) bool

NotEqual is used to provide a simple equality check that is used to determine if the current view matches the supplied actual state. Typically, this is used when looking to see if the record has been changed.

func (*BladeViewActual) RemoveUsage

func (b *BladeViewActual) RemoveUsage(id string) bool

RemoveUsage removes the usage requirements for the workload specified by the id parameter. This function returns true if the workload was found; false if it was not.

func (*BladeViewActual) SetAllUsage

func (b *BladeViewActual) SetAllUsage(usages map[string]*pb.Usage)

SetAllUsage stores the full set of workload usage requirements.

func (*BladeViewActual) SetAvail

func (b *BladeViewActual) SetAvail(value *pb.BladeCapacity)

SetAvail sets the available (unused) capacity for the blade.

func (*BladeViewActual) SetState

func (b *BladeViewActual) SetState(state pb.BladeState_SM)

SetState sets the stored state machine state identifier to the supplied value.

func (*BladeViewActual) SetTimer

func (b *BladeViewActual) SetTimer(t *pb.ActiveTimer)

SetTimer sets the deadline for a timer that should be saved for later restoration, or nil, if no such timer is active.

func (*BladeViewActual) SetUsage

func (b *BladeViewActual) SetUsage(id string, usage *pb.Usage)

SetUsage sets the usage requirements for the supplied workload id.

type BladeViewDefinition

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

BladeViewDefinition is a struct that contains the data that is specific to the 'definition' state of a blade instance: from the table/key path through to the view-specific data fields.

func (*BladeViewDefinition) Equal

Equal is used to provide a simple equality check that is used to determine if the current blade matches the supplied definition. Typically, it is used when looking to see if the record has been changed.

func (*BladeViewDefinition) GetBootInfo

func (b *BladeViewDefinition) GetBootInfo() *pb.BladeBootInfo

GetBootInfo is used to extract the boot information from the object. The boot information must have been previously read from the store (see the Read() method) or attached via a SetBootInfo() call.

May return nil if there are no boot information currently held in the object.

func (*BladeViewDefinition) GetBootOnPowerOn

func (b *BladeViewDefinition) GetBootOnPowerOn() bool

GetBootOnPowerOn returns a new copy of the BootOnPowerOn field within the blade object.

func (*BladeViewDefinition) GetCapacity

func (b *BladeViewDefinition) GetCapacity() *pb.BladeCapacity

GetCapacity is used to extract the capacity information from the object. The capacity information must have been previously read from the store (see the Read() method) or attached via a SetCapacity() call.

May return nil if there are no capacity information currently held in the object.

func (*BladeViewDefinition) GetDetails

func (b *BladeViewDefinition) GetDetails() *pb.BladeDetails

GetDetails is used to extract the attribute information from the object. The attribute information must have been previously read from the store (see the Read() method) or attached via a SetDetails() call.

May return nil if there are no attributes currently held in the object.

func (*BladeViewDefinition) GetStoreData

func (b *BladeViewDefinition) GetStoreData() *pb.Definition_Blade

GetStoreData returns a copy of the blade definition based on the contents of the current object.

func (*BladeViewDefinition) NotEqual

func (b *BladeViewDefinition) NotEqual(d *pb.Definition_Blade) bool

NotEqual is used to provide a simple equality check that is used to determine if the current blade matches the supplied definition. Typically, it is used when looking to see if the record has been changed.

func (*BladeViewDefinition) SetBootInfo

func (b *BladeViewDefinition) SetBootInfo(bootInfo *pb.BladeBootInfo)

SetBootInfo is used to attach some boot information to the object.

The boot information is not persisted to the store until an Update() call is made.

The current revision of the blade object is reset

func (*BladeViewDefinition) SetBootPowerOn

func (b *BladeViewDefinition) SetBootPowerOn(bootOnPowerOn bool)

SetBootPowerOn is used to set the boot power on flag

func (*BladeViewDefinition) SetCapacity

func (b *BladeViewDefinition) SetCapacity(capacity *pb.BladeCapacity)

SetCapacity is used to attach some capacity information to the object.

The capacity information is not persisted to the store until an Update() call is made.

The current revision of the blade object is reset

func (*BladeViewDefinition) SetDetails

func (b *BladeViewDefinition) SetDetails(details *pb.BladeDetails)

SetDetails is used to attach some attribute information to the object.

The attribute information is not persisted to the store until an Update() call is made.

The current revision of the blade object is reset

type BladeViewDefinitionOperations

type BladeViewDefinitionOperations interface {
	ItemStoreOperations
	KeyProvider

	SetDetails(details *inventory.BladeDetails)
	GetDetails() *inventory.BladeDetails
	SetCapacity(capacity *inventory.BladeCapacity)
	GetCapacity() *inventory.BladeCapacity
	SetBootInfo(bootInfo *inventory.BladeBootInfo)
	GetBootInfo() *inventory.BladeBootInfo
	SetBootPowerOn(bootOnPowerOn bool)
	GetBootOnPowerOn() bool
	GetStoreData() *inventory.Definition_Blade
	Equal(d *inventory.Definition_Blade) bool
	NotEqual(d *inventory.Definition_Blade) bool
}

type BladeViewObserved

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

BladeViewObserved is a struct that holds the information related to the observed view for a blade.

func (*BladeViewObserved) Equal

func (b *BladeViewObserved) Equal(x *pb.Observed_Blade) bool

Equal returns true if the fields in the store form of the observed state match the fields in this instance.

func (*BladeViewObserved) GetAllUsage

func (b *BladeViewObserved) GetAllUsage() map[string]*pb.Usage

GetAllUsage returns the full set of workload usage requirements.

func (*BladeViewObserved) GetAvail

func (b *BladeViewObserved) GetAvail() *pb.BladeCapacity

GetAvail returns the available (unused) capacity for the blade.

func (*BladeViewObserved) GetLastGoodObservation

func (b *BladeViewObserved) GetLastGoodObservation() int64

func (*BladeViewObserved) GetObservationFailedReason

func (b *BladeViewObserved) GetObservationFailedReason() string

func (*BladeViewObserved) GetObservedAt

func (b *BladeViewObserved) GetObservedAt() int64

GetObservedAt returns the simulated time when the observed state was recorded.

func (*BladeViewObserved) GetState

func (b *BladeViewObserved) GetState() pb.BladeState_SM

GetState returns the identifier for the blade state machine state held in this view.

func (*BladeViewObserved) GetStoreData

func (b *BladeViewObserved) GetStoreData() *pb.Observed_Blade

GetStoreData returns the store form of the observed state.

func (*BladeViewObserved) GetTimer

func (b *BladeViewObserved) GetTimer() *pb.ActiveTimer

GetTimer returns the deadline information if a timer was active at the time the state was stored, or nil, if no timer was active.

func (*BladeViewObserved) GetUsage

func (b *BladeViewObserved) GetUsage(id string) *pb.Usage

GetUsage returns the workload usage for the workload specified by the id parameter. If the workload is not found, a nil is returned.

func (*BladeViewObserved) NotEqual

func (b *BladeViewObserved) NotEqual(x *pb.Observed_Blade) bool

NotEqual returns true if any field in the supplied store form of the observed state does not match the equivalent field in this instance.

func (*BladeViewObserved) Observe

func (b *BladeViewObserved) Observe(at int64, actual *pb.Actual_Blade)

Observe is a function that updates the observed state with a snapshot of the stored actual state, marked as happening at the supplied time.

func (*BladeViewObserved) ObserveFailed

func (b *BladeViewObserved) ObserveFailed(at int64, reason string)

func (*BladeViewObserved) RemoveUsage

func (b *BladeViewObserved) RemoveUsage(id string) bool

RemoveUsage removes the usage requirements for the workload specified by the id parameter. This function returns true if the workload was found; false if it was not.

func (*BladeViewObserved) SetAllUsage

func (b *BladeViewObserved) SetAllUsage(usages map[string]*pb.Usage)

SetAllUsage stores the full set of workload usage requirements.

func (*BladeViewObserved) SetAvail

func (b *BladeViewObserved) SetAvail(value *pb.BladeCapacity)

SetAvail sets the available (unused) capacity for the blade.

func (*BladeViewObserved) SetLastGoodObservation

func (b *BladeViewObserved) SetLastGoodObservation(at int64)

func (*BladeViewObserved) SetObservationFailedReason

func (b *BladeViewObserved) SetObservationFailedReason(x string)

func (*BladeViewObserved) SetObservedAt

func (b *BladeViewObserved) SetObservedAt(at int64)

SetObservedAt sets the simulated time for when the observed time was seen.

func (*BladeViewObserved) SetState

func (b *BladeViewObserved) SetState(state pb.BladeState_SM)

SetState sets the stored state machine state identifier to the supplied value.

func (*BladeViewObserved) SetTimer

func (b *BladeViewObserved) SetTimer(t *pb.ActiveTimer)

SetTimer sets the deadline for a timer that should be saved for later restoration, or nil, if no such timer is active.

func (*BladeViewObserved) SetUsage

func (b *BladeViewObserved) SetUsage(id string, usage *pb.Usage)

SetUsage sets the usage requirements for the supplied workload id.

type BladeViewRunStateOperations

type BladeViewRunStateOperations interface {
	GetState() inventory.BladeState_SM
	SetState(state inventory.BladeState_SM)
	GetTimer() *inventory.ActiveTimer
	SetTimer(t *inventory.ActiveTimer)
	GetAvail() *inventory.BladeCapacity
	SetAvail(value *inventory.BladeCapacity)
	GetUsage(id string) *inventory.Usage
	SetUsage(id string, usage *inventory.Usage)
	RemoveUsage(id string) bool
	GetAllUsage() map[string]*inventory.Usage
	SetAllUsage(usages map[string]*inventory.Usage)
}

type Inventory

type Inventory struct {
	Store              store.Operations
	RootSummary        *RootSummary
	DefaultZoneSummary *ZoneSummary
	// contains filtered or unexported fields
}

Inventory is a structure used to established synchronized access to values required to make use of the inventory layer.

func NewInventory

func NewInventory(cfg *config.GlobalConfig, store store.Operations, tables namespace.TableNameSet) *Inventory

NewInventory is a helper routine to construct an empty Inventory structure as a convenience to avoid clients having to do all the details themselves.

func (*Inventory) DeleteInventoryDefinition

func (m *Inventory) DeleteInventoryDefinition(ctx context.Context) error

DeleteInventoryDefinition is a

func (*Inventory) GetDefaultZoneSummary

func (m *Inventory) GetDefaultZoneSummary() *ZoneSummary

GetDefaultZoneSummary returns the maximum number of blades held in any rack in the inventory.

func (*Inventory) NewBlade

func (m *Inventory) NewBlade(region string, zone string, rack string, id int64) (*Blade, error)

NewBlade is a convenience function used to construct a Blade object from scratch rather than relative to its parent.

func (*Inventory) NewPdu

func (m *Inventory) NewPdu(region string, zone string, rack string, id int64) (*Pdu, error)

NewPdu is a convenience function used to construct a Pdu object from scratch rather than relative to its parent.

func (*Inventory) NewRack

func (m *Inventory) NewRack(region string, zone string, rack string) (*Rack, error)

NewRack is a convenience function used to construct a Rack object from scratch rather than relative to its parent.

func (*Inventory) NewRegion

func (m *Inventory) NewRegion(region string) (*Region, error)

NewRegion is a convenience function used to construct a Region object from scratch rather than relative to its parent.

func (*Inventory) NewRoot

func (m *Inventory) NewRoot() *Root

NewRoot returns a root object which acts as a well-known point in a namespace and which can be used to navigate the namespace for a given table.

Valid tables are

  • DefinitionTable
  • ActualTable
  • ObservedTable
  • TargetTable

func (*Inventory) NewTor

func (m *Inventory) NewTor(region string, zone string, rack string, id int64) (*Tor, error)

NewTor is a convenience function used to construct a Tor object from scratch rather than relative to its parent.

func (*Inventory) NewZone

func (m *Inventory) NewZone(region string, zone string) (*Zone, error)

NewZone is a convenience function used to construct a Zone object from scratch rather than relative to its parent.

func (*Inventory) Start

func (m *Inventory) Start(ctx context.Context) error

Start is a function to get the inventory ready for use.

func (*Inventory) UpdateInventoryDefinition

func (m *Inventory) UpdateInventoryDefinition(ctx context.Context, path string) error

UpdateInventoryDefinition is a method to load a new inventory definition from the configured file. Once read, the store will be updated with the differences which will in turn trigger a set of previously established watch routines to issue a number of arrival and/or departure notifications.

type ItemStoreOperations

type ItemStoreOperations interface {
	Create(ctx context.Context) (int64, error)
	Read(ctx context.Context) (int64, error)
	Update(ctx context.Context, unconditional bool) (int64, error)
	Delete(ctx context.Context, unconditional bool) (int64, error)
	ListChildren(ctx context.Context) (int64, []string, error)
}

type KeyProvider

type KeyProvider interface {
	// ChildIndexName supplies the name of the index for the set of children of
	// the instance with the specified view.  If no index exists, an error is
	// returned.
	ChildIndexName() string

	// IndexName supplies the name of the index for this instance given the
	// specified view.  It returns an error if no such index exists.
	IndexName() string

	// KeyName supplies the string used as a key to find this instance.
	KeyName() string
}

KeyProvider specifies the functions that an element that has a location in the store must provide in order to support the addressing functions.

type MockStore

type MockStore struct {
	test.Mock
}

MockStore is the mock implementation for store.Operations interface

func (*MockStore) Connect

func (x *MockStore) Connect() error

func (*MockStore) Create

func (x *MockStore) Create(ctx context.Context, r namespace.KeyRoot, n string, v string) (revision int64, err error)

func (*MockStore) CreateMultiple

func (x *MockStore) CreateMultiple(ctx context.Context, r namespace.KeyRoot, kvs *map[string]string) (revision int64, err error)

func (*MockStore) Delete

func (x *MockStore) Delete(ctx context.Context, r namespace.KeyRoot, n string, rev int64) (revision int64, err error)

func (*MockStore) DeleteMultiple

func (x *MockStore) DeleteMultiple(ctx context.Context, r namespace.KeyRoot, kvs *map[string]int64) (int64, error)

func (*MockStore) Disconnect

func (x *MockStore) Disconnect()

func (*MockStore) List

func (x *MockStore) List(ctx context.Context, r namespace.KeyRoot, n string) (records *map[string]store.Record, revision int64, err error)

func (*MockStore) Read

func (x *MockStore) Read(ctx context.Context, kr namespace.KeyRoot, n string) (value *string, revision int64, err error)

func (*MockStore) Update

func (x *MockStore) Update(ctx context.Context, r namespace.KeyRoot, n string, rev int64, v string) (revision int64, err error)

func (*MockStore) Watch

func (x *MockStore) Watch(ctx context.Context, r namespace.KeyRoot, n string) (*store.Watch, error)

type ObservedViewCommonOperations

type ObservedViewCommonOperations interface {
	GetObservedAt() int64
	SetObservedAt(at int64)
	GetLastGoodObservation() int64
	SetLastGoodObservation(at int64)
	GetObservationFailedReason() string
	SetObservationFailedReason(x string)
}

type Pdu

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

Pdu is a structure representing a pdu object. This object can be used to operate on the associated pdu records in the underlying store. The object can hold information fetched from the underlying store, or as a staging area in preparation for updates to the store.

Pdu is a specialization of a child object for a rack parent.

func (*Pdu) Actual

func (p *Pdu) Actual() PduViewActualOperations

Actual returns the 'actual' view for this instance. Like Definition, it is created on first use, and retained through the rest of this instance's lifespan.

func (*Pdu) Definition

func (p *Pdu) Definition() PduViewDefinitionOperations

Definition returns the 'definition' view for this instance. The view is created on first access, and retained for the lifetime of the pdu object.

func (*Pdu) Moniker

func (p *Pdu) Moniker() string

func (*Pdu) Observed

func (p *Pdu) Observed() PduViewObservedOperations

Observed returns the 'observed' view for this instance, which is the last state retrieved and read by an upstream component (typically, one of the controller services). This will often lag the Actual state. Again, like the Definition function, this view is created on first access, and retained for the lifetime of the tor object.

type PduOperations

type PduOperations interface {
	Moniker() string
	Definition() PduViewDefinitionOperations
	Actual() PduViewActualOperations
	Observed() PduViewObservedOperations
}

type PduViewActual

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

PduViewActual is a struct that contains the data specific to the 'actual' state of the pdu instance: from the table/key path through to the view- specific data fields.

func (*PduViewActual) Describe

func (p *PduViewActual) Describe() string

func (*PduViewActual) Equal

func (p *PduViewActual) Equal(x *pb.Actual_Pdu) bool

Equal is used to provide a simple equality check to determine if the current view matches the one supplied. Typically, it is used when looking to see if the record has been changed.

func (*PduViewActual) GetState

func (p *PduViewActual) GetState() pb.PduState_SM

GetState returns the identifier for the pdu state machine state held in this view.

func (*PduViewActual) GetStoreData

func (p *PduViewActual) GetStoreData() *pb.Actual_Pdu

GetStoreData returns a copy of the PDU's actual state based on the contents of the current object.

func (*PduViewActual) NotEqual

func (p *PduViewActual) NotEqual(x *pb.Actual_Pdu) bool

NotEqual is used to provide a simple inequality check to verify that the current view does not match the one supplied. Typically, it is used when looking to see if the record has been changed.

func (*PduViewActual) SetState

func (p *PduViewActual) SetState(state pb.PduState_SM)

SetState sets the stored state machine state identifier to the supplied value.

type PduViewActualOperations

type PduViewActualOperations interface {
	ItemStoreOperations
	KeyProvider
	ActualCabledViewOperations

	GetState() inventory.PduState_SM
	SetState(state inventory.PduState_SM)
	GetStoreData() *inventory.Actual_Pdu
	Equal(x *inventory.Actual_Pdu) bool
	NotEqual(x *inventory.Actual_Pdu) bool

	Describe() string
}

type PduViewDefinition

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

PduViewDefinition contains the information specific to a 'definition' view for a Pdu.

func (*PduViewDefinition) Equal

func (p *PduViewDefinition) Equal(d *pb.Definition_Pdu) bool

Equal is used to provide a simple equality check to determine if the current view matches the one supplied. Typically, it is used when looking to see if the record has been changed.

func (*PduViewDefinition) EqualPorts

func (p *PduViewDefinition) EqualPorts(ports map[int64]*pb.PowerPort) bool

EqualPorts is used to provide a simple equality check to determine if the current ports match those supplied. Typically, it is used when looking to see if the record has been changed.

func (*PduViewDefinition) GetDetails

func (p *PduViewDefinition) GetDetails() *pb.PduDetails

GetDetails is used to extract the attribute information from the object. The attribute information must have been previously read from the store (see the Read() method) or attached via a SetDetails() call.

May return nil if there are no attributes currently held in the object.

func (*PduViewDefinition) GetPorts

func (p *PduViewDefinition) GetPorts() map[int64]*pb.PowerPort

GetPorts is used to extract the power port information from the object. The port information must have been previously read from the store (see the Read() method) or attached via a SetPorts() call.

May return nil if there are no power port information currently held in the object.

func (*PduViewDefinition) GetStoreData

func (p *PduViewDefinition) GetStoreData() *pb.Definition_Pdu

GetStoreData returns a copy of the pdu definition based on the contents of the current object.

func (*PduViewDefinition) NotEqual

func (p *PduViewDefinition) NotEqual(d *pb.Definition_Pdu) bool

NotEqual is used to provide a simple inequality check to verify that the current view does not match the one supplied. Typically, it is used when looking to see if the record has been changed.

func (*PduViewDefinition) SetDetails

func (p *PduViewDefinition) SetDetails(details *pb.PduDetails)

SetDetails is used to attach some attribute information to the object.

The attribute information is not persisted to the store until an Update() call is made.

The current revision of the pdu object is reset

func (*PduViewDefinition) SetPorts

func (p *PduViewDefinition) SetPorts(ports map[int64]*pb.PowerPort)

SetPorts is used to attach some power port information to the object.

The port information is not persisted to the store until an Update() call is made.

The current revision of the pdu object is reset

type PduViewDefinitionOperations

type PduViewDefinitionOperations interface {
	ItemStoreOperations
	KeyProvider

	SetDetails(details *inventory.PduDetails)
	GetDetails() *inventory.PduDetails
	SetPorts(ports map[int64]*inventory.PowerPort)
	GetPorts() map[int64]*inventory.PowerPort
	EqualPorts(ports map[int64]*inventory.PowerPort) bool
	GetStoreData() *inventory.Definition_Pdu
	Equal(d *inventory.Definition_Pdu) bool
	NotEqual(d *inventory.Definition_Pdu) bool
}

type PduViewObserved

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

PduViewObserved is a struct that contains the last state seen from the controller's relevant service, along with the observation simulated times.

func (PduViewObserved) Describe

func (p PduViewObserved) Describe() string

Describe returns a friendly string representation of this instance.

func (PduViewObserved) Equal

func (p PduViewObserved) Equal(x *pb.Observed_Pdu) bool

Equal returns true iff the supplied instance matches the externally visible attributes of this instance.

func (PduViewObserved) GetLastGoodObservation

func (p PduViewObserved) GetLastGoodObservation() int64

GetLastGoodObservation returns the simulated time of the last successful observation.

func (PduViewObserved) GetObservationFailedReason

func (p PduViewObserved) GetObservationFailedReason() string

GetObservationFailedReason returns the description of the last failed observation attempt, or the empty string if no attempts have failed.

func (*PduViewObserved) GetObservedAt

func (p *PduViewObserved) GetObservedAt() int64

GetObservedAt returns the last simulated time an observation was made.

func (*PduViewObserved) GetState

func (p *PduViewObserved) GetState() pb.PduState_SM

GetState returns the identifier for the pdu state machine state held in this view.

func (PduViewObserved) GetStoreData

func (p PduViewObserved) GetStoreData() *pb.Observed_Pdu

GetStoreData is a function that returns the structured data associated with this instance.

func (PduViewObserved) NotEqual

func (p PduViewObserved) NotEqual(x *pb.Observed_Pdu) bool

NotEqual returns true iff the supplied instance does not match the externally visible attributes of this instance.

func (*PduViewObserved) Observe

func (p *PduViewObserved) Observe(at int64, actual *pb.Actual_Pdu)

Observe is a function that updates the observed state with a snapshot of the supplied actual state, marked as happening at the supplied time.

func (PduViewObserved) SetLastGoodObservation

func (p PduViewObserved) SetLastGoodObservation(at int64)

SetLastGoodObservation updates the simulated time of the last successful observation with the supplied value.

func (PduViewObserved) SetObservationFailedReason

func (p PduViewObserved) SetObservationFailedReason(x string)

SetObservationFailedReason stores the description to use for the last failed observation attempt, or the empty string, if it is to be cleared.

func (PduViewObserved) SetObservedAt

func (p PduViewObserved) SetObservedAt(at int64)

SetObservedAt updates the last simulated time an observation was made to the supplied value.

func (*PduViewObserved) SetState

func (p *PduViewObserved) SetState(state pb.PduState_SM)

SetState sets the stored state machine state identifier to the supplied value.

type PduViewObservedOperations

type PduViewObservedOperations interface {
	ItemStoreOperations
	KeyProvider
	ActualCabledViewOperations
	ObservedViewCommonOperations

	Observe(at int64, actual *inventory.Actual_Pdu)
	GetState() inventory.PduState_SM
	SetState(state inventory.PduState_SM)
	GetStoreData() *inventory.Observed_Pdu
	Equal(x *inventory.Observed_Pdu) bool
	NotEqual(x *inventory.Observed_Pdu) bool

	Describe() string
}

type Rack

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

Rack is a structure representing a rack object. This object can be used to operate on the associated rack records in the underlying store, or to navigate to child pdu, tor or blade objects. The object can store information fetched from the underlying store, or as a staging area in preparation for updates to the store.

func (*Rack) Actual

func (r *Rack) Actual() RackViewActualOperations

Actual returns the 'actual' view of this instance. Like Definition, the view is created on first access, and retained for the lifetime of the rack object.

func (*Rack) Definition

func (r *Rack) Definition() RackViewDefinitionOperations

Definition returns the 'definition' view for this instance. The view is created on first access, and retained for the lifetime of the rack object.

func (*Rack) Moniker

func (r *Rack) Moniker() string

func (*Rack) NewBlade

func (r *Rack) NewBlade(ID int64) (BladeOperations, error)

NewBlade creates a new child object for the blade within the current rack using the supplied identifier. This new object can be used for actions involving operations against the associated record in the underlying store.

No information is fetched from the underlying store so the attribute and revisions fields within the object are not valid.

func (*Rack) NewChild

func (r *Rack) NewChild(_ string) (interface{}, error)

NewChild is a stub function for rack objects as there are no generic child objects. Instead, use one of the specialized functions:

NewPdu()
NewTor()
NewBlade()

These should be called to construct an object for the appropriate specialized child.

func (*Rack) NewPdu

func (r *Rack) NewPdu(ID int64) (PduOperations, error)

NewPdu creates a new child object for the pdu within the current rack using the supplied identifier. This new object can be used for actions involving operations against the associated record in the underlying store.

No information is fetched from the underlying store so the attribute and revisions fields within the object are not valid.

func (*Rack) NewTor

func (r *Rack) NewTor(ID int64) (TorOperations, error)

NewTor creates a new child object for the tor within the current rack using the supplied identifier. This new object can be used for actions involving operations against the associated record in the underlying store.

No information is fetched from the underlying store so the attribute and revisions fields within the object are not valid.

func (*Rack) Observed

func (r *Rack) Observed() RackViewObservedOperations

Observed returns the 'observed' view of this instance. Like Definition, the view is created on first access, and retained for the lifetime of the rack object.

type RackOperations

type RackOperations interface {
	Moniker() string
	Definition() RackViewDefinitionOperations
	Actual() RackViewActualOperations

	NewChild(name string) (interface{}, error)
	NewPdu(ID int64) (PduOperations, error)
	NewTor(ID int64) (TorOperations, error)
	NewBlade(ID int64) (BladeOperations, error)
}

type RackSizeSummary

type RackSizeSummary struct {
	MaxTorCount   int
	MaxPduCount   int
	MaxBladeCount int
	MaxConnectors int
	MaxCapacity   *pb.BladeCapacity
}

RackSizeSummary contains the maximum content values for a set of racks. The values can be used to form a visual fixed rack size that is certain to be sufficient to hold any rack's contents covered by this summary instance.

func (RackSizeSummary) String

func (s RackSizeSummary) String() string

String returns a formatted description of the summary instance.

type RackViewActual

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

RackViewActual contains the information specific to an 'actual' view for a Rack.

func (*RackViewActual) Equal

func (r *RackViewActual) Equal(d *pb.Actual_Rack) bool

Equal is used to provide a simple equality check to determine if the current rack matches the supplied definition. Typically, this is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*RackViewActual) FetchBlades

func (r *RackViewActual) FetchBlades(ctx context.Context) (int64, map[int64]BladeOperations, error)

FetchBlades is used to discover all the child blade objects in the underlying store for the current rack object and to generate a new blade object for each of those children. It is a convenience wrapper around ListBlades() followed by a NewBlade() and Read() on each name discovered.

func (*RackViewActual) FetchChildren

func (r *RackViewActual) FetchChildren(_ context.Context) (int64, *map[string]interface{}, error)

FetchChildren is a stub function for rack objects as there are no generic child objects. Instead, use one of the specialized functions:

FetchPdu()
FetchTor()
FetchBlade()

These should be called to construct an object for the appropriate specialized child.

func (*RackViewActual) FetchPdus

func (r *RackViewActual) FetchPdus(ctx context.Context) (int64, map[int64]PduOperations, error)

FetchPdus is used to discover all the child pdu objects in the underlying store for the current rack object and to generate a new pdu object for each of those children. It is a convenience wrapper around ListPdus() followed by a NewPdu() and Read() on each name discovered.

func (*RackViewActual) FetchTors

func (r *RackViewActual) FetchTors(ctx context.Context) (int64, map[int64]TorOperations, error)

FetchTors is used to discover all the child tor objects in the underlying store for the current rack object and to generate a new tor object for each of those children. It is a convenience wrapper around ListTors() followed by a NewTor() and Read() on each name discovered.

func (*RackViewActual) GetCore

func (r *RackViewActual) GetCore() *pb.MachineCore

GetCore returns the common state machine settings stored for this view.

func (*RackViewActual) GetState

func (r *RackViewActual) GetState() pb.RackState_SM

GetState returns the common state machine state identifier.

func (*RackViewActual) GetStoreData

func (r *RackViewActual) GetStoreData() *pb.Actual_Rack

GetStoreData returns a copy of the rack definition based on the contents of the current object.

func (*RackViewActual) GetStoreDataWithChildren

func (r *RackViewActual) GetStoreDataWithChildren(ctx context.Context) (*pb.Actual_Rack, error)

GetStoreDataWithChildren returns a copy of the rack definition based on the contents of the current object and fully populates all the child maps.

func (*RackViewActual) ListBlades

func (r *RackViewActual) ListBlades(ctx context.Context) (int64, []int64, error)

ListBlades uses the current object to discover the names of all the blade child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewBlade() calls to create new blade objects.

func (*RackViewActual) ListPdus

func (r *RackViewActual) ListPdus(ctx context.Context) (int64, []int64, error)

ListPdus uses the current object to discover the names of all the pdu child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewPdu() calls to create new pdu objects.

func (*RackViewActual) ListTors

func (r *RackViewActual) ListTors(ctx context.Context) (int64, []int64, error)

ListTors uses the current object to discover the names of all the tor child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewTor() calls to create new tor objects.

func (*RackViewActual) NotEqual

func (r *RackViewActual) NotEqual(d *pb.Actual_Rack) bool

NotEqual is used to provide a simple equality check to determine if the current rack do not match the supplied definition. Typically, it is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*RackViewActual) SetCore

func (r *RackViewActual) SetCore(item *pb.MachineCore)

SetCore sets the common state machine settings to the supplied value.

func (*RackViewActual) SetState

func (r *RackViewActual) SetState(value pb.RackState_SM)

SetState sets the common state machine state identifier to the supplied value.

type RackViewActualOperations

type RackViewActualOperations interface {
	ItemStoreOperations
	KeyProvider
	RackViewCommonOperations

	GetState() inventory.RackState_SM
	SetState(value inventory.RackState_SM)
	GetCore() *inventory.MachineCore
	SetCore(item *inventory.MachineCore)
	GetStoreData() *inventory.Actual_Rack
	Equal(d *inventory.Actual_Rack) bool
	NotEqual(d *inventory.Actual_Rack) bool
	GetStoreDataWithChildren(ctx context.Context) (*inventory.Actual_Rack, error)
}

type RackViewCommonOperations

type RackViewCommonOperations interface {
	FetchChildren(ctx context.Context) (int64, *map[string]interface{}, error)
	ListPdus(ctx context.Context) (int64, []int64, error)
	ListTors(ctx context.Context) (int64, []int64, error)
	ListBlades(ctx context.Context) (int64, []int64, error)
	FetchPdus(ctx context.Context) (int64, map[int64]PduOperations, error)
	FetchTors(ctx context.Context) (int64, map[int64]TorOperations, error)
	FetchBlades(ctx context.Context) (int64, map[int64]BladeOperations, error)
}

type RackViewDefinition

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

RackViewDefinition contains the information specific to a 'definition' view for a Rack.

func (*RackViewDefinition) Equal

Equal is used to provide a simple equality check to determine if the current rack matches the supplied definition. Typically, this is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*RackViewDefinition) FetchBlades

func (r *RackViewDefinition) FetchBlades(ctx context.Context) (int64, map[int64]BladeOperations, error)

FetchBlades is used to discover all the child blade objects in the underlying store for the current rack object and to generate a new blade object for each of those children. It is a convenience wrapper around ListBlades() followed by a NewBlade() and Read() on each name discovered.

func (*RackViewDefinition) FetchChildren

func (r *RackViewDefinition) FetchChildren(_ context.Context) (int64, *map[string]interface{}, error)

FetchChildren is a stub function for rack objects as there are no generic child objects. Instead, use one of the specialized functions:

FetchPdu()
FetchTor()
FetchBlade()

These should be called to construct an object for the appropriate specialized child.

func (*RackViewDefinition) FetchPdus

func (r *RackViewDefinition) FetchPdus(ctx context.Context) (int64, map[int64]PduOperations, error)

FetchPdus is used to discover all the child pdu objects in the underlying store for the current rack object and to generate a new pdu object for each of those children. It is a convenience wrapper around ListPdus() followed by a NewPdu() and Read() on each name discovered.

func (*RackViewDefinition) FetchTors

func (r *RackViewDefinition) FetchTors(ctx context.Context) (int64, map[int64]TorOperations, error)

FetchTors is used to discover all the child tor objects in the underlying store for the current rack object and to generate a new tor object for each of those children. It is a convenience wrapper around ListTors() followed by a NewTor() and Read() on each name discovered.

func (*RackViewDefinition) GetDetails

func (r *RackViewDefinition) GetDetails() *pb.RackDetails

GetDetails is used to extract the attribute information from the object. The attribute information must have been previously read from the store (see the Read() method) or attached via a SetDetails() call.

May return nil if there are no attributes currently held in the object.

func (*RackViewDefinition) GetStoreData

func (r *RackViewDefinition) GetStoreData() *pb.Definition_Rack

GetStoreData returns a copy of the rack definition based on the contents of the current object.

func (*RackViewDefinition) GetStoreDataWithChildren

func (r *RackViewDefinition) GetStoreDataWithChildren(ctx context.Context) (*pb.Definition_Rack, error)

GetStoreDataWithChildren returns a copy of the rack definition based on the contents of the current object and fully populates all the child maps.

func (*RackViewDefinition) ListBlades

func (r *RackViewDefinition) ListBlades(ctx context.Context) (int64, []int64, error)

ListBlades uses the current object to discover the names of all the blade child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewBlade() calls to create new blade objects.

func (*RackViewDefinition) ListPdus

func (r *RackViewDefinition) ListPdus(ctx context.Context) (int64, []int64, error)

ListPdus uses the current object to discover the names of all the pdu child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewPdu() calls to create new pdu objects.

func (*RackViewDefinition) ListTors

func (r *RackViewDefinition) ListTors(ctx context.Context) (int64, []int64, error)

ListTors uses the current object to discover the names of all the tor child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewTor() calls to create new tor objects.

func (*RackViewDefinition) NotEqual

func (r *RackViewDefinition) NotEqual(d *pb.Definition_Rack) bool

NotEqual is used to provide a simple equality check to determine if the current rack do not match the supplied definition. Typically, it is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*RackViewDefinition) SetDetails

func (r *RackViewDefinition) SetDetails(details *pb.RackDetails)

SetDetails is used to attach some attribute information to the object.

The attribute information is not persisted to the store until an Update() call is made.

The current revision of the rack object is reset

type RackViewDefinitionOperations

type RackViewDefinitionOperations interface {
	ItemStoreOperations
	KeyProvider
	RackViewCommonOperations

	SetDetails(details *inventory.RackDetails)
	GetDetails() *inventory.RackDetails
	GetStoreData() *inventory.Definition_Rack
	Equal(d *inventory.Definition_Rack) bool
	NotEqual(d *inventory.Definition_Rack) bool
	GetStoreDataWithChildren(ctx context.Context) (*inventory.Definition_Rack, error)
}

type RackViewObserved

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

RackViewObserved is a struct holding the rack's state as last seen by the simulated controller.

Currently, this is little more than an empty holder - just enough to enable the frontend to get and place the observed blade state.

func (*RackViewObserved) FetchBlades

func (r *RackViewObserved) FetchBlades(ctx context.Context) (int64, map[int64]BladeOperations, error)

FetchBlades is used to discover all the child blade objects in the underlying store for the current rack object and to generate a new blade object for each of those children. It is a convenience wrapper around ListBlades() followed by a NewBlade() and Read() on each name discovered.

func (*RackViewObserved) FetchChildren

func (r *RackViewObserved) FetchChildren(_ context.Context) (int64, *map[string]interface{}, error)

FetchChildren is a stub function for rack objects as there are no generic child objects. Instead, use one of the specialized functions:

FetchPdu()
FetchTor()
FetchBlade()

These should be called to construct an object for the appropriate specialized child.

func (*RackViewObserved) FetchPdus

func (r *RackViewObserved) FetchPdus(ctx context.Context) (int64, map[int64]PduOperations, error)

FetchPdus is used to discover all the child pdu objects in the underlying store for the current rack object and to generate a new pdu object for each of those children. It is a convenience wrapper around ListPdus() followed by a NewPdu() and Read() on each name discovered.

func (*RackViewObserved) FetchTors

func (r *RackViewObserved) FetchTors(ctx context.Context) (int64, map[int64]TorOperations, error)

FetchTors is used to discover all the child tor objects in the underlying store for the current rack object and to generate a new tor object for each of those children. It is a convenience wrapper around ListTors() followed by a NewTor() and Read() on each name discovered.

func (*RackViewObserved) ListBlades

func (r *RackViewObserved) ListBlades(ctx context.Context) (int64, []int64, error)

ListBlades uses the current object to discover the names of all the blade child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewBlade() calls to create new blade objects.

func (*RackViewObserved) ListPdus

func (r *RackViewObserved) ListPdus(ctx context.Context) (int64, []int64, error)

ListPdus uses the current object to discover the names of all the pdu child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewPdu() calls to create new pdu objects.

func (*RackViewObserved) ListTors

func (r *RackViewObserved) ListTors(ctx context.Context) (int64, []int64, error)

ListTors uses the current object to discover the names of all the tor child objects in the underlying store for the current rack object, The elements of the returned list can be used in subsequent NewTor() calls to create new tor objects.

type RackViewObservedOperations

type RackViewObservedOperations interface {
	ItemStoreOperations
	KeyProvider
	RackViewCommonOperations

	FetchBlades(ctx context.Context) (int64, map[int64]BladeOperations, error)
}

type Region

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

Region is a structure representing a region object. This object can be used to operate on the associated region records in the underlying store, or to navigate to child zone objects. The object can store information fetched from the underlying store, or as a staging area in preparation for updates to the store.

func (*Region) Definition

func (r *Region) Definition() *RegionViewDefinition

Definition returns the 'definition' view for this instance. The view is created on first access, and retained for the lifetime of the region object.

func (*Region) NewChild

func (r *Region) NewChild(name string) (*Zone, error)

NewChild creates a new child object for the zone within the current region using the supplied name. This new object can be used for further navigation or for actions involving operations against the associated record in the underlying store.

No information is fetched from the underlying store so the attribute and revisions fields within the object are not valid.

type RegionSummary

type RegionSummary struct {
	ZoneCount    int
	MaxRackCount int
	RackSizeSummary
}

RegionSummary contains the summary data for a single region. The contents are either zero or are (re-)computed whenever the inventory definitions are loaded from file. They are a cache of data in the store to avoid having to scan the entire region whenever a simple query for the basic data is being handled.

type RegionViewDefinition

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

RegionViewDefinition contains the information specific to a 'definition' view for a Region.

func (*RegionViewDefinition) ChildIndexName

func (p *RegionViewDefinition) ChildIndexName() string

func (*RegionViewDefinition) Equal

Equal is used to provide a simple equality check for to check if the current region matches the supplied definition. Typically, it is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*RegionViewDefinition) FetchChildren

func (r *RegionViewDefinition) FetchChildren(ctx context.Context) (int64, *map[string]Zone, error)

FetchChildren is used to discover all the child zone objects in the underlying store for the current region object and to generate a new zone object for each of those children. It is a convenience wrapper around ListChildren() followed by a NewChild() and Read() on each name discovered.

func (*RegionViewDefinition) GetDetails

func (r *RegionViewDefinition) GetDetails() *pb.RegionDetails

GetDetails is used to extract the attribute information from the object. The attribute information must have been previously read from the store (see the Read() method) or attached via a SetDetails() call.

May return nil if there are no attributes currently held in the object.

func (*RegionViewDefinition) GetStoreData

func (r *RegionViewDefinition) GetStoreData() *pb.Definition_Region

GetStoreData returns a copy of the rack definition based on the contents of the current object.

func (*RegionViewDefinition) IndexName

func (p *RegionViewDefinition) IndexName() string

func (*RegionViewDefinition) KeyName

func (p *RegionViewDefinition) KeyName() string

func (*RegionViewDefinition) ListChildren

func (is *RegionViewDefinition) ListChildren(ctx context.Context) (int64, []string, error)

ListChildren uses the current object to discover the names of all the child objects in the underlying store for the current itemStore instance. The elements of the returned list can be used in subsequent calls to create new children or retrieve their data from the store.

func (*RegionViewDefinition) NotEqual

NotEqual is used to provide a simple inequality check to verify that the current view does not match the one supplied. Typically, it is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*RegionViewDefinition) SetDetails

func (r *RegionViewDefinition) SetDetails(details *pb.RegionDetails)

SetDetails is used to attach some attribute information to the object.

The attribute information is not persisted to the store until an Update() call is made.

The current revision of the region object is reset

type Root

type Root struct {
	Store         store.Operations
	KeyChildIndex string
	Tables        namespace.TableNameSet
	// contains filtered or unexported fields
}

Root is a structure representing the well-known root of the namespace. It is used to locate the regions within the namespace represented by the table field.

The root object is an in-memory construct only and cannot be persisted to the store, or retrieved from it.

func (*Root) Definition

func (r *Root) Definition() *RootViewDefinition

Definition returns the 'definition' view for this instance. The view is created on first access, and retained for the lifetime of the root object.

func (*Root) NewChild

func (r *Root) NewChild(name string) (*Region, error)

NewChild creates a new region child object within the current root using the supplied name. This new object can be used for further navigation or for actions involving operations against the associated record in the underlying store.

No information is fetched from the underlying store so the attribute and revisions fields within the object are not valid.

type RootSummary

type RootSummary struct {
	RegionCount  int
	MaxZoneCount int
	MaxRackCount int
	RackSizeSummary
}

RootSummary contains the summary data for the entire inventory. The contents are either zero or are (re-)computed whenever the inventory definitions are loaded from file. They are a cache of data in the store to avoid having to scan the entire zone whenever a simple query for the basic data is being handled.

type RootViewDefinition

type RootViewDefinition struct {
	KeyChildIndex string
	// contains filtered or unexported fields
}

RootViewDefinition contains the information specific to a 'definition' view for the Root.

func (*RootViewDefinition) Create

func (r *RootViewDefinition) Create(_ context.Context) (int64, error)

Create is not used for a Root object as there is no persistence for this object.

func (*RootViewDefinition) Delete

func (r *RootViewDefinition) Delete(_ context.Context, _ bool) (int64, error)

Delete is not used for a Root object as there is no persistence for this object.

func (*RootViewDefinition) FetchChildren

func (r *RootViewDefinition) FetchChildren(ctx context.Context) (int64, *map[string]Region, error)

FetchChildren is used to discover all the child region objects in the underlying store for the current root object and to generate a new region object for each of those children. It is a convenience wrapper around ListChildren() followed by a NewChild() and Read() on each name discovered.

func (*RootViewDefinition) GetDetails

func (r *RootViewDefinition) GetDetails() *pb.RootDetails

GetDetails is used to extract the attribute information from the object.

As the Root object is not persisted, the attribute information will either be the initialisation value, or whatever was last set using SetDetails()

func (*RootViewDefinition) ListChildren

func (r *RootViewDefinition) ListChildren(ctx context.Context) (int64, []string, error)

ListChildren uses the current object to discover the names of all the region child objects in the underlying store for the the current root object. The elements of the returned list can be used in subsequent NewChild() calls to create new region objects.

func (*RootViewDefinition) Read

Read is not used for a Root object as there is no persistence for this object.

func (*RootViewDefinition) SetDetails

func (r *RootViewDefinition) SetDetails(details *pb.RootDetails)

SetDetails is used to attach some attribute information to the object.

For a Root object, the information is not persisted.

The current revision of the region object is reset

func (*RootViewDefinition) Update

func (r *RootViewDefinition) Update(_ context.Context, _ bool) (int64, error)

Update is not used for a Root object as there is no persistence for this object.

type Tor

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

Tor is a structure representing a tor object. This object can be used to operate on the associated tor records in the underlying store. The object can hold information fetched from the underlying store, or as a staging area in preparation for updates to the store.

Tor is a specialization of a child object for a rack parent.

func (*Tor) Actual

func (t *Tor) Actual() TorViewActualOperations

Actual returns the 'actual' view for this instance. This view reflects the current state of the instance, without any transmission delays. Like the Definition function, this view is created on first access, and retained for the lifetime of the tor object.

func (*Tor) Definition

func (t *Tor) Definition() TorViewDefinitionOperations

Definition returns the 'definition' view for this instance. The view is created on first access, and retained for the lifetime of the tor object.

func (*Tor) Moniker

func (t *Tor) Moniker() string

func (*Tor) Observed

func (t *Tor) Observed() TorViewObservedOperations

Observed returns the 'observed' view for this instance, which is the last state retrieved and read by an upstream component (typically, one of the controller services). This will often lag the Actual state. Again, like the Definition function, this view is created on first access, and retained for the lifetime of the tor object.

type TorOperations

type TorOperations interface {
	Moniker() string
	Definition() TorViewDefinitionOperations
	Actual() TorViewActualOperations
	Observed() TorViewObservedOperations
}

type TorViewActual

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

TorViewActual is a struct that contains the data that is specific to the 'actual' state of a TOR instance: from the table/key path through to the view-specific data fields.

func (*TorViewActual) Describe

func (t *TorViewActual) Describe() string

Describe returns a friendly string representation of this instance.

func (*TorViewActual) Equal

func (t *TorViewActual) Equal(x *pb.Actual_Tor) bool

Equal is used to provide a simple equality check for use to determine if the current view matches the supplied actual state. Typically, it is used when looking to see if the record has been changed.

func (*TorViewActual) GetState

func (t *TorViewActual) GetState() pb.TorState_SM

GetState returns the identifier for the tor state machine state held in this view.

func (*TorViewActual) GetStoreData

func (t *TorViewActual) GetStoreData() *pb.Actual_Tor

GetStoreData returns a copy of the TOR's actual state based on the contents of the current object.

func (*TorViewActual) NotEqual

func (t *TorViewActual) NotEqual(x *pb.Actual_Tor) bool

NotEqual is used to provide a simple equality check for use to determine if the current view matches the supplied actual state. Typically, it is used when looking to see if the record has been changed.

func (*TorViewActual) SetState

func (t *TorViewActual) SetState(state pb.TorState_SM)

SetState sets the stored state machine state identifier to the supplied value.

type TorViewActualOperations

type TorViewActualOperations interface {
	ItemStoreOperations
	KeyProvider
	ActualCabledViewOperations

	GetState() inventory.TorState_SM
	SetState(state inventory.TorState_SM)
	GetStoreData() *inventory.Actual_Tor
	Equal(x *inventory.Actual_Tor) bool
	NotEqual(x *inventory.Actual_Tor) bool

	Describe() string
}

type TorViewDefinition

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

TorViewDefinition contains the information specific to a 'definition' view for a Tor.

func (*TorViewDefinition) Equal

func (t *TorViewDefinition) Equal(d *pb.Definition_Tor) bool

Equal is used to provide a simple equality check for use to determine if the current tor matches the supplied definition. Typically used when looking to see if the record has been changed.

func (*TorViewDefinition) EqualPorts

func (t *TorViewDefinition) EqualPorts(ports map[int64]*pb.NetworkPort) bool

EqualPorts is used to provide a simple equality check for use to determine if the current ports match those supplied. Typically used when looking to see if the record has been changed.

func (*TorViewDefinition) GetDetails

func (t *TorViewDefinition) GetDetails() *pb.TorDetails

GetDetails is used to extract the attribute information from the object. The attribute information must have been previously read from the store (see the Read() method) or attached via a SetDetails() call.

May return nil if there are no attributes currently held in the object.

func (*TorViewDefinition) GetPorts

func (t *TorViewDefinition) GetPorts() map[int64]*pb.NetworkPort

GetPorts is used to extract the network port information from the object. The port information must have been previously read from the store (see the Read() method) or attached via a SetPorts() call.

May return nil if there are no network port information currently held in the object.

func (*TorViewDefinition) GetStoreData

func (t *TorViewDefinition) GetStoreData() *pb.Definition_Tor

GetStoreData returns a copy of the tor definition based on the contents of the current object.

func (*TorViewDefinition) NotEqual

func (t *TorViewDefinition) NotEqual(d *pb.Definition_Tor) bool

NotEqual is used to provide a simple equality check for use to determine if the current tor does not match the supplied definition. Typically used when looking to see if the record has been changed.

func (*TorViewDefinition) SetDetails

func (t *TorViewDefinition) SetDetails(details *pb.TorDetails)

SetDetails is used to attach some attribute information to the object.

The attribute information is not persisted to the store until an Update() call is made.

The current revision of the tor object is reset

func (*TorViewDefinition) SetPorts

func (t *TorViewDefinition) SetPorts(ports map[int64]*pb.NetworkPort)

SetPorts is used to attach some network port information to the object.

The port information is not persisted to the store until an Update() call is made.

The current revision of the tor object is reset

type TorViewDefinitionOperations

type TorViewDefinitionOperations interface {
	ItemStoreOperations
	KeyProvider

	SetDetails(details *inventory.TorDetails)
	GetDetails() *inventory.TorDetails
	SetPorts(ports map[int64]*inventory.NetworkPort)
	GetPorts() map[int64]*inventory.NetworkPort
	EqualPorts(ports map[int64]*inventory.NetworkPort) bool
	GetStoreData() *inventory.Definition_Tor
	Equal(d *inventory.Definition_Tor) bool
	NotEqual(d *inventory.Definition_Tor) bool
}

type TorViewObserved

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

TorViewObserved is a struct that contains the last state seen from the controller's relevant service, along with the observation simulated times.

func (*TorViewObserved) Describe

func (t *TorViewObserved) Describe() string

Describe returns a friendly string representation of this instance.

func (*TorViewObserved) Equal

func (t *TorViewObserved) Equal(x *pb.Observed_Tor) bool

Equal returns true iff the supplied instance matches the externally visible attributes of this instance.

func (*TorViewObserved) GetLastGoodObservation

func (t *TorViewObserved) GetLastGoodObservation() int64

GetLastGoodObservation returns the simulated time of the last successful observation.

func (*TorViewObserved) GetObservationFailedReason

func (t *TorViewObserved) GetObservationFailedReason() string

GetObservationFailedReason returns the description of the last failed observation attempt, or the empty string if no attempts have failed.

func (*TorViewObserved) GetObservedAt

func (t *TorViewObserved) GetObservedAt() int64

GetObservedAt returns the last simulated time an observation was made.

func (*TorViewObserved) GetState

func (t *TorViewObserved) GetState() pb.TorState_SM

GetState returns the identifier for the tor state machine state held in this view.

func (*TorViewObserved) GetStoreData

func (t *TorViewObserved) GetStoreData() *pb.Observed_Tor

GetStoreData is a function that returns the structured data associated with this instance.

func (*TorViewObserved) NotEqual

func (t *TorViewObserved) NotEqual(x *pb.Observed_Tor) bool

NotEqual returns true iff the supplied instance does not match the externally visible attributes of this instance.

func (*TorViewObserved) Observe

func (t *TorViewObserved) Observe(at int64, actual *pb.Actual_Tor)

Observe is a function that updates the observed state with a snapshot of the supplied actual state, marked as happening at the supplied time.

func (*TorViewObserved) SetLastGoodObservation

func (t *TorViewObserved) SetLastGoodObservation(at int64)

SetLastGoodObservation updates the simulated time of the last successful observation with the supplied value.

func (*TorViewObserved) SetObservationFailedReason

func (t *TorViewObserved) SetObservationFailedReason(x string)

SetObservationFailedReason stores the description to use for the last failed observation attempt, or the empty string, if it is to be cleared.

func (*TorViewObserved) SetObservedAt

func (t *TorViewObserved) SetObservedAt(at int64)

SetObservedAt updates the last simulated time an observation was made to the supplied value.

func (*TorViewObserved) SetState

func (t *TorViewObserved) SetState(state pb.TorState_SM)

SetState sets the stored state machine state identifier to the supplied value.

type TorViewObservedOperations

type TorViewObservedOperations interface {
	ItemStoreOperations
	KeyProvider
	ActualCabledViewOperations
	ObservedViewCommonOperations

	Observe(at int64, actual *inventory.Actual_Tor)
	GetState() inventory.TorState_SM
	SetState(state inventory.TorState_SM)
	GetStoreData() *inventory.Observed_Tor
	Equal(x *inventory.Observed_Tor) bool
	NotEqual(x *inventory.Observed_Tor) bool

	Describe() string
}

type Watch

type Watch struct {

	// Events is the channel on which the notifications are delivered. The
	// caller should pull the WatchEvent structures from this channel to
	// receive the event notifications.
	//
	Events chan WatchEvent
	// contains filtered or unexported fields
}

Watch is a structure returned from the Watch() function and provides the channel used to report changes within the namespace covered by the watchpoint, and also is used to terminate the watchpoint by means of the Close() method.

func (*Watch) Close

func (w *Watch) Close(ctx context.Context) error

Close is a method used to close the upstream source of the notification channel and should be called once the watchpoint is no longer required.

type WatchEvent

type WatchEvent struct {
	// Err indicates if some sort of error occurred during the construction
	// of the WatchEvent notification itself, likely an issue resulting from
	// processing the key responsible for generating the event. The value
	// of the key leading to the problem is included in the error.
	//
	Err error

	// Type indicates the type of change to the store that lead to the
	// event such as a create, a modify/update or a deletion of the
	// indicated key
	//
	Type store.WatchEventType

	// Address is name of the object that was changed.
	//
	Address *namespace.Address

	// Revision is the revision of the store itself when the change occurred.
	// For creates and updates, this will be the same as the new revision
	// of the item that was the subject of the create/update.
	//
	Revision int64

	// NewRev is the revision value for the item that was modified for
	// create and update changes. For delete operation, this will be set
	// to store.RevisionInvalid
	//
	NewRev int64

	// NewVal is the value associated with the key after the completion
	// of the operation. That is, the value after the create or update
	// operation. For a delete operation, this will be set to the empty
	// string ""
	//
	NewVal string

	// OldRev is the revision of the key, value pair prior to the change
	// that lead to the notification. For a create operation, this is set
	// to store.RevisionInvalid as there was no previous key, value pair.
	//
	OldRev int64

	// OldVal is the value associated with the key prior to the change
	// that lead to the notification. For a create operation, this is
	// set to the empty string "" as there was no previous key, value
	// pair.
	//
	OldVal string
}

WatchEvent is a structure used to describe a change to the portion of a namespace that is being monitored by a watchpoint established via a call to the Watch() function.

type Zone

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

Zone is a structure representing a zone object. This object can be used to operate on the associated zone records in the underlying store, or to navigate to child rack objects. The object can store information fetched from the underlying store, or as a staging area in preparation for updates to the store.

func (*Zone) Definition

func (z *Zone) Definition() *ZoneViewDefinition

func (*Zone) NewChild

func (z *Zone) NewChild(name string) (*Rack, error)

NewChild creates a new child object for the zone within the current region using the supplied name. This new object can be used for further navigation or for actions involving operations against the associated record in the underlying store.

No information is fetched from the underlying store so the attribute and revisions fields within the object are not valid.

type ZoneSummary

type ZoneSummary struct {
	RackCount int
	RackSizeSummary
}

ZoneSummary contains the summary data for a single zone. The contents are either zero or are (re-)computed whenever the inventory definitions are loaded from file. They are a cache of data in the store to avoid having to scan the entire zone whenever a simple query for the basic data is being handled.

type ZoneViewDefinition

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

ZoneViewDefinition contains the information specific to a 'definition' view for a Zone.

func (*ZoneViewDefinition) ChildIndexName

func (p *ZoneViewDefinition) ChildIndexName() string

func (*ZoneViewDefinition) Equal

Equal is used to provide a simple equality check to determine if the current view matches the one supplied. Typically, it is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*ZoneViewDefinition) FetchChildren

func (z *ZoneViewDefinition) FetchChildren(ctx context.Context) (int64, *map[string]Rack, error)

FetchChildren is used to discover all the child rack objects in the underlying store for the current zone object and to generate a new rack object for each of those children. It is a convenience wrapper around ListChildren() followed by a NewChild() and Read() on each name discovered.

func (*ZoneViewDefinition) GetDefinitionZone

func (z *ZoneViewDefinition) GetDefinitionZone() *pb.Definition_Zone

GetDefinitionZone returns a copy of the rack definition based on the contents of the current object.

func (*ZoneViewDefinition) GetDetails

func (z *ZoneViewDefinition) GetDetails() *pb.ZoneDetails

GetDetails is used to extract the attribute information from the object. The attribute information must have been previously read from the store (see the Read() method) or attached via a SetDetails() call.

May return nil if there are no attributes currently held in the object.

func (*ZoneViewDefinition) IndexName

func (p *ZoneViewDefinition) IndexName() string

func (*ZoneViewDefinition) KeyName

func (p *ZoneViewDefinition) KeyName() string

func (*ZoneViewDefinition) ListChildren

func (is *ZoneViewDefinition) ListChildren(ctx context.Context) (int64, []string, error)

ListChildren uses the current object to discover the names of all the child objects in the underlying store for the current itemStore instance. The elements of the returned list can be used in subsequent calls to create new children or retrieve their data from the store.

func (*ZoneViewDefinition) NotEqual

func (z *ZoneViewDefinition) NotEqual(d *pb.Definition_Zone) bool

NotEqual is used to provide a simple inequality check to verify that the current view does not match the one supplied. Typically, it is used when looking to see if the record has been changed.

Note: only considers information relating to the parent object and does

not include comparisons for any descendants.

func (*ZoneViewDefinition) SetDetails

func (z *ZoneViewDefinition) SetDetails(details *pb.ZoneDetails)

SetDetails is used to attach some attribute information to the object.

The attribute information is not persisted to the store until an Update() call is made.

The current revision of the zone object is reset

func (*ZoneViewDefinition) Watch

func (z *ZoneViewDefinition) Watch(ctx context.Context) (*Watch, error)

Watch is used to establish a watchpoint on a zone such that any updates to any names within the zone will generate a notification via the Event channel in the returned inventory.Watch structure.

Once the watchpoint is no longer required, the caller should invoke the Close() method on the returned inventory.Watch structure.

Jump to

Keyboard shortcuts

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