Allow subscribing to reflector store updates#1426
Conversation
Signed-off-by: Natalie Klestrup Röijezon <nat@nullable.se>
Signed-off-by: Natalie Klestrup Röijezon <nat@nullable.se>
Signed-off-by: Natalie Klestrup Röijezon <nat@nullable.se>
Signed-off-by: Natalie Klestrup Röijezon <nat@nullable.se>
Signed-off-by: Natalie Klestrup Röijezon <nat@nullable.se>
|
hey, just linking this here since I've been working on the same thing main...mateiidavid:kube:matei/arc-watcher I too switched to async-broadcast after our discussion since it's better suited for what we need to do. |
|
Ah, hadn't seen that one. However, that also looks like it prefers to drop messages rather than apply backpressure (https://docs.rs/async-broadcast/latest/async_broadcast/enum.RecvError.html#variant.Overflowed). |
|
I think overflow is disabled by default. It can also be disabled manually (see https://docs.rs/async-broadcast/latest/async_broadcast/struct.Receiver.html#method.overflow). The I actually wanted to send that over to you for a quick sanity check but I guess now's as good a time as any 😂 |
Ahh: https://docs.rs/async-broadcast/latest/src/async_broadcast/lib.rs.html#156, gotcha, looks reasonable.
I assume you mean |
Motivation
This is largely a "shower thoughts" take on #1189 and the discussions from the last office hours.
It still fails
controller::tests::applier_must_not_deadlock_if_reschedule_buffer_fillsand introduces some type safety regressions that I'm not quite sure how to fix.Solution
It introduces a new (internal)
Broadcasterchannel, which has the backpressure and broadcasting properties that we need (async-channelis inappropriate after all since it only sends each message to one receiver).It then adds an interface to
reflector::store::Writerfor subscribing to changes.This all leads to a fair amount of changes to
reflectorand its downstreams to accomodate forWriter::apply_watcher_eventnow being async (so that it can send out the appropriate events).