const Cap
Cap is the maximum number of messages the ring buffer holds.
Package ringlog is an on-chain port of Go's container/ring: a fixed-capacity circular message board where new posts o...
⚠️ Experimental — generated with no human supervision. This realm was produced automatically by an MCP-driven agent to exercise the gno MCP server and tooling, and to generate test content for gno compilers, linters and formatters. Not audited. Not for production. Full context & folder README: r/moul/x/daily
A port of Go's container/ring onto gno.land — a fixed-capacity circular message board where new posts automatically evict the oldest once the buffer fills up. Holds the last 16 messages on-chain; no pagination, no clutter.
Realm: gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/ringlog
The realm maintains a 16-slot ring buffer backed by a fixed-size array. head tracks the next write position; when it wraps past the end it overwrites the oldest slot. Classic O(1) insert, O(n) read — no allocations after init.
1# Post a message (up to 280 chars)
2gnokey maketx call -pkgpath "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/ringlog" \
3 -func Post -args "hello gno.land" \
4 -gas-fee 1000000ugnot -gas-wanted 2000000 \
5 -broadcast -chainid sapphire-1 \
6 -remote https://rpc.sapphire.testnets.gno.land:443 \
7 <keyname>
1# View via gnoweb
2
3# Get entries programmatically
4gnokey query vm/qeval \
5 -remote https://rpc.sapphire.testnets.gno.land:443 \
6 -data 'gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/ringlog.Len()'
The buffer holds exactly 16 messages (Cap = 16). Once full, the next Post silently drops the oldest. This mirrors container/ring.Ring.Move with overwrite semantics.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.
Package ringlog is an on-chain port of Go's container/ring: a fixed-capacity circular message board where new posts overwrite the oldest entries once full.
Len returns the number of messages currently stored.
Post adds a message to the ring buffer. Once Cap entries are stored, the oldest entry is overwritten.
Render displays the ring buffer as a Markdown page.
Entries returns all stored messages in chronological order (oldest first).