-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(deviceManagerEngine): free devices after engine deletion #382
base: 2-dev
Are you sure you want to change the base?
feat(deviceManagerEngine): free devices after engine deletion #382
Conversation
lib/modules/device/DeviceService.ts
Outdated
* On deletion of a tenant, remove association for all of | ||
* its formerly linked devices in the admin index. | ||
*/ | ||
this.app.hook.register( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should not be done inside the kuzzle-device-manager plugins because here you create a dependency with the multi-tenancy plugin witch is not the purpose of this plugin. It is suppose to be autonomous. You should put this behaviour in the iot platform backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this was the first implementation but supposed to be removed for the reason you gave
My bad, I messed up my last commit...
* @param engineId The target engine Id | ||
* @returns {any} | ||
*/ | ||
private async detachDevicesFromAdminIndex(engineId: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this method should be named detachDevicesFromTenantIndex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think tenantIndex could lead to confusion as this functions is related only to the 'platform' index which is referred as adminIndex in KDM.
It could be so cool to implement a dependancies property at model level that registers cleaning hooks itself. That way user can register is own dependancies and clean all business deps + system deps |
Could you elaborate on this ? i think i didn't get it properly |
It could be a kind of service wich we can pass a trigger (create, delete ...) and a callback wich is invoke when the action is trigger. That way we structurate system cleaning and we will be able to easily open it to user with a registerDependancy method that's fully possible to do it manually for now but it could structure the process and be easier for developpers IMHO For me we address a sytem dependancy in this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a test for this :) otherwise look good to me
… deviceManagerEngine
…Model mappings" This reverts commit d02bcec95877caaa661bafdafb4fbd02ecefe0ca.
77039ad
to
1aa6b54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the state of this PR ?
Waiting for other reviews now that I added tests as requested |
What does this PR do ?
Unassign all the devices from their engineId and assetId in the admin index when the deviceManagerEngine is deleted after the deletion of its collections.
How should this be manually tested?
KZLPRD-511