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

impl.gno

0.96 Kb · 31 lines
 1// Package impl is version 0 of the implementation realm of the "propose and
 2// accept" upgrade pattern (pattern F; see ../../README.md).
 3//
 4// Deploying it only nominates it. It serves nothing until the facade's owner
 5// accepts this path.
 6package impl
 7
 8import (
 9	facade "gno.land/r/moul/x/upgrade/adminreg/facade/v0"
10)
11
12type greeter struct{}
13
14func (greeter) Greet(name string) string { return "hello, " + name }
15func (greeter) Version() string          { return "impl/v0" }
16
17// Instance exposes the singleton.
18func Instance() facade.Impl { return greeter{} }
19
20func init(cur realm) {
21	facade.Propose(cross(cur), Instance())
22}
23
24// Propose re-nominates this implementation. init does it at deploy; exposing it
25// as a transaction lets a candidate be restored without redeploying.
26func Propose(cur realm) {
27	facade.Propose(cross(cur), Instance())
28}
29
30// Path is this realm's own package path, the string the facade owner accepts.
31const Path = "gno.land/r/moul/x/upgrade/adminreg/impl/v0"