Flezha.SDK.RouteLatest (flezha_sdk v0.1.0)

Copy Markdown View Source

The single-cell tasklet Flezha.SDK.ChannelBuilder.route_latest/4 expands to: every key seen on the traffic stream receives each distinct document once, on that key's own next traffic item, as a {key, document} pair.

A dynamically keyed tasklet cannot receive a broadcast, and fanning a document out over a remembered key set would emit keys a partitioned member may no longer own. Delivering on the key's own traffic emits only keys that traffic just proved this member owns, at the price of one tick of latency per key. A key never seen in traffic receives nothing.

The document is opaque: retained and compared with ==, never parsed. One equal to the retained document is inert; a different one replaces it and bumps the version, so every key is owed a delivery again. The state %{document, version, delivered} rides the change journal like any tasklet's.