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 lazy is version 0 of the "lazy migration" upgrade pattern (pattern D of the exploration; see ../README.md).

Readme View source

gno.land/r/moul/x/upgrade/lazy/v0

Version 0 of the lazy migration pattern (pattern D). An ordinary record store, written without any knowledge of a successor. Size() never shrinks: migration copies forward, so this realm keeps paying for every record it ever held.

See the pattern and the exploration.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/upgrade/lazy/v0 dependency graph

🧪 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 lazy is version 0 of the "lazy migration" upgrade pattern (pattern D of the exploration; see ../README.md).

This version is an ordinary record store. It is written without any knowledge of a successor: what makes the pattern work is only that its records are readable from outside, which any avl-backed realm already is.

Functions 3

func Size

Action
1func Size() int
source

Size is how many records still live here. It never shrinks: lazy migration COPIES forward, it does not move, so v0 keeps paying for every record it ever held.

func Get

Action
1func Get(key string) *Record
source

Get returns a record or nil. Non-crossing: v1 reads through it while migrating, and gnoweb can call it without a transaction.

Types 1

type Record

struct
1type Record struct {
2	Name  string
3	Score int
4}
source

Record is v0's shape. v1 changes it, which is the whole reason for a new version: a stored-layout change is never done in place.

Methods on Record

func String

method on Record
1func (r *Record) String() string
source

Imports 2

Source Files 4