Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v0 source realm

Package ringlog is an on-chain port of Go's container/ring: a fixed-capacity circular message board where new posts o...

Readme View source

RingLog

⚠️ 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

How it works

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.

Transactions

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>

Queries

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()'

Capacity

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.

Overview

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.

Constants 1

const Cap

1const Cap = 16
source

Cap is the maximum number of messages the ring buffer holds.

Functions 4

func Len

Action
1func Len() int
source

Len returns the number of messages currently stored.

func Post

Action
1func Post(msg string)
source

Post adds a message to the ring buffer. Once Cap entries are stored, the oldest entry is overwritten.

func Render

1func Render(path string) string
source

Render displays the ring buffer as a Markdown page.

func Entries

Action
1func Entries() []Entry
source

Entries returns all stored messages in chronological order (oldest first).

Types 1

type Entry

struct
1type Entry struct {
2	Author  address
3	Message string
4	Height  int64
5}
source

Entry is a single posted message.

Imports 4

  • chain/runtime stdlib
  • chain/runtime/unsafe stdlib
  • strconv stdlib
  • strings stdlib

Source Files 3