abstract sequencing protocol for completion of multiple processes/producers.
2 1 0

Clone this repository

https://tangled.org/jauntywk.bsky.social/mpsc-completion https://tangled.org/did:plc:zjbq26wybii5ojoypkso2mso/mpsc-completion
git@knot.tangled.wizardry.systems:jauntywk.bsky.social/mpsc-completion git@knot.tangled.wizardry.systems:did:plc:zjbq26wybii5ojoypkso2mso/mpsc-completion

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

mpsc-completion#

An abstract multi-producer single-receiver sequencing-protocol for converging / synchronizing multiple processes as completed

Protocol#

The objective of this protocol is to allow a receiver of messages to know when every participant has completed their work.

  1. The receiever ought make available an idempotent mpsc-completion-hello message and a mpsc-completion-done that consumers can easily send.
    • An optional name attribute may be provided to identify the participant. if the name is heirarchical, colon separation is recommended.
  2. Each client transmits a mpsc-completion-hello message when it begins it's process, at an early opportunity.
  3. Clients send data or do work as usual.
  4. Clients send a mpsc-completion-done message when they terminate
  5. Receiever knows to expect no new messages if it has the same number of mpsc-completion-hello messages as mpsc-completion-done messages.

Notes:#

  • Supervisor processes that can spawn producing processes should fire a mpsc-completion-hello if they wish to keep the channel open.
  • ExtendableEvent#waitUntil in ServiceWorkers allows multiple event listeners to signal when they are done processing an event, allowing for long running execution before the event is fully processed / consumed.