Skip to content

Draft: Possible refactoring of directory events (1)

Nick Mathewson requested to merge nickm/arti:flag-publish-1 into main

I'm looking for a better way to generate DirEvent streams, so I can toss out the postage dependency. At first, I looked into using async_broadcast, but it seems overkill for these events, since they don't carry any data, and as such don't need to be queued.

Instead we can make multiple events of the same type "coalesce" into a single notification from the recipient's point of view, and thereby make publishing a nonblocking operation without having to use an unbounded queue.

I came up with two possible approaches: this one, and the one in my flag-publish-2 branch. Both are somewhat suspect, due to my lack of futures experience. But that aside...

This approach uses a backend event notification type that generates streams of a single event only. It changes the interface of DirMgr slightly. I think that it might be a decent primitive for use elsewhere, so I've tried to write it in a generic way.

What do you think?

Merge request reports