Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ManageExpectedSwitch ¶
type ManageExpectedSwitch struct {
// contains filtered or unexported fields
}
ManageExpectedSwitch is an activity wrapper for managing ExpectedSwitch lifecycle that allows injecting DB access
func NewManageExpectedSwitch ¶
func NewManageExpectedSwitch(dbSession *cdb.Session, siteClientPool *sc.ClientPool) ManageExpectedSwitch
NewManageExpectedSwitch returns a new ManageExpectedSwitch activity
func (ManageExpectedSwitch) UpdateExpectedSwitchesInDB ¶
func (mei ManageExpectedSwitch) UpdateExpectedSwitchesInDB(ctx context.Context, siteID uuid.UUID, expectedSwitchInventory *cwssaws.ExpectedSwitchInventory) error
UpdateExpectedSwitchesInDB is a Temporal activity that takes a collection of ExpectedSwitch data pushed by Site Agent and updates the DB Expected Switch records have two unique values (MAC and UUID). We ignore the MAC value and only rely on the UUID for uniqueness. NICo is the source of truth: out of the race-condition window we make the DB match NICo exactly. The reconciliation logic is as follows: - UUID existing in NICo but not in DB: create record in DB - UUID existing in both NICo and DB with differences: update record in DB - UUID existing in DB but not in NICo: delete record in DB