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 state

Back to all declarations

owner

.uverse.address

Value

<gnolang.StringValue>

prefix

untyped string

Value

"gno.land/r/moul/x/upgrade/schema/impl/"

sep

untyped string

sep is the payload separator. A single byte, because the point here is the shape of the boundary and not the encoding: a real one would need escaping, and choosing it is a decision this pattern does not make for you.

Value

"|"

Handler

type

Handler is the whole interface an implementation satisfies. It never changes, because everything that would have changed it is in Schema instead.

Value

v0.Handler

verb

type

Value

v0.verb

live

<nil>

Value

nil

livePath

string

Value

""

liveVerbs

*v0.Tree

// verb name -> \*verb, for lookup

Open
OID
08daae…5bc2:12
liveVerbs details

Inspect pointer

liveOrder

[]string

// the same verbs in DECLARATION order, for listing

Value

<zero>

Propose

func(h v0.Handler)

Propose nominates the calling realm, exactly as in pattern F. Its schema is parsed here so a malformed one is rejected at proposal rather than at accept.

Open
OID
08daae…5bc2:15
Propose details

Inspect func

Accept

func(pkgPath string)

Accept promotes a candidate, and refuses one that would break an existing caller. This is the check a Go interface cannot express.

Open
OID
08daae…5bc2:17
Accept details

Inspect func

AcceptBreaking

func(pkgPath string)

AcceptBreaking promotes a candidate that Accept refuses. It exists because the diff is SYMMETRIC, which is not obvious until it bites: once v1 has added a verb, rolling back to v0 drops that verb and is a regression by exactly the same rule that protects callers going forward. A pattern that can only move forward is worse than one with no diff at all, so the escape hatch is required, and making it a separate function is the point: the owner has to type a different word, and the audit log shows which one. Use it to roll back, and to retire a verb nobody calls any more. Not to make an upgrade go through.

Open
OID
08daae…5bc2:18
AcceptBreaking details

Inspect func

resolve

func(pkgPath string) (v0.Handler, *v0.Tree, []string)

resolve is the owner check and the lookup both accepts share.

Open
OID
08daae…5bc2:19
resolve details

Inspect func

assertNoRegression

func(next *v0.Tree)

assertNoRegression is the upgrade diff. A new schema may ADD verbs and may not remove one or change its arity, because a caller compiled against the old one is still out there calling it.

Open
OID
08daae…5bc2:20
assertNoRegression details

Inspect func

Call

func(verbName string, payload string) string

Call is the one signature this realm is committed to forever.

Open
OID
08daae…5bc2:21
Call details

Inspect func

Verbs

func() []string

Verbs lists the accepted API in DECLARATION order, which is the order the handler wrote it in and the order a reader of the schema expects. Iterating the avl tree instead would list them alphabetically, silently: caught by a test, not by a compiler.

Open
OID
08daae…5bc2:22
Verbs details

Inspect func

Signature

func(name string) string

Signature is one verb's shape, as a caller would write it.

Open
OID
08daae…5bc2:23
Signature details

Inspect func

SchemaText

func() string

SchemaText is the whole accepted API in the declaration format, so a client can read back exactly what the handler declared.

Open
OID
08daae…5bc2:24
SchemaText details

Inspect func

Live

func() string

Live is the package path currently serving, or "" before the first Accept.

Open
OID
08daae…5bc2:25
Live details

Inspect func

Candidates

func() []string

Candidates lists every path that has nominated itself, in order.

Open
OID
08daae…5bc2:26
Candidates details

Inspect func

parseSchema

func(text string) (*v0.Tree, []string)

parseSchema turns the declaration text into verbs, and is the only validation of a name that Render later echoes.

Open
OID
08daae…5bc2:28
parseSchema details

Inspect func
owner : .uverse.address =<gnolang.StringValue>
prefix : untyped string ="gno.land/r/moul/x/upgrade/schema/impl/"
sep : untyped string ="|"
Handler : type =v0.Handler
verb : type =v0.verb
Ownable : *v0.Ownable Inspect
candidates : *v0.Tree Inspect
live : <nil> =nil
livePath : string =""
liveVerbs : *v0.Tree Inspect
liveOrder : []string =<zero>
Propose : func(h v0.Handler) Inspect
Accept : func(pkgPath string) Inspect
AcceptBreaking : func(pkgPath string) Inspect
resolve : func(pkgPath string) (v0.Handler, *v0.Tree, []string) Inspect
assertNoRegression : func(next *v0.Tree) Inspect
Call : func(verbName string, payload string) string Inspect
Verbs : func() []string Inspect
Signature : func(name string) string Inspect
SchemaText : func() string Inspect
Live : func() string Inspect
Candidates : func() []string Inspect
assertLive : func() Inspect
parseSchema : func(text string) (*v0.Tree, []string) Inspect
assertIdent : func(s string) Inspect
Render : func(string) string Inspect