From dc1fe8ba67996dfb65f5dee2f60e3fcc428b1673 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 24 Sep 2020 19:58:48 +0200 Subject: [PATCH] clarify message ID per topic, and default function --- pubsub/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pubsub/README.md b/pubsub/README.md index 7613a69..c438a6c 100644 --- a/pubsub/README.md +++ b/pubsub/README.md @@ -149,13 +149,17 @@ and ## Message Identification To uniquely identify a message in a set of topics, a `message_id` is computed based on the message. -This can be configured on the application layer, as `message_id_fn(*Message) => message_id`, -which generally fits in two flavors: -- **origin-stamped** messaging: the concatenation of the `seqno` and `from` fields +This can be configured on the application layer, as `message_id_fn(*Message) => message_id`. +A `message_id_fn` may conditionally call different `message_id_fn` implementations per topic (or group thereof). + +The message ID approach generally fits in two flavors: +- **origin-stamped** messaging: the combination of the `seqno` and `from` fields uniquely identifies a message based on the *author*. - **content-stamped** messaging: a message ID derived from the `data` field uniquely identifies a message based on the *data*. +The default `message_id_fn` is origin-stamped, and defined as the string concatenation of `from` and `seqno`. + If fabricated collisions are not a concern, or difficult enough within the window the message is relevant in, a `message_id` based on a short digest of inputs may benefit performance.