Realm

v0

gno.land/r/moul/x/daily/bidimapdemo/v0

Render

Bidirectional Map

Unique in both directions, demoing the p/moul/x/daily/bidimap library.

Roles

personrole
aliceadmin
bobauditor
caroltreasurer

Both directions are O(1)

  • Get("bob") → auditor
  • GetKey("treasurer") → carol — the reverse index, not a scan

Displacing a binding

Both sides are unique, so giving alice the auditor role cannot simply be written — bob already holds it, and alice already holds admin. Put replaces, and reports what it displaced:

displaced keydisplaced value
aliceadmin
bobauditor
personrole
aliceauditor
caroltreasurer

bob is now unassigned and the admin role is vacant — one call, both indexes still agreeing.

Refusing instead

PutUnique makes the other choice: it declines rather than displace.

  • PutUnique("dave", "auditor") → false — the role is taken
  • PutUnique("dave", "secretary") → true — both sides free
personrole
aliceauditor
caroltreasurer
davesecretary

Keys come back sorted, never in map order: gno map iteration order is unspecified, and a page built from one can differ between nodes — a consensus bug, not a cosmetic one.

Transactions

No indexed transactions for this realm yet.

Calls, deploys, and child packages in indexed history.

Call function

Calls stay disabled until vm/qfuncs lists this package. Delve only submits functions the chain publishes for gno.land/r/moul/x/daily/bidimapdemo/v0.

Source (qfile)