This commit is contained in:
c-cube 2025-09-08 16:27:32 +00:00
parent 488e21848a
commit dafd06a2fe

View file

@ -5,4 +5,4 @@
<span><span class="optlabel">?now</span>:<a href="../../../mtime/Mtime/index.html#type-t">Mtime.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="optlabel">?timeout</span>:<a href="../../../mtime/Mtime/index.html#type-span">Mtime.span</a> <span class="arrow">&#45;&gt;</span></span>
<span>unit <span class="arrow">&#45;&gt;</span></span>
<span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>make ()</code> is a new batch</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">batch</span> <p>the number of elements after which the batch will be considered <b>full</b>, and ready to pop. Set to <code>0</code> to disable batching. It is required that <code>batch &gt;= 0</code>. Default <code>1</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">high_watermark</span> <p>the batch size limit after which new elements will be <code>`Dropped</code> by <a href="#val-push"><code>push</code></a>. This prevents the queue from growing too fast for effective transmission in case of signal floods. Default <code>if batch = 1 then 100 else batch * 10</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">now</span> <p>the current time. Default <code>Mtime_clock.now ()</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">timeout</span> <p>the time span after which a batch is ready to pop, whether or not it is <b>full</b>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pop_if_ready"><a href="#val-pop_if_ready" class="anchor"></a><code><span><span class="keyword">val</span> pop_if_ready : <span><span class="optlabel">?force</span>:bool <span class="arrow">&#45;&gt;</span></span> <span><span class="label">now</span>:<a href="../../../mtime/Mtime/index.html#type-t">Mtime.t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> list</span> option</span></span></code></div><div class="spec-doc"><p><code>pop_if_ready ~now b</code> is <code>Some xs</code>, where is <code>xs</code> includes all the elements <a href="#val-push"><code>push</code></a>ed since the last batch, if the batch ready to be emitted.</p><p>A batch is ready to pop if it contains some elements and</p><ul><li>batching is disabled, and any elements have been batched, or batching was enabled and at least <code>batch</code> elements have been pushed, or</li><li>a <code>timeout</code> was provided, and more than a <code>timeout</code> span has passed since the last pop was ready, or</li><li>the pop is <code>force</code>d,</li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">now</span> <p>the current time</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">force</span> <p>override the other batch conditions, for when when we just want to emit batches before exit or because the user asks for it</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-push"><a href="#val-push" class="anchor"></a><code><span><span class="keyword">val</span> push : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> list</span> <span class="arrow">&#45;&gt;</span></span> <span>[ `Dropped <span>| `Ok</span> ]</span></span></code></div><div class="spec-doc"><p><code>push b xs</code> is <code>`Ok</code> if it succeeds in pushing the values in <code>xs</code> into the batch <code>b</code>, or <code>`Dropped</code> if the current size of the batch has exceeded the high water mark determined by the <code>batch</code> argument to <a href="#val-make"><code>make</code></a>]. )</p></div></div></div></body></html>
<span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>make ()</code> is a new batch</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">batch</span> <p>the number of elements after which the batch will be considered <b>full</b>, and ready to pop. Set to <code>0</code> to disable batching. It is required that <code>batch &gt;= 0</code>. Default <code>1</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">high_watermark</span> <p>the batch size limit after which new elements will be <code>`Dropped</code> by <a href="#val-push"><code>push</code></a>. This prevents the queue from growing too fast for effective transmission in case of signal floods. Default <code>if batch = 1 then 100 else batch * 10</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">now</span> <p>the current time. Default <code>Mtime_clock.now ()</code>.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">timeout</span> <p>the time span after which a batch is ready to pop, whether or not it is <b>full</b>.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pop_if_ready"><a href="#val-pop_if_ready" class="anchor"></a><code><span><span class="keyword">val</span> pop_if_ready : <span><span class="optlabel">?force</span>:bool <span class="arrow">&#45;&gt;</span></span> <span><span class="label">now</span>:<a href="../../../mtime/Mtime/index.html#type-t">Mtime.t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> list</span> option</span></span></code></div><div class="spec-doc"><p><code>pop_if_ready ~now b</code> is <code>Some xs</code>, where is <code>xs</code> includes all the elements <a href="#val-push"><code>push</code></a>ed since the last batch, if the batch ready to be emitted.</p><p>A batch is ready to pop if it contains some elements and</p><ul><li>batching is disabled, and any elements have been batched, or batching was enabled and at least <code>batch</code> elements have been pushed, or</li><li>a <code>timeout</code> was provided, and more than a <code>timeout</code> span has passed since the last pop was ready, or</li><li>the pop is <code>force</code>d,</li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">now</span> <p>the current time</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">force</span> <p>override the other batch conditions, for when when we just want to emit batches before exit or because the user asks for it</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-push"><a href="#val-push" class="anchor"></a><code><span><span class="keyword">val</span> push : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> list</span> <span class="arrow">&#45;&gt;</span></span> <span>[ `Dropped <span>| `Ok</span> ]</span></span></code></div><div class="spec-doc"><p><code>push b xs</code> is <code>`Ok</code> if it succeeds in pushing the values in <code>xs</code> into the batch <code>b</code>, or <code>`Dropped</code> if the current size of the batch has exceeded the high water mark determined by the <code>batch</code> argument to <code>{!make}</code>. )</p></div></div></div></body></html>