DetectorGraph
2.0
|
DetectorGraph removes from the detectors the responsability (and freedom) to store and serve its state alongside with performing computation. We belive that's a design advantage but that clearly leaves opens a gap of functionality when compared to our current DetectorGraph. That gap needs to be addressed. The following are our current uses of such functionality:
The design constraints for this solution are:
This section lists a few approaches to close that gap.
The most simple solution to this would be to compose the needed state on the Consumer side by subscribing to all events that compose it and inpecting it when needed. This solution has a number of inefficiencies and one major flaw:
The consumer would demand awareness of the boundaries between evaluation passes and only use the state at the end of it. Say Consumer needs to know StateB when it receives an update to StateA, caching would only work if StateB updates are produced before StateA updates - so it's dependent on the order events are emitted. To solve this you'd need a AllEventsEmitted event... you get it: it gets ugly before you can say quick.
Another suggested solution is to allow a consumer to safely introspection topics in between evaluations of the graph. This appears to be the smallest effort solution given the role that topics play on the graph. This approach has a few advantages and disadvantages:
Advantages:
Disadvantages:
We believe the disadvantages outweighs the advantages when it comes to code quality and excellence even though this approach might seem as the smallest effort one.
Following ROS's inspiration, its concept of Services lands itself nicely to the idea of an entity that provides a complete snapshot of the graph's state through a atomic method call. If implemented correctly, a DetectorStateStoreService could ensure state atomicity/consistency as a single-stop shop for all needed states. This solution extends the loose coupling across detectors to consumers (e.g. app).
See GraphStateStore