-
Notifications
You must be signed in to change notification settings - Fork 55
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
refactor: add OperationHandlerActor #3032
base: main
Are you sure you want to change the base?
Conversation
7875d6a
to
be8879a
Compare
be8879a
to
c345ca5
Compare
Robot Results
|
c345ca5
to
67e8852
Compare
Codecov ReportAttention: Patch coverage is Additional details and impacted files📢 Thoughts on this report? Let us know! |
67e8852
to
2953d56
Compare
2953d56
to
44ef55b
Compare
Honestly speaking, I'm pretty much lost in the design level, what the roles of From the code, I see still converter is responsible for accepting c8y's operation MQTT messages (JSON over MQTT topic) and converting and publishing the thin-edge command format message ( I was actually expecting that one actor is addressing all the operation related things, including the conversion from c8y JSON over MQTT / SmartREST (only for custom operations) to thin-edge commands. But the core issue is not this level. I believe we need a clear picture, how many components we will have, which component is connected to another component with directions (one-way or both ways). @albinsuresh made a proposal before, but it was a proposal. We don't have a design conclusion somewhere as reference of what you're doing (remark: "conclusion" not a stone, changeable during implementation, but overview of the refactoring). Without it, it's difficult to review because I'm unsure what I am requested to check... |
A preliminary OperationHandlerActor which still uses OperationHandler underneath, but receives command messages using the actor runtime. This initial implementation shows the limitations of the entity store, which is now a part of CumulocityConverter, and other actors don't have any access to it. Because OperationHandlerActor needs some information about a registered entity (smartrest publish topic), I have added another `MessageSource<(MqttMessage, EntityMetadata)>` impl to the `C8yMapperActor`, but this obviously very hacky. When moving more things out of CumulocityConverter into other actors, we'll need some organized way to access entity metadata (and entity store) from other actors. First thing that comes to mind is making an `EntityStoreActor` that manages the entity store and allows queries and updates to the store via incoming messages. But we probably shouldn't allow all actors to modify the entity store freely, and we'll need to make sure what to do when entities are deleted or updated. Signed-off-by: Marcel Guzik <[email protected]>
44ef55b
to
83f6847
Compare
Signed-off-by: Marcel Guzik <[email protected]>
Proposed changes
A preliminary OperationHandlerActor which still uses OperationHandler underneath, but receives command messages using the actor runtime.
This initial implementation shows the limitations of the entity store, which is now a part of CumulocityConverter, and other actors don't have any access to it. Because OperationHandlerActor needs some information about a registered entity (smartrest publish topic), I have added another
MessageSource<(MqttMessage, EntityMetadata)>
impl to theC8yMapperActor
, but this obviously very hacky.When moving more things out of CumulocityConverter into other actors, we'll need some organized way to access entity metadata (and entity store) from other actors. First thing that comes to mind is making an
EntityStoreActor
that manages the entity store and allows queries and updates to the store via incoming messages.But we probably shouldn't allow all actors to modify the entity store freely, and we'll need to make sure what to do when entities are deleted or updated.
Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments