Lwt_pipe.Maybe_boundedSourceMaybe_bounded are pipes that may or may not be bounded. This is decided when createing the pipe and can be queried with the bounded function.
Type of queues holding values of type 'a.
create ~bound:(max_size, compute_size) () is an empty queue that can hold max bound "bytes" of data, using compute_size to compute the number of "bytes" in a datum. I.e., it is equivalent to Bounded.create ~max_size ~compute_size but the functions below make no assumptions about the bound leading to a slightly different interface and potentially worse performances.
create (), with the bound argument no set, is an empty queue that is unbounded. I.e., it is equivalent to Unbounded.create () but the functions below make no assumptions about the bound leading to a slightly different interface and potentially worse performances.
push q v is a promise that is pending until there is enough space in q to accommodate v. When this happens v is added to the end of q and the promise resolves.
If there is enough space in q to accommodate v when the call is made, then the v is added immediately and an already resolved promise is returned.
Note that if several writes are stuck because the pipe is full. These writes will succeed in an order that might be different from the order the write attempts were made. Specifically, when pushing elements of different computed sizes, smaller pushes may be resolved earlier if enough space is freed.
pop q is a promise that is pending until there is an 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 an 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 an element in q when the call is made, the elements are removed immediately and an already resolved promise is returned.
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.
push_now q v either
v at the ends of q immediately and returns true, orq is full, returns false.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:
Closed.Closed.Closed.The close function is idempotent.
The number of bytes used in the internal representation to hold an element in the queue.