Right now, all data addition or expansion is done strictly by the client. Some transformation is done by Calypso but it is very limited in scope. Therefore issues like #207 will continue to be a problem and the end users won't like this.
Acceptance Criteria
This would be the addition of a new thread to Scylla which intercepts and manipulates socket messages before they are sent. This would strictly add new messages or deny others, it should not mutate existing messages. Extensibility for any sort of data manipulation is key, as well as organization and little performance overhead in the mqtt_processor thread.
Requirements for merge:
does not reduce performance of mqtt processor or cause it to idle busy
Adds a timer method for things charging needs (consult @bracyw)
does not rely on unabstracted code for such timers
Allows to pass through all messages which do not have special hooks very quickly.
Does not mutate existing data, just adds more
Proposed Solution
The best way in my view to add this thread is to split the socket from the mqtt processor. Then, switch the mpsc channel to be broadcast type so two such consumer exist, the db Handler and the metadata injector. This metadata injector would then receive every message and manipulate, add messages, etc. It could use tokio select! patterns as seen in other threads to also run periodic tasks. This metadata counting would be hard coded, which is ugly but it's OK.
Description
Right now, all data addition or expansion is done strictly by the client. Some transformation is done by Calypso but it is very limited in scope. Therefore issues like #207 will continue to be a problem and the end users won't like this.
Acceptance Criteria
This would be the addition of a new thread to Scylla which intercepts and manipulates socket messages before they are sent. This would strictly add new messages or deny others, it should not mutate existing messages. Extensibility for any sort of data manipulation is key, as well as organization and little performance overhead in the mqtt_processor thread.
Requirements for merge:
Proposed Solution
The best way in my view to add this thread is to split the socket from the mqtt processor. Then, switch the mpsc channel to be broadcast type so two such consumer exist, the db Handler and the metadata injector. This metadata injector would then receive every message and manipulate, add messages, etc. It could use tokio select! patterns as seen in other threads to also run periodic tasks. This metadata counting would be hard coded, which is ugly but it's OK.
Depends on #change
Mocks
No response