Documentation ¶
Overview ¶
Package entitymanager is an in-memory implementation of an entity manager that models an organization's inventory.
Index ¶
- type InMemoryEntityManager
- func (m *InMemoryEntityManager) AddChassis(bootMode bpb.BootMode, manufacturer string, serial string) *InMemoryEntityManager
- func (m *InMemoryEntityManager) AddControlCard(serial string) *InMemoryEntityManager
- func (m *InMemoryEntityManager) DeleteDevice(chassis *service.EntityLookup)
- func (m *InMemoryEntityManager) GetAll() []*epb.Chassis
- func (m *InMemoryEntityManager) GetBootstrapData(ctx context.Context, chassis *service.Chassis, serial string) (*bpb.BootstrapDataResponse, error)
- func (m *InMemoryEntityManager) GetChassisInventory() []*epb.Chassis
- func (m *InMemoryEntityManager) GetDevice(chassis *service.EntityLookup) (*epb.Chassis, error)
- func (m *InMemoryEntityManager) ReplaceDevice(old *service.EntityLookup, new *epb.Chassis) error
- func (m *InMemoryEntityManager) ResolveChassis(ctx context.Context, lookup *service.EntityLookup, ccSerial string) (*service.Chassis, error)
- func (m *InMemoryEntityManager) SetStatus(ctx context.Context, req *bpb.ReportStatusRequest) error
- func (m *InMemoryEntityManager) Sign(ctx context.Context, resp *bpb.GetBootstrapDataResponse, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryEntityManager ¶
type InMemoryEntityManager struct {
// contains filtered or unexported fields
}
InMemoryEntityManager provides a simple in memory handler for Entities.
func New ¶
func New(chassisConfigFile string, artifacts *service.SecurityArtifacts) (*InMemoryEntityManager, error)
New returns a new in-memory entity manager.
func (*InMemoryEntityManager) AddChassis ¶
func (m *InMemoryEntityManager) AddChassis(bootMode bpb.BootMode, manufacturer string, serial string) *InMemoryEntityManager
AddChassis adds a new chassis to the entity manager.
func (*InMemoryEntityManager) AddControlCard ¶
func (m *InMemoryEntityManager) AddControlCard(serial string) *InMemoryEntityManager
AddControlCard adds a new control card to the entity manager.
func (*InMemoryEntityManager) DeleteDevice ¶
func (m *InMemoryEntityManager) DeleteDevice(chassis *service.EntityLookup)
DeleteDevice removes the chassis at the provided lookup from the entitymanager.
func (*InMemoryEntityManager) GetAll ¶
func (m *InMemoryEntityManager) GetAll() []*epb.Chassis
GetAll returns a copy of the chassisInventory field.
func (*InMemoryEntityManager) GetBootstrapData ¶
func (m *InMemoryEntityManager) GetBootstrapData(ctx context.Context, chassis *service.Chassis, serial string) (*bpb.BootstrapDataResponse, error)
GetBootstrapData fetches and returns the bootstrap data response from the server.
func (*InMemoryEntityManager) GetChassisInventory ¶
func (m *InMemoryEntityManager) GetChassisInventory() []*epb.Chassis
GetChassisInventory returns the chassis inventory
func (*InMemoryEntityManager) GetDevice ¶
func (m *InMemoryEntityManager) GetDevice(chassis *service.EntityLookup) (*epb.Chassis, error)
GetDevice returns a copy of the chassis at the provided lookup.
func (*InMemoryEntityManager) ReplaceDevice ¶
func (m *InMemoryEntityManager) ReplaceDevice(old *service.EntityLookup, new *epb.Chassis) error
ReplaceDevice replaces an existing chassis with a new chassis object. If the chassis is not found, it is added to the inventory.
func (*InMemoryEntityManager) ResolveChassis ¶
func (m *InMemoryEntityManager) ResolveChassis(ctx context.Context, lookup *service.EntityLookup, ccSerial string) (*service.Chassis, error)
ResolveChassis returns an entity based on the provided lookup. If a control card serial is provided, it also looks up chassis' by its control cards.
func (*InMemoryEntityManager) SetStatus ¶
func (m *InMemoryEntityManager) SetStatus(ctx context.Context, req *bpb.ReportStatusRequest) error
SetStatus updates the status for each control card on the chassis.