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/plan9/synfs/v0

Package
Open in gnoweb ↗

Overview

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

Files (4)

  • README.mdmarkdown
  • gnomod.tomltoml
  • synfs.gnogno
  • synfs_test.gnogno
README.mdPreviewRaw
# `gno.land/p/moul/x/plan9/synfs/v0`

**A synthetic, read-only file server whose contents are computed at read time.**
This is the package that makes the rest of the suite adoptable.

```go
import synfs "gno.land/p/moul/x/plan9/synfs/v0"

t := synfs.New("dev", "sys", func() int64 { return runtime.ChainHeight() })
t.Root().
	Add("sysname", func() string { return runtime.ChainID() }).
	Add("height", func() string { return strconv.FormatInt(runtime.ChainHeight(), 10) })
```

In Plan 9 a device is not storage, it is code behind a name: reading `/dev/time`
runs a function. A realm that wants to publish its state as a browsable tree
does the same thing here, in a few lines, and gets `ls`, `cat`, `stat` and
mountability for free.

**Read-only by construction.** The tree implements `ninep.File` and not
`ninep.Mutable`, so every method is free of side effects and the tree is safe to
hand to a namespace owned by somebody else. That is the property the whole
cross-realm mount story rests on.

Two details worth knowing:

- **A synthetic file pins `Qid.Version` at 0 forever.** Its contents can change
  on every block, so a version would be a lie; a client that needs change
  detection should read the file.
- **`AddRange` serves the 9P read window itself**, for a file with no natural
  end. `/dev/zero` uses it: an unbounded read returns nothing rather than an
  endless value, which is what stops `cat /dev/zero` from being a denial of
  service.

**Live demo:** [`r/moul/x/plan9/dev`](../../../../../r/moul/x/plan9/dev/v0)
publishes the chain itself as a device tree. Design and analysis:
[moul/gno-contracts#136](https://github.com/moul/gno-contracts/issues/136).


---

**Not affiliated with Plan 9.** Plan 9 from Bell Labs is the work of the
Computing Science Research Center at Bell Labs; the name and the marks are
theirs, and the copyright is held by the [Plan 9 Foundation](https://p9f.org).
This package borrows the vocabulary and none of the code: it is an independent
homage, asking what that ecosystem's spirit looks like on a chain. Full
attribution: [NOTICE](../../../../../NOTICE.md).

<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->

---

Part of **[moul/gno-contracts](https://github.com/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/p/moul/x/plan9/synfs/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/p/moul/x/plan9/synfs/v0/deps.png)

> 🧪 **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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).

<!-- END GNOCONTRACTS FOOTER -->

Functions

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

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