You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to subscribe to a shared stream after a reflector is created. Unlike the example here, I do not know ahead of times how many times I will need to subscribe, and I may want to subscribe later on in the process (for instance, after I win leader election for a subcontroller).
This is how client-go informers behave, for instance, which can register multiple event handlers dynamically. Note they can also de-register them, which his something we may need to consider (presumably by Dropping them?)
Describe the solution you'd like
Either reflect_shared returns an object (not impl stream) that can subscribe(), reflect_shared doesn't take ownership of Writer, or writer has a fn get_subscriber(&self) -> ThingICanCallSubscriberOn
Describe alternatives you've considered
Build my own abstraction on top. This is tricky because we need the ability for the stream to consist of [objects that already exist,..., new events coming in after we started].
In theory you could do this by doing store.state() and getting the initial snapshot, then adding any updates after that. However, there is a race condition here. client-go does this, but they are able to lock the primary stream/store while they do this.
Documentation, Adoption, Migration Strategy
No response
Target crate for feature
kube-runtime
The text was updated successfully, but these errors were encountered:
Would you like to work on this feature?
maybe
What problem are you trying to solve?
I would like to subscribe to a shared stream after a reflector is created. Unlike the example here, I do not know ahead of times how many times I will need to subscribe, and I may want to subscribe later on in the process (for instance, after I win leader election for a subcontroller).
This is how client-go informers behave, for instance, which can register multiple event handlers dynamically. Note they can also de-register them, which his something we may need to consider (presumably by Dropping them?)
Describe the solution you'd like
Either
reflect_shared
returns an object (notimpl stream
) that can subscribe(),reflect_shared
doesn't take ownership of Writer, or writer has afn get_subscriber(&self) -> ThingICanCallSubscriberOn
Describe alternatives you've considered
Build my own abstraction on top. This is tricky because we need the ability for the stream to consist of
[objects that already exist,..., new events coming in after we started]
.In theory you could do this by doing
store.state()
and getting the initial snapshot, then adding any updates after that. However, there is a race condition here. client-go does this, but they are able to lock the primary stream/store while they do this.Documentation, Adoption, Migration Strategy
No response
Target crate for feature
kube-runtime
The text was updated successfully, but these errors were encountered: