package octez-libs
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053
doc/octez-libs.stdlib/Tezos_stdlib/Lwt_pipe/Unbounded/index.html
Module Lwt_pipe.UnboundedSource
Unbounded is a variant of Bounded where there is no size limit. It is equivalent to using Bounded with compute_size = Fun.const 0 but some functions are specialised to this particular setup.
Type of queues holding values of type 'a.
push q v: v is added immediately to q.
Note that pushing never needs to wait for room to be available inside the pipe. As a result, push returns unit. This is unlike Bounded.push, where Bounded.push may need to wait for some space to be freed inside the pipe and thus returns unit Lwt.t.
pop q is a promise that is pending until there is at least one element in q. When this happens an element is removed and the promise is fulfilled with it.
If there is already an element in q when the call is made, the element is removed immediately and an already resolved promise is returned.
pop_with_timeout t q is a promise that behaves similarly to pop q except that it resolves with None if t resolves before there is an element in q to pop.
Note that there can be multiple promises that are awaiting for an element to pop from the queue. As a result, it is possible that pop_with_timeout is fulfilled with None even though values have been pushed to the q.
t is canceled (i.e., it fails with Canceled) if an element is returned.
pop_all q is a promise that is pending until there is at least one element in q. When this happens, all the elements of q are removed and the promise is fulfilled with the list of elements (in the order in which they were inserted).
If there is already one or more elements in q when the call is made, the elements are removed immediately and an already resolved promise is returned.
In practice, this function returns a promise that either:
- is pending and will resolve with a single-element list,
- is already resolved with a list of at least one element,
- or will be rejected with
Closed.
pop_all_now q removes and returns all the elements in q (in the order in which they were inserted). If q is empty, [] is returned.
peek q returns the same value as pop q but does not remove the returned element.
peek_all_now q returns the elements in the q (oldest first), or [] if empty. It does not remove elements from q.
pop_now q may remove and return the first element in q if q contains at least one element.
close q the write-end of q:
- Future write attempts will fail with
Closed. - If there is data left in the pipe, then future read attempts will be resolved until the remaining data is drained, after which further reads will fail with
Closed. - If there is no data left in the pipe, then pending and future reads will fail with
Closed.
The close function is idempotent.