Open kriskowal opened 1 year ago
We decided this was the the form of pubsub that we wanted to expose in the Pet Dæmon. It’s currently living as an exported library of the daemon
until it can be replaced with the notifiers from Agoric.
I’m inclined at this point to bring this idea back into @endo/streams
and find a forward-compatibility story that allows things that currently can be iterated to eventually have proper pub-sub on the wire by dint of an alternate light-client. attn @michaelfig
The Endo Dæmon
packages/daemon
needs a minimal pubsub mechanism which can be based on the@endo/stream
async iterator design using three possible variations on an async singly-linked-list queue:makeLatestTopic
such that any published value may be dropped and replaced and only observed if subscribers are polling faster than updates. New subscribers see the most recently published value immediately then each subsequent request for an iteration waits for a fresher value, so the sequence they see may be a subsequence of the published values in order and without duplicates.makeChangeTopic
. Subscribers would see every delta published after getting a subscription. This is useful for differential updates but can’t be lossy.makeUpdateTopic
. Subscribers receive the most recently published value and also see every intermediate value. We would probably want to encourage users ofmakeUpdateTopic
to instead usemakeLatestTopic
ormakeChangeTopic
depending on whether they’re publishing a time series or time series deltas.I’ve created this ticket to track work ongoing in #1432.