PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/moul/x/wiki/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
moul / x / wiki
Files
18 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/moul/x/wiki/v0
gno
0.9

Files (18)

  • README.mdmarkdown
  • gnomod.tomltoml
  • diff.gnogno
  • doc.gnogno
  • links.gnogno
  • page.gnogno
  • render.gnogno
  • revision.gnogno
  • talk.gnogno
  • title.gnogno
  • wiki.gnogno
  • diff_test.gnogno
  • limits_test.gnogno
  • links_test.gnogno
  • render_test.gnogno
  • talk_test.gnogno
  • title_test.gnogno
  • wiki_test.gnogno
  • revision.gnogno
    1package wiki23import (4	"crypto/sha256"5	"encoding/hex"6	"time"7)89// Kind labels what a revision did, for the recent-changes feed.10type Kind string1112const (13	KindCreate  Kind = "create"14	KindEdit    Kind = "edit"15	KindRevert  Kind = "revert"16	KindMove    Kind = "move"17	KindBlank   Kind = "blank"18	KindProtect Kind = "protect"19)2021// Revision is one entry in a page's append-only history.22//23// The exported fields are the permanent spine: they are never evicted, and24// they are what makes the history tamper-evident. Hash is the SHA-256 of the25// body bytes as submitted, so a body recovered from transaction history can be26// checked against the chain's own record of it.27//28// body is the only field under a retention policy. When a revision falls out29// of the page's body window it is evicted, which releases the storage deposit30// those bytes locked.31type Revision struct {32	ID      uint6433	Prev    uint64 // 0 for the first revision of a page34	Kind    Kind35	Author  address36	Time    time.Time37	Height  int6438	Summary string39	Hash    string // hex-encoded SHA-256 of the body40	Size    int    // body length in bytes41	Minor   bool4243	body string44	kept bool45}4647// Body returns the revision's text and whether it is still held on chain. A48// false second return is not corruption: the body aged out of the retention49// window and must be recovered from the transaction that wrote it, then50// checked against Hash.51func (r *Revision) Body() (string, bool) { return r.body, r.kept }5253// Kept reports whether this revision's body is still on chain.54func (r *Revision) Kept() bool { return r.kept }5556// evict drops the body and returns the number of bytes released.57func (r *Revision) evict() int {58	if !r.kept {59		return 060	}61	n := len(r.body)62	r.body = ""63	r.kept = false64	return n65}6667// hashBody is the content address of a revision body.68func hashBody(body string) string {69	sum := sha256.Sum256([]byte(body))70	return hex.EncodeToString(sum[:])71}7273// ShortHash is the first 12 hex characters of Hash, for display.74func (r *Revision) ShortHash() string {75	if len(r.Hash) < 12 {76		return r.Hash77	}78	return r.Hash[:12]79}8081// Change is a recent-changes entry: a revision plus the page it landed on.82type Change struct {83	Title Title84	Rev   *Revision85}86

    Functions

    not supported for pure packages by the node (vm/qfuncs)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.