lamina.api documentation
bridge
fn
A generalization of bridge-join and bridge-siphon. Takes one src channel, and one or
more downstream dsts channels. All messages from src will be passed into callback, which
may or may not forward it to the downstream channels.
This represents a relationship between channels which may or may not always result in messages propagating downstream. This can be useful when certain channels are only used for specific types of messages, or there is an accumulation of messages, or anything else that is more complex than receive -> emit.
bridge-accumulate
fn
A variant of bridge which is designed to handle functions which accumulate multiple
messages via :accumulator and periodically emit a value via :emitter.
bridge-in-order
fn
A variant of bridge which guarantees that messages will be processed one at a time. Useful for
any operation which is sensitive to ordering, or difficult to write concurrently.
Returns dst, which may be nil if the operation doesn't result in a derived stream.
By default, closing src will close dst, but not vise-versa.
Required parameters:
:callback - the callback which receives each message, after :predicate returns true.
Optional parameters:
:predicate - a predicate which takes the next message, and returns whether it should be consumed. If false,
dst is closed.
:on-complete - a callback which is invoked with zero parameters once the bridge is closed, but before dst is closed.
:close-on-complete? - if true, forces an upstream connection, where closing dst closes src.
:wait-on-callback? - if true, waits until the result from callback is realized before proceeding to the next message.
bridge-join
fn
A bridge between one src and one dst channel which is bidirectional.
bridge-siphon
fn
A bridge between one src and one dst channel only propagates closing upstream.
connect
fn
A generalization of siphon and join, making sure that all messages in src will be forwarded
to dst.
If upstream? is true, when dst is closed, src will be closed. This is true for siphon and join.
If downstream? is true, when src is closed, dst will be closed. This is true for join.
The same behavior is also used for propagating error states.