|
115 | 115 | <a href="#redis"><span class="at">§</span>redis</a> |
116 | 116 | <a href="#transports"><span class="at">§</span>Native transports</a> |
117 | 117 | <a href="#limiting"><span class="at">§</span>Admission control</a> |
118 | | -</nav><button class="theme-btn" id="theme">◐ toggle theme</button><div class="side-foot"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><a href="https://mooncakes.io/docs/Lfan-ke/moonzero"><img alt="mooncakes" src="https://img.shields.io/badge/mooncakes-Lfan--ke%2Fmoonzero-1f6feb"></a></div></aside> |
119 | | -<main><header class="hero"><h1>moonzero</h1><p class="tag">A service framework for MoonBit — config-driven assembly of a moonapi app with middleware into a runnable AsgiApp, the way go-zero does for Go. Backend-agnostic; served by mooncat.</p><div class="badges"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><img alt="tests" src="https://img.shields.io/badge/tests-110%20passing-0ca678"><a href="https://github.com/moonbitstack/moonzero"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-source-24292f?logo=github"></a><img alt="license" src="https://img.shields.io/badge/license-Apache--2.0-6d5efc"></div><div class="install"><span class="prompt">$</span><code>moon add Lfan-ke/moonzero</code><button class="copy" data-copy="moon add Lfan-ke/moonzero">copy</button></div><div class="contract"><h2><span class="spark">✶</span> The contract at a glance</h2><pre><span class="k">let</span> conf = <span class="ty">ServiceConf</span>::new(name="greet", port=8888) |
| 118 | +</nav><button class="theme-btn" id="theme">◐ toggle theme</button><div class="side-foot"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><a href="https://mooncakes.io/docs/moonbitstack/moonzero"><img alt="mooncakes" src="https://img.shields.io/badge/mooncakes-Lfan--ke%2Fmoonzero-1f6feb"></a></div></aside> |
| 119 | +<main><header class="hero"><h1>moonzero</h1><p class="tag">A service framework for MoonBit — config-driven assembly of a moonapi app with middleware into a runnable AsgiApp, the way go-zero does for Go. Backend-agnostic; served by mooncat.</p><div class="badges"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><img alt="tests" src="https://img.shields.io/badge/tests-110%20passing-0ca678"><a href="https://github.com/moonbitstack/moonzero"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-source-24292f?logo=github"></a><img alt="license" src="https://img.shields.io/badge/license-Apache--2.0-6d5efc"></div><div class="install"><span class="prompt">$</span><code>moon add moonbitstack/moonzero</code><button class="copy" data-copy="moon add moonbitstack/moonzero">copy</button></div><div class="contract"><h2><span class="spark">✶</span> The contract at a glance</h2><pre><span class="k">let</span> conf = <span class="ty">ServiceConf</span>::new(name="greet", port=8888) |
120 | 120 | <span class="k">let</span> server = <span class="ty">Server</span>::new(conf, app).use_(logging) |
121 | 121 |
|
122 | 122 | server.describe() // "greet listening on 0.0.0.0:8888" |
|
580 | 580 | <div class="item" data-k="item"><span class="kind">item</span><pre class="sig"><span class="k">async</span> <span class="k">fn</span> <span class="ty">RedisPeriodLimit</span>::take( self : <span class="ty">RedisPeriodLimit</span>, key : <span class="ty">String</span>) <span class="op">-></span> <span class="ty">PeriodResult</span> raise <span class="ty">RedisError</span></pre><p class="doc">Account for one request under <code>key</code> and report its outcome, in the same three states the local limiter reports. A code the script cannot have returned, or a reply that is not an integer at all, raises — go-zero answers <code>Unknown</code> with <code>ErrUnknownCode</code> there, and a caller has to decide what an undecided limiter means.</p></div> |
581 | 581 | <div class="item" data-k="fn"><span class="kind">fn</span><pre class="sig"><span class="k">fn</span> redis_period_limit( limiter : <span class="ty">RedisPeriodLimit</span>, key<span class="op">?</span> : <span class="ty">String</span> = "global") <span class="op">-></span> <span class="ty">Middleware</span></pre><p class="doc">Fixed-window rate-limit middleware over a shared redis: <code>period_limit</code> with the window in redis, so replicas behind one redis spend one quota between them. A redis that cannot be reached admits the request — the limiter is a guard on the service, not a dependency that should be able to close it.</p></div> |
582 | 582 | </section> |
583 | | -<footer>Generated from source <code>///</code> doc-comments · <a href="https://mooncakes.io/docs/Lfan-ke/moonzero">mooncakes</a> · <a href="https://github.com/moonbitstack/moonzero">GitHub</a> · Apache-2.0 © Leo Cheng</footer> |
| 583 | +<footer>Generated from source <code>///</code> doc-comments · <a href="https://mooncakes.io/docs/moonbitstack/moonzero">mooncakes</a> · <a href="https://github.com/moonbitstack/moonzero">GitHub</a> · Apache-2.0 © Leo Cheng</footer> |
584 | 584 | </main></div><script> |
585 | 585 | document.addEventListener("DOMContentLoaded",()=>{ |
586 | 586 | document.querySelectorAll("[data-copy]").forEach(btn=>btn.addEventListener("click",()=>{ |
|
0 commit comments