moonpool/lwt/Lwt_throttle/Make/index.html
2025-09-26 19:08:06 +00:00

2 lines
4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Make (lwt.Lwt_throttle.Make)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../index.html">Index</a> &#x00BB; <a href="../../index.html">lwt</a> &#x00BB; <a href="../index.html">Lwt_throttle</a> &#x00BB; Make</nav><header class="odoc-preamble"><h1>Module <code><span>Lwt_throttle.Make</span></code></h1></header><div class="odoc-tocs"><nav class="odoc-toc odoc-local-toc"><ul><li><a href="#parameters">Parameters</a></li><li><a href="#signature">Signature</a></li></ul></nav></div><div class="odoc-content"><h2 id="parameters"><a href="#parameters" class="anchor"></a>Parameters</h2><div class="odoc-spec"><div class="spec parameter anchored" id="argument-1-H"><a href="#argument-1-H" class="anchor"></a><code><span><span class="keyword">module</span> </span><span><a href="argument-1-H/index.html">H</a></span><span> : <a href="../../../ocaml/Stdlib/Hashtbl/module-type-HashedType/index.html">Stdlib.Hashtbl.HashedType</a></span></code></div></div><h2 id="signature"><a href="#signature" class="anchor"></a>Signature</h2><div class="odoc-spec"><div class="spec type anchored" id="type-key"><a href="#type-key" class="anchor"></a><code><span><span class="keyword">type</span> key</span><span> = <a href="argument-1-H/index.html#type-t">H.t</a></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create : <span><span class="label">rate</span>:int <span class="arrow">&#45;&gt;</span></span> <span><span class="label">max</span>:int <span class="arrow">&#45;&gt;</span></span> <span><span class="label">n</span>:int <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Creates a rate limiter.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">rate</span> <p>Maximum number of promise resolutions per second, per channel.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">max</span> <p>Maximum number of pending promises allowed at once, over all channels.</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">n</span> <p>Initial size of the internal channel hash table. This should be approximately the number of different channels that will be used.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-wait"><a href="#val-wait" class="anchor"></a><code><span><span class="keyword">val</span> wait : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-key">key</a> <span class="arrow">&#45;&gt;</span></span> <span>bool <a href="../../Lwt/index.html#type-t">Lwt.t</a></span></span></code></div><div class="spec-doc"><p><code>Lwt_throttle.wait limiter channel</code> returns a new promise associated with the given rate limiter and channel.</p><p>If the maximum number of pending promises for <code>limiter</code> has <em>not</em> been reached, the promise starts pending. It will be resolved with <code>true</code> at some future time, such that the rate limit of <code>limiter</code> is not exceeded, with respect to other promises in the same <code>channel</code>.</p><p>If the maximum number of pending promises has been reached, the returned promise is already resolved with <code>false</code>.</p></div></div></div></body></html>