NO-JIRA | fix: refactor inspector to use pipelines#175
NO-JIRA | fix: refactor inspector to use pipelines#175AvielSegev wants to merge 1 commit intokubev2v:mainfrom
Conversation
e5bbb23 to
7ca731b
Compare
e4da41c to
3dbfb44
Compare
Signed-off-by: Aviel Segev <asegev@redhat.com>
3dbfb44 to
348a8bc
Compare
| InspectionWorkBuilder func(id string) []models.WorkUnit[models.InspectionStatus, models.InspectionResult] | ||
| ) | ||
|
|
||
| type InspectionService struct { |
There was a problem hiding this comment.
if you don't want to export this service, you should do it the other way around.
inspectionService + methods public.
Currently, we're exporting the service without any public methods.
There was a problem hiding this comment.
I would drop all the mutex from this service. If the InspectorService is the only caller, it should be responsible for protecting it.
You can have problems with redundant locking or even worst having some locking order problems.
| return i | ||
| } | ||
|
|
||
| func (i *InspectionService) add(vmIDs []string) error { |
There was a problem hiding this comment.
It could be clearer if this accepts a single vm
Add(vmID string) error
Cancel(vmID string) error
Stop() -> stops all the vms.
The contract is simpler like this imo.
| InspectionWorkBuilder func(id string) []models.WorkUnit[models.InspectionStatus, models.InspectionResult] | ||
| ) | ||
|
|
||
| type InspectionService struct { |
There was a problem hiding this comment.
I think this is a good idea to separate concerns, with inspectionService responsible for vm inspection and inspector for the rest—each one with its scheduler and type.
|
|
||
| type ( | ||
| InspectionPipeline = WorkPipeline[models.InspectionStatus, models.InspectionResult] | ||
| InspectionWorkBuilder func(id string) []models.WorkUnit[models.InspectionStatus, models.InspectionResult] |
Signed-off-by: Aviel Segev asegev@redhat.com