Skip to content

Commit 3db7368

Browse files
committed
Updated docs with more accurate upstream-closing behavior
1 parent db8d97f commit 3db7368

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

doc/stream.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ true
118118

119119
Here, we create a source stream `s`, and map `inc` and `dec` over it. When we put our message into `s` it immediately is accepted, since `a` and `b` are downstream. All messages put into `s` will be propagated into *both* `a` and `b`.
120120

121-
If `s` is closed, both `a` and `b` will be closed, as will any other downstream sources we've created. Likewise, if everything downstream of `s` is closed, `s` will also be closed. This is almost always desirable, as failing to do this will simply cause `s` to exert backpressure on everything upstream of it. However, If we wish to avoid this behavior, we can create a `(permanent-stream)`, which cannot be closed.
121+
If `s` is closed, both `a` and `b` will be closed, as will any other downstream sources we've created. Likewise, if everything downstream of `s` is closed, `s` will also be closed, once it's unable to `put!` anywhere. This is almost always desirable, as failing to do this will simply cause `s` to exert backpressure on everything upstream of it. However, if we wish to avoid this behavior, we can create a stream using `stream*` and `:permanent? true`, which cannot be closed.
122122

123123
For any Clojure operation that doesn't have an equivalent in `manifold.stream`, we can use `manifold.stream/transform` with a transducer:
124124

src/manifold/stream.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@
305305
Optionally takes a map of parameters:
306306
307307
|:---|:---
308-
| `upstream?` | if closing the sink should always close the source, even if there are other sinks downstream of the source. Defaults to `false`. Note that if the sink is the only thing downstream of the source, the source will always be closed, unless it is permanent.
309-
| `downstream?` | if closing the source will close the sink. Defaults to `true`.
310-
| `timeout` | if defined, the maximum time, in milliseconds, that will be spent trying to put a message into the sink before closing it. Useful when there are multiple sinks downstream of a source, and you want to avoid a single backed up sink from blocking all the others.
311-
| `description` | describes the connection, useful for traversing the stream topology via `downstream`."
308+
| `upstream?` | Whether closing the sink should always close the source, even if there are other sinks downstream of the source. Defaults to `false`. Note that if the sink is the only thing downstream of the source, the source will eventually be closed, unless it is permanent.
309+
| `downstream?` | Whether closing the source will close the sink. Defaults to `true`.
310+
| `timeout` | If defined, the maximum time, in milliseconds, that will be spent trying to put a message into the sink before closing it. Useful when there are multiple sinks downstream of a source, and you want to avoid a single backed-up sink from blocking all the others.
311+
| `description` | Describes the connection, useful for traversing the stream topology via `downstream`."
312312
{:arglists
313313
'[[source sink]
314314
[source
@@ -336,7 +336,7 @@
336336

337337
(defn stream
338338
"Returns a Manifold stream with a configurable `buffer-size`. If a capacity is specified,
339-
`put!` will yield `true` when the message is in the buffer. Otherwise it will only yield
339+
`put!` will yield `true` when the message is in the buffer. Otherwise, it will only yield
340340
`true` once it has been consumed.
341341
342342
`xform` is an optional transducer, which will transform all messages that are enqueued

0 commit comments

Comments
 (0)