Repository navigation
ADR 20_cfg module
MaxThom edited this page Feb 21, 2025
·
1 revision
- New schema annotation, Teleconfig
- No need of reported properties annotation
- From Server
- Work similar to commands
- Write the proto message to the twin at the same time
- Write all values to the twin, so no omit empty
- Must do test with null or not
- From device sdk
- you have a handler for desired properties
- you can return a proto message which is reported properties
- you can return nil which will be void
- you cannot return an error
- you have an handler for reported properties
- on boot, you retrieve the desired properties
- you cache the desired properties on the device
- From CLI
- Edit twin directly or cfg section like cmd and tlm or both
- Cfg
- send a cfg similar to command, it would be exactly the same
- Twin
- Must detect if changes are in desired properties, if so, redirect to cfg
- From CFG
- From listen to device update event
- Core module must send the device update event with what has changed so CFG module can send the new config.
- If coming from core module, no need to write to db
- Send to device
- DesiredProperties event
- From CFG API
- Write to store
- Send to device
- DesiredProperties event
Core module, events on all update or split by spec, properties, status
From core api, if modif to desired properties, sent to cfg module before coming back to core to finish reply to users. set desired to null so no double write
Should it be tied to proto or else? or only json and part of core?
- Using go_tag_inject and introduce json and yaml tag The domain
using normal go struct, no way to distinguish between set to delete and empty
Key takeaways of exploring direct JSON to Surrealdb:
- really difficul to cover all cases of json manipulation and go struct
what could be done is to have the device object has the parameter to the update method we could then change the update proto to be either a structpb.Struct or a byte array of a json string