ComponentStatus
- to stream, or not to stream
#266
Replies: 1 comment
-
I guess this discussion is broader, at some point (probably not too far in the future) we'll need to be notified of any changes in the component graph. See: So my feeling is we should have a streaming RPC to get notified about any This might be similar to https://github.com/frequenz-floss/frequenz-api-dispatch/ where we have a If we unify the approach, we could even have a common client implementation to do this (get a snapshot and subscribe to updates). FYI @Marenz as you implemented this in dispatch. |
Beta Was this translation helpful? Give feedback.
-
The
ComponentStatus
enum is used only in theComponent
message.The gRPC APIs that use the
Component
message only use it in simple RPCs (e.g. here). This means that clients can pick up updates to theComponentStatus
field only via polling, instead of streaming. This could lead to instances where clients do not notice the update after long delays, or not at all.Let's assume that
ComponentStatus
exists in the streaming data output. Then, as soon as it changes toINACTIVE
, we will stop reading data form the component. This will result in no further data in the output stream. This, in turn, means that clients won;t be updated about theComponentStatus
changing toINACTIVE
. This means that theComponentStatus
field has to exist in theComponent
message, where it can always be polled.This still does not mean that
ComponentStatus
cannot be streamed, given future context. We are internally deciding to extend this enum to contain more states related to granular read/write abilities on the components. If a client could write to a component, and that component would suddenly becomes read-only, it might be better to stream theComponentStatus
to the client, instead of the client getting an error and then polling the API to find out what's happening.So the question boils down to if API services should actively notify clients of changes in
ComponentStatus
, and if yes, then how?Beta Was this translation helpful? Give feedback.
All reactions