Documentation
¶
Overview ¶
Package manager provides the business logic layer for inventory management. It wraps the InventoryStore and provides a place for validation, caching, audit logging, and other business rules.
Index ¶
- type ComponentDrift
- type FieldDiff
- type Manager
- type ManagerImpl
- func (m *ManagerImpl) AddComponent(ctx context.Context, comp *component.Component) (uuid.UUID, error)
- func (m *ManagerImpl) AttachRacksToNVLDomain(ctx context.Context, nvlDomainID identifier.Identifier, ...) error
- func (m *ManagerImpl) CreateExpectedRack(ctx context.Context, rack *rack.Rack) (uuid.UUID, error)
- func (m *ManagerImpl) CreateNVLDomain(ctx context.Context, nvlDomain *nvldomain.NVLDomain) (uuid.UUID, error)
- func (m *ManagerImpl) DeleteComponent(ctx context.Context, id uuid.UUID) error
- func (m *ManagerImpl) DeleteRack(ctx context.Context, id uuid.UUID) error
- func (m *ManagerImpl) DetachRacksFromNVLDomain(ctx context.Context, rackIDs []identifier.Identifier) error
- func (m *ManagerImpl) GetAllDrifts(ctx context.Context) ([]inventorystore.ComponentDrift, error)
- func (m *ManagerImpl) GetComponentByBMCMAC(ctx context.Context, macAddress string) (*component.Component, error)
- func (m *ManagerImpl) GetComponentByID(ctx context.Context, id uuid.UUID) (*component.Component, error)
- func (m *ManagerImpl) GetComponentBySerial(ctx context.Context, manufacturer string, serial string, withRack bool) (*component.Component, error)
- func (m *ManagerImpl) GetComponentsByExternalIDs(ctx context.Context, externalIDs []string) ([]*component.Component, error)
- func (m *ManagerImpl) GetDriftsByComponentIDs(ctx context.Context, componentIDs []uuid.UUID) ([]inventorystore.ComponentDrift, error)
- func (m *ManagerImpl) GetListOfComponents(ctx context.Context, info dbquery.StringQueryInfo, ...) ([]*component.Component, int32, error)
- func (m *ManagerImpl) GetListOfNVLDomains(ctx context.Context, info dbquery.StringQueryInfo, ...) ([]*nvldomain.NVLDomain, int32, error)
- func (m *ManagerImpl) GetListOfRacks(ctx context.Context, info dbquery.StringQueryInfo, ...) ([]*rack.Rack, int32, error)
- func (m *ManagerImpl) GetRackByID(ctx context.Context, id uuid.UUID, withComponents bool) (*rack.Rack, error)
- func (m *ManagerImpl) GetRackByIdentifier(ctx context.Context, identifier identifier.Identifier, withComponents bool) (*rack.Rack, error)
- func (m *ManagerImpl) GetRackBySerial(ctx context.Context, manufacturer string, serial string, withComponents bool) (*rack.Rack, error)
- func (m *ManagerImpl) GetRacksByIDs(ctx context.Context, ids []uuid.UUID, withComponents bool) ([]*rack.Rack, error)
- func (m *ManagerImpl) GetRacksForNVLDomain(ctx context.Context, nvlDomainID identifier.Identifier) ([]*rack.Rack, error)
- func (m *ManagerImpl) PatchComponent(ctx context.Context, comp *component.Component) error
- func (m *ManagerImpl) PatchRack(ctx context.Context, rack *rack.Rack) (string, error)
- func (m *ManagerImpl) PurgeComponent(ctx context.Context, id uuid.UUID) error
- func (m *ManagerImpl) PurgeRack(ctx context.Context, id uuid.UUID) error
- func (m *ManagerImpl) Start(ctx context.Context) error
- func (m *ManagerImpl) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldDiff ¶
type FieldDiff = inventorystore.FieldDiff
type Manager ¶
type Manager interface {
// Lifecycle
Start(ctx context.Context) error
Stop(ctx context.Context) error
// Rack operations
CreateExpectedRack(ctx context.Context, rack *rack.Rack) (uuid.UUID, error)
GetRackByID(ctx context.Context, id uuid.UUID, withComponents bool) (*rack.Rack, error)
GetRacksByIDs(ctx context.Context, ids []uuid.UUID, withComponents bool) ([]*rack.Rack, error)
GetRackBySerial(ctx context.Context, manufacturer string, serial string, withComponents bool) (*rack.Rack, error)
GetRackByIdentifier(ctx context.Context, identifier identifier.Identifier, withComponents bool) (*rack.Rack, error)
PatchRack(ctx context.Context, rack *rack.Rack) (string, error)
DeleteRack(ctx context.Context, id uuid.UUID) error
PurgeRack(ctx context.Context, id uuid.UUID) error
GetListOfRacks(ctx context.Context, info dbquery.StringQueryInfo, manufacturerFilter *dbquery.StringQueryInfo, modelFilter *dbquery.StringQueryInfo, pagination *dbquery.Pagination, orderBy *dbquery.OrderBy, withComponents bool) ([]*rack.Rack, int32, error)
// Component operations
GetComponentByID(ctx context.Context, id uuid.UUID) (*component.Component, error)
GetComponentBySerial(ctx context.Context, manufacturer string, serial string, withRack bool) (*component.Component, error)
GetComponentByBMCMAC(ctx context.Context, macAddress string) (*component.Component, error)
GetComponentsByExternalIDs(ctx context.Context, externalIDs []string) ([]*component.Component, error)
GetListOfComponents(ctx context.Context, info dbquery.StringQueryInfo, manufacturerFilter *dbquery.StringQueryInfo, modelFilter *dbquery.StringQueryInfo, componentTypes []devicetypes.ComponentType, pagination *dbquery.Pagination, orderBy *dbquery.OrderBy) ([]*component.Component, int32, error)
AddComponent(ctx context.Context, comp *component.Component) (uuid.UUID, error)
PatchComponent(ctx context.Context, comp *component.Component) error
DeleteComponent(ctx context.Context, id uuid.UUID) error
PurgeComponent(ctx context.Context, id uuid.UUID) error
// Component drift operations
GetDriftsByComponentIDs(ctx context.Context, componentIDs []uuid.UUID) ([]inventorystore.ComponentDrift, error)
GetAllDrifts(ctx context.Context) ([]inventorystore.ComponentDrift, error)
// NVL Domain operations
CreateNVLDomain(ctx context.Context, nvlDomain *nvldomain.NVLDomain) (uuid.UUID, error)
AttachRacksToNVLDomain(ctx context.Context, nvlDomainID identifier.Identifier, rackIDs []identifier.Identifier) error
DetachRacksFromNVLDomain(ctx context.Context, rackIDs []identifier.Identifier) error
GetListOfNVLDomains(ctx context.Context, info dbquery.StringQueryInfo, pagination *dbquery.Pagination) ([]*nvldomain.NVLDomain, int32, error)
GetRacksForNVLDomain(ctx context.Context, nvlDomainID identifier.Identifier) ([]*rack.Rack, error)
}
Manager defines the interface for inventory management business logic. It wraps InventoryStore and provides a consistent API for the service layer.
type ManagerImpl ¶
type ManagerImpl struct {
// contains filtered or unexported fields
}
ManagerImpl implements the Manager interface. It currently delegates all operations to the underlying store, but provides a place to add business logic in the future.
func New ¶
func New(store inventorystore.Store) *ManagerImpl
New creates a new inventory manager with the given store.
func (*ManagerImpl) AddComponent ¶
func (m *ManagerImpl) AddComponent(ctx context.Context, comp *component.Component) (uuid.UUID, error)
AddComponent creates a single component in the database and returns its UUID.
func (*ManagerImpl) AttachRacksToNVLDomain ¶
func (m *ManagerImpl) AttachRacksToNVLDomain(ctx context.Context, nvlDomainID identifier.Identifier, rackIDs []identifier.Identifier) error
AttachRacksToNVLDomain attaches racks to an NVL domain.
func (*ManagerImpl) CreateExpectedRack ¶
CreateExpectedRack creates an expected rack configuration. Future: Add validation, audit logging, etc.
func (*ManagerImpl) CreateNVLDomain ¶
func (m *ManagerImpl) CreateNVLDomain(ctx context.Context, nvlDomain *nvldomain.NVLDomain) (uuid.UUID, error)
CreateNVLDomain creates a new NVL domain.
func (*ManagerImpl) DeleteComponent ¶
DeleteComponent soft-deletes a component by UUID.
func (*ManagerImpl) DeleteRack ¶
DeleteRack soft-deletes a rack and all its components.
func (*ManagerImpl) DetachRacksFromNVLDomain ¶
func (m *ManagerImpl) DetachRacksFromNVLDomain(ctx context.Context, rackIDs []identifier.Identifier) error
DetachRacksFromNVLDomain detaches racks from their NVL domain.
func (*ManagerImpl) GetAllDrifts ¶
func (m *ManagerImpl) GetAllDrifts(ctx context.Context) ([]inventorystore.ComponentDrift, error)
GetAllDrifts retrieves all drift records.
func (*ManagerImpl) GetComponentByBMCMAC ¶
func (m *ManagerImpl) GetComponentByBMCMAC(ctx context.Context, macAddress string) (*component.Component, error)
GetComponentByBMCMAC retrieves a component by its BMC MAC address.
func (*ManagerImpl) GetComponentByID ¶
func (m *ManagerImpl) GetComponentByID(ctx context.Context, id uuid.UUID) (*component.Component, error)
GetComponentByID retrieves a component by its UUID.
func (*ManagerImpl) GetComponentBySerial ¶
func (m *ManagerImpl) GetComponentBySerial(ctx context.Context, manufacturer string, serial string, withRack bool) (*component.Component, error)
GetComponentBySerial retrieves a component by its serial number and manufacturer.
func (*ManagerImpl) GetComponentsByExternalIDs ¶
func (m *ManagerImpl) GetComponentsByExternalIDs(ctx context.Context, externalIDs []string) ([]*component.Component, error)
GetComponentsByExternalIDs retrieves components by their external IDs.
func (*ManagerImpl) GetDriftsByComponentIDs ¶
func (m *ManagerImpl) GetDriftsByComponentIDs(ctx context.Context, componentIDs []uuid.UUID) ([]inventorystore.ComponentDrift, error)
GetDriftsByComponentIDs retrieves drift records for the given component UUIDs.
func (*ManagerImpl) GetListOfComponents ¶
func (m *ManagerImpl) GetListOfComponents(ctx context.Context, info dbquery.StringQueryInfo, manufacturerFilter *dbquery.StringQueryInfo, modelFilter *dbquery.StringQueryInfo, componentTypes []devicetypes.ComponentType, pagination *dbquery.Pagination, orderBy *dbquery.OrderBy) ([]*component.Component, int32, error)
GetListOfComponents lists components matching the given criteria.
func (*ManagerImpl) GetListOfNVLDomains ¶
func (m *ManagerImpl) GetListOfNVLDomains(ctx context.Context, info dbquery.StringQueryInfo, pagination *dbquery.Pagination) ([]*nvldomain.NVLDomain, int32, error)
GetListOfNVLDomains lists NVL domains matching the given criteria.
func (*ManagerImpl) GetListOfRacks ¶
func (m *ManagerImpl) GetListOfRacks(ctx context.Context, info dbquery.StringQueryInfo, manufacturerFilter *dbquery.StringQueryInfo, modelFilter *dbquery.StringQueryInfo, pagination *dbquery.Pagination, orderBy *dbquery.OrderBy, withComponents bool) ([]*rack.Rack, int32, error)
GetListOfRacks lists racks matching the given criteria.
func (*ManagerImpl) GetRackByID ¶
func (m *ManagerImpl) GetRackByID(ctx context.Context, id uuid.UUID, withComponents bool) (*rack.Rack, error)
GetRackByID retrieves a rack by its UUID.
func (*ManagerImpl) GetRackByIdentifier ¶
func (m *ManagerImpl) GetRackByIdentifier(ctx context.Context, identifier identifier.Identifier, withComponents bool) (*rack.Rack, error)
GetRackByIdentifier retrieves a rack by its identifier (ID or name).
func (*ManagerImpl) GetRackBySerial ¶
func (m *ManagerImpl) GetRackBySerial(ctx context.Context, manufacturer string, serial string, withComponents bool) (*rack.Rack, error)
GetRackBySerial retrieves a rack by its serial number and manufacturer.
func (*ManagerImpl) GetRacksByIDs ¶
func (m *ManagerImpl) GetRacksByIDs(ctx context.Context, ids []uuid.UUID, withComponents bool) ([]*rack.Rack, error)
GetRacksByIDs retrieves multiple racks by their UUIDs.
func (*ManagerImpl) GetRacksForNVLDomain ¶
func (m *ManagerImpl) GetRacksForNVLDomain(ctx context.Context, nvlDomainID identifier.Identifier) ([]*rack.Rack, error)
GetRacksForNVLDomain retrieves all racks belonging to an NVL domain.
func (*ManagerImpl) PatchComponent ¶
PatchComponent updates a single component's fields in the database.
func (*ManagerImpl) PurgeComponent ¶
PurgeComponent permanently removes a soft-deleted component.
func (*ManagerImpl) PurgeRack ¶
PurgeRack permanently removes a soft-deleted rack and its components.