Documentation ¶
Index ¶
- type BladeView
- type Inventory
- func (m *Inventory) GetBlade(ctx context.Context, regionName string, zoneName string, rackName string, ...) (*pb.BladeCapacity, error)
- func (m *Inventory) GetMemoData() *inventory.ZoneSummary
- func (m *Inventory) GetRackInZone(ctx context.Context, regionName string, zoneName string, rackName string) (*RackView, error)
- func (m *Inventory) GetRegion(ctx context.Context, regionName string) (*pb.Definition_Region, error)
- func (m *Inventory) GetZone(ctx context.Context, regionName string, zoneName string) (*pb.Definition_Zone, error)
- func (m *Inventory) GetZoneDetails(ctx context.Context, regionName string, zoneName string) (*pb.ZoneDetails, error)
- func (m *Inventory) ReadBlade(ctx context.Context, region string, zone string, rack string, index int64) (*pb.Definition_Blade, int64, error)
- func (m *Inventory) ReadPdu(ctx context.Context, region string, zone string, rack string, index int64) (*pb.Definition_Pdu, int64, error)
- func (m *Inventory) ReadRack(ctx context.Context, region string, zone string, name string) (*pb.Definition_Rack, int64, error)
- func (m *Inventory) ReadRegion(ctx context.Context, name string) (*pb.Definition_Region, int64, error)
- func (m *Inventory) ReadTor(ctx context.Context, region string, zone string, rack string, index int64) (*pb.Definition_Tor, int64, error)
- func (m *Inventory) ReadZone(ctx context.Context, region string, name string) (*pb.Definition_Zone, int64, error)
- func (m *Inventory) ScanBladesInRack(ctx context.Context, regionName string, zoneName string, rackName string, ...) error
- func (m *Inventory) ScanRacksInZone(ctx context.Context, regionName string, zoneName string, ...) error
- func (m *Inventory) ScanRegions(ctx context.Context, action func(entry string) error) error
- func (m *Inventory) ScanZonesInRegion(ctx context.Context, regionName string, action func(entry string) error) error
- func (m *Inventory) Start(ctx context.Context) error
- func (m *Inventory) UpdateFromDefinition(ctx context.Context, path string) error
- type PduView
- type RVDynamic
- type RVStatic
- type RackView
- type TorView
- type Users
- func (m *Users) Create(ctx context.Context, u *pb.User) (int64, error)
- func (m *Users) Delete(ctx context.Context, name string, match int64) error
- func (m *Users) Read(ctx context.Context, name string) (*pb.User, int64, error)
- func (m *Users) Scan(ctx context.Context, action func(entry *pb.User) error) error
- func (m *Users) Update(ctx context.Context, name string, u *pb.UserUpdate, match int64) (*pb.User, int64, error)
- func (m *Users) UpdatePassword(ctx context.Context, name string, hash []byte, match int64) (*pb.User, int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BladeView ¶
type BladeView struct { Definition *pb.Definition_Blade Actual *pb.Actual_Blade Observed *pb.Observed_Blade Moniker string }
BladeView is a structure that holds the various views of a blade, along with the moniker used by impact statements for it.
type Inventory ¶
type Inventory struct { Started bool Inventory *inventory.Inventory RootSummary *inventory.RootSummary DefaultZoneSummary *inventory.ZoneSummary // contains filtered or unexported fields }
Inventory is a structure used to establish synchronized access to the in-memory version of the inventory.
The structure consists of three parts:
the Mutex field controls access to the rest of the structure, avoiding collisions between two simultaneous web server calls.
the Zone field contains the inventory definition data. This data originated externally, via a definition file, and is read only.
the remains fields, MaxBladeCount and MaxCapacity, contain summary memo calculations that simplify the sizing and placement calculations for the Cloud Chamber UI.
func InitInventory ¶
func InitInventory(ctx context.Context, cfg *config.GlobalConfig, store *store.Store) (*Inventory, error)
InitInventory initializes the base state for the inventory.
func NewInventory ¶
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) GetBlade ¶
func (m *Inventory) GetBlade(ctx context.Context, regionName string, zoneName string, rackName string, bladeID int64) (*pb.BladeCapacity, error)
GetBlade returns the details of a blade matching the supplied rackID and bladeID
func (*Inventory) GetMemoData ¶
func (m *Inventory) GetMemoData() *inventory.ZoneSummary
GetMemoData returns the maximum number of blades held in any rack in the inventory.
func (*Inventory) GetRackInZone ¶
func (m *Inventory) GetRackInZone( ctx context.Context, regionName string, zoneName string, rackName string) (*RackView, error)
GetRackInZone returns the rack details to match the supplied rackName
func (*Inventory) GetRegion ¶
func (m *Inventory) GetRegion(ctx context.Context, regionName string) (*pb.Definition_Region, error)
GetRegion returns the region details to match the supplied region name
func (*Inventory) GetZone ¶
func (m *Inventory) GetZone(ctx context.Context, regionName string, zoneName string) (*pb.Definition_Zone, error)
GetZone returns the zone details and a map for the rack details for the zone specified by the regionName and zoneName.
func (*Inventory) GetZoneDetails ¶
func (m *Inventory) GetZoneDetails(ctx context.Context, regionName string, zoneName string) (*pb.ZoneDetails, error)
GetZoneDetails returns the detail information about the zone specified by the regionName and zoneName.
func (*Inventory) ReadBlade ¶
func (m *Inventory) ReadBlade( ctx context.Context, region string, zone string, rack string, index int64) (*pb.Definition_Blade, int64, error)
ReadBlade returns the blade information for an optionally specified revision.
func (*Inventory) ReadPdu ¶
func (m *Inventory) ReadPdu( ctx context.Context, region string, zone string, rack string, index int64) (*pb.Definition_Pdu, int64, error)
ReadPdu returns the PDU information for an optionally specified revision.
func (*Inventory) ReadRack ¶
func (m *Inventory) ReadRack( ctx context.Context, region string, zone string, name string) (*pb.Definition_Rack, int64, error)
ReadRack returns the rack information with optionally additional blade, tor and pdu details for an optionally specified revision.
func (*Inventory) ReadRegion ¶
func (m *Inventory) ReadRegion( ctx context.Context, name string) (*pb.Definition_Region, int64, error)
ReadRegion returns the region information with optionally additional zone, rack, blade, tor and pdu details for an optionally specified revision.
func (*Inventory) ReadTor ¶
func (m *Inventory) ReadTor( ctx context.Context, region string, zone string, rack string, index int64) (*pb.Definition_Tor, int64, error)
ReadTor returns the TOR information for an optionally specified revision.
func (*Inventory) ReadZone ¶
func (m *Inventory) ReadZone( ctx context.Context, region string, name string) (*pb.Definition_Zone, int64, error)
ReadZone returns the zone information with optionally additional rack, blade, tor and pdu details for an optionally specified revision.
func (*Inventory) ScanBladesInRack ¶
func (m *Inventory) ScanBladesInRack(ctx context.Context, regionName string, zoneName string, rackName string, action func(bladeID int64) error) error
ScanBladesInRack enumerates over all the blades in a rack of the given rackID, and invokes the supplied action on each discovered bladeID in turn.
func (*Inventory) ScanRacksInZone ¶
func (m *Inventory) ScanRacksInZone( ctx context.Context, regionName string, zoneName string, action func(entry string) error) error
ScanRacksInZone scans the set of known racks in the store, invoking the supplied function with each entry.
func (*Inventory) ScanRegions ¶
ScanRegions scans the set of known regions in the store, invoking the supplied function with each entry.
func (*Inventory) ScanZonesInRegion ¶
func (m *Inventory) ScanZonesInRegion(ctx context.Context, regionName string, action func(entry string) error) error
ScanZonesInRegion scans the set of known zones in the store within the specified region, invoking the supplied function with each entry.
func (*Inventory) Start ¶
Start is a method used to start the inventory service as a part of normal product code paths loading the current inventory definition from the definition file, and sending updates to the store to reconcile the persisted state. Note that changes to the store may in turn trigger any currently established watch handlers leading to updates elsewhere in the system.
NOTE: this method is not expected to be called as part of initialization
when running tests to avoid unfortunate interactions with the trace code as a result of generating lots of trace spans before the trace sink client is available.
type PduView ¶
type PduView struct { Definition *pb.Definition_Pdu Actual *pb.Actual_Pdu Observed *pb.Observed_Pdu Moniker string }
PduView is a structure that holds the various views of a pdu, along with the moniker used by impact statements for it.
type RVDynamic ¶
type RVDynamic struct { State pb.RackState_SM Core *pb.MachineCore }
RVDynamic is a structure that contains the information common to all of the views that change as the simulation proceeds.
type RVStatic ¶
type RVStatic struct {
Details *pb.RackDetails
}
RVStatic is a structure that contains definition view only information about a rack. This information does not change except due to configuration change, so is considered relatively static.
type RackView ¶
type RackView struct { Definition *RVStatic Actual *RVDynamic Observed *RVDynamic Blades map[int64]*BladeView Pdus map[int64]*PduView Tors map[int64]*TorView // contains filtered or unexported fields }
RackView holds the retrieved views for a rack, along with the moniker, which is also used by impact statements.
type TorView ¶
type TorView struct { Definition *pb.Definition_Tor Actual *pb.Actual_Tor Observed *pb.Observed_Tor Moniker string }
TorView is a structure that holds the various views of a tor, along with the moniker used by impact statements for it.
type Users ¶
Users is a container used to established synchronized access to the in-memory set of user records.
func (*Users) Scan ¶
Scan the set of known users in the store, invoking the supplied function with each entry.
func (*Users) Update ¶
func (m *Users) Update(ctx context.Context, name string, u *pb.UserUpdate, match int64) (*pb.User, int64, error)
Update an existing user entry, iff the current revision is the same as the expected (match) revision
NOTE: Currently, this uses a *VERY* clumsy read/modify/write action. What is
really needed here is to provide the ability to feed an action into the Update() routine itself to allow the caller to selectively update individual fields from within the transaction.
func (*Users) UpdatePassword ¶
func (m *Users) UpdatePassword(ctx context.Context, name string, hash []byte, match int64) (*pb.User, int64, error)
UpdatePassword is a function that updates the password hash field only in an existing user record.
That this is split out from Update reflects the usage patterns for updating user entries.