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

home state

Back to all declarations

admin

.uverse.address

admin is the only address allowed to write. Deliberately a constant and not transferable ownership: this realm is one person's profile page, and the same address is the only one the chain lets redeploy it.

Value

<gnolang.StringValue>

layoutSlug

untyped string

layoutSlug names the slot used as the page template.

Value

"layout"

realmPath

untyped string

realmPath is this realm's own path. Written out rather than read from unsafe.CurrentRealm() because it is also the interface with gnoweb (see the package doc): the constant is the thing that must not drift, so it is stated once and every other use points here.

Value

"gno.land/r/moul/home"

maxSlugLen

untyped bigint

maxSlugLen bounds a slug so an index row stays readable and a key stays cheap.

Value

(64 <untyped> bigint)

rev

int

// total number of writes, bumped by every mutation

Value

14

slot

type

Value

home.slot

reservedSlugs

[]string (len=12)

reservedSlugs are placeholder names computed at render time from chain state. A slot may not take one, because it would shadow the computed value and make the page depend on callback registration order. The scan.\* half comes from scan.gno's scanPlaceholders and the :reactions: one from reactions.gno, so adding a placeholder in either file reserves it here and cannot be forgotten.

Open
OID
0517a5…9759:258
reservedSlugs details (len=12)

+12 more Inspect slice

validSlug

func(slug string) bool

validSlug reports whether slug is a legal slot name: 1..maxSlugLen bytes of \[a-z0-9.\_-]. The character set excludes ':' so a slug can never break out of its own :slug: placeholder, and excludes uppercase so a slot has one name.

Open
OID
0517a5…9759:261
validSlug details

Inspect func

assertWritableSlug

func(slug string)
Open
OID
0517a5…9759:262
assertWritableSlug details

Inspect func

Set

func(slug string, body string)

Set creates or replaces the slot named slug. This is the ordinary update: one slot, one transaction. Passing the empty body keeps the slot but empties it; use Delete to remove it.

Open
OID
0517a5…9759:263
Set details

Inspect func

Append

func(slug string, body string)

Append adds to the end of a slot, creating it when absent. It exists for content too large to fit in one transaction: Set the first chunk, Append the rest. Ordinary updates should use Set, which is idempotent.

Open
OID
0517a5…9759:264
Append details

Inspect func

Delete

func(slug string)

Delete removes a slot. Deleting the layout slot restores the built-in default layout.

Open
OID
0517a5…9759:265
Delete details

Inspect func

Get

func(slug string) string

Get returns a slot body, or "" when the slot does not exist.

Open
OID
0517a5…9759:266
Get details

Inspect func

Revision

func() int

Revision returns the total number of writes this realm has accepted. It changes on every mutation, so a client can cheaply tell "nothing moved".

Open
OID
0517a5…9759:267
Revision details

Inspect func

Manifest

func() string

Manifest returns one tab-separated line per slot: <slug>\t<rev>\t<len>\t<sha256 of body, hex> It is the diff surface tools/gnohome queries with vm/qeval: one read tells it exactly which local file is out of date, without downloading any body.

Open
OID
0517a5…9759:268
Manifest details

Inspect func

reactionsPlaceholders

[]string (len=1)

reactionsPlaceholders are the reserved slugs this file answers for. Listed in reservedSlugs (home.gno) so a slot can never take one of these names and shadow the computed value.

Open
OID
0517a5…9759:270
reactionsPlaceholders details (len=1)

+1 more Inspect slice

registerReactionCallbacks

func(r *v0.Replacer)

registerReactionCallbacks adds the reaction placeholder to r. dynreplacer only invokes a callback whose placeholder actually occurs in the layout, so a layout that does not use :reactions: never calls into the reactions realm at all. RenderBlockFor is used rather than the zero-argument RenderBlock, for the same reason config.TopBlockFor is (see render.gno): the zero-argument form reads the caller off the stack, which would be correct here, but this realm already states its own path as a constant and passing it cannot be wrong.

Open
OID
0517a5…9759:271
registerReactionCallbacks details

Inspect func

defaultLayout

untyped string

defaultLayout is what renders before a layout slot exists, which is not only the very first deploy: a redeploy re-runs init() and wipes every slot, so this is also the page at the exact moment someone is restoring it. It uses only computed placeholders, so it never shows an unresolved :slug: of its own. It prints no gnokey command and no gas numbers, on purpose. The one it used to print offered 1000000ugnot against 20000000 gas: a ratio of 0.05 against a mainnet floor of 0.001, and gas\_fee is deducted in full as offered and never refunded, so it asked for about fifty times what the write costs. The tooling was corrected and this string was not, which is the argument against having it at all. A command baked into a realm cannot be fixed without a redeploy, and the redeploy is the thing that wipes the slots. gnohome recomputes it from content/ and from the chain, so it cannot go stale.

Value

"# gno.land/r/moul/home\n\nNo layout slot yet. A redeploy wipes every slot and `content/` is the source\nof truth, so push them back with the tool rather than by hand:\n\n go -C tools tool gnohome tx -all\n\nNo gas numbers here on purpose: a command written int"...

Render

func(path string) string

Render serves three views: "" the assembled page, what https://gno.land/u/moul shows "slots" the slot index: name, size, revision, last write "slots/<slug>" one slot's raw markdown, fenced

Open
OID
0517a5…9759:275
Render details

Inspect func

renderPage

func() string

renderPage fills the layout. dynreplacer only invokes the callbacks whose placeholder actually occurs in the layout, so an unused slot is never even read out of the tree.

Open
OID
0517a5…9759:276
renderPage details

Inspect func

renderSlot

func(slug string) string
Open
OID
0517a5…9759:279
renderSlot details

Inspect func

scanPlaceholders

[]string (len=5)

scanPlaceholders are the reserved slugs this file answers for. They are listed in reservedSlugs (home.gno) so a slot can never take one of these names and shadow the computed value.

Open
OID
0517a5…9759:281
scanPlaceholders details (len=5)

+5 more Inspect slice

scanner

func() v0.Scanner

scanner returns the configured link builder. config.Scanner() is a read, and a cheap one: an avl lookup plus a struct. It is called once per render and the result reused, rather than once per placeholder, because dynreplacer may invoke several of the callbacks below and each would otherwise repeat the cross-realm call.

Open
OID
0517a5…9759:282
scanner details

Inspect func

registerScanCallbacks

func(r *v0.Replacer)

registerScanCallbacks adds the explorer placeholders to r. dynreplacer only invokes a callback whose placeholder actually occurs in the layout, so a layout using none of these costs one config.Scanner() call and nothing else.

Open
OID
0517a5…9759:284
registerScanCallbacks details

Inspect func
admin : .uverse.address =<gnolang.StringValue>
layoutSlug : untyped string ="layout"
realmPath : untyped string ="gno.land/r/moul/home"
maxSlugLen : untyped bigint =(64 <untyped> bigint)
slots : *v0.Tree Inspect
rev : int =14
slot : type =home.slot
reservedSlugs : []string (len=12) Inspect
assertAdmin : func() Inspect
validSlug : func(slug string) bool Inspect
assertWritableSlug : func(slug string) Inspect
Set : func(slug string, body string) Inspect
Append : func(slug string, body string) Inspect
Delete : func(slug string) Inspect
Get : func(slug string) string Inspect
Revision : func() int Inspect
Manifest : func() string Inspect
reactionsPlaceholders : []string (len=1) Inspect
registerReactionCallbacks : func(r *v0.Replacer) Inspect
defaultLayout : untyped string ="# gno.land/r/moul/home\n\nNo layout slot yet. A redeploy wipes every slot and `content/` is the source\nof truth, so push them back with the tool rather than by hand:\n\n go -C tools tool gnohome tx -all\n\nNo gas numbers here on purpose: a command written int"...
chainHeight : func() int64 Inspect
Render : func(path string) string Inspect
renderPage : func() string Inspect
renderIndex : func() string Inspect
renderSlot : func(slug string) string Inspect
scanPlaceholders : []string (len=5) Inspect
scanner : func() v0.Scanner Inspect
registerScanCallbacks : func(r *v0.Replacer) Inspect