The consumer side of a subscription: pull the next event, or stop pulling.
Future is the lingua franca here on purpose. It is in the standard library, it exists on both JVM and JS, and it lets every adapter bridge its own effect — cats-effect IO, direct-style ox, pekko materialization — without any of those concepts leaking into this module.
Buffering lives behind this interface rather than in front of it: coalescing latest-value streams and failing bounded delta buffers on overflow are subtle enough that reimplementing them once per stream library would be several chances to get it wrong.
The token is how a Future-returning API becomes abortable at all. Future has no cancellation of its own, so an effect system that needs to interrupt a parked pull — an fs2 .timeout, a cancelled Resource.use, a runtime shutting down — has nothing to pull the plug on unless the capability is passed in. Adapters bridge their own cancellation onto this token; without it they can only mask cancellation and hang.
Cancelling a pull does not end the subscription: the next pull starts a fresh wait. cancel is what ends the subscription.
Single-consumer: exactly one caller pulls at a time, per source. Pulling again while a pull is outstanding returns the same future — so cancelling one cancels both.
Pull with nothing to cancel on. Convenient for synchronous callers and tests; anything that may need to interrupt a parked wait should pass a real token.
Pull with nothing to cancel on. Convenient for synchronous callers and tests; anything that may need to interrupt a parked wait should pass a real token.