webabi

package
v0.2.45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package webabi is the TxCo Web ABI on the installing side: the manifest (txco-web.json), a loaded ABI directory, the marker and provenance files an install writes, and the collision rules for laying an ABI directory over an author's stack tree. It has no CLI dependencies; `txco apply`, `txco push`, `txco dev` and `txco web check` build on it.

An ABI directory is a producer's build output:

txco-web.json   the manifest: what the artifact is, never its routing
public/         files, installed as the stack's FILES/
server/         an optional Fetch handler module (refused until a runner exists)
ops/            ordinary .txcl in scope directories (ops/900000/…)

Index

Constants

View Source
const (
	// ManifestName is the manifest's file name at the root of an ABI directory.
	ManifestName = "txco-web.json"
	// ABIVersion is the manifest's abi value this package reads.
	ABIVersion = 1
	// ProducerScope starts the scope band producers' ops live in, after
	// every op an author writes.
	ProducerScope = 900000
)
View Source
const MarkerContent = "txco web abi marker\n"

MarkerContent is every marker's body. Static reads markers by path only; the body just keeps the file non-empty.

View Source
const ProvenancePath = "FILES/" + static.MarkerDir + "/web-abi.json"

ProvenancePath is the stack path of the file that lists every path an install owns, so `txco pull` can leave them out of the author's tree. It lives under FILES/_txco/, private like any "_" path.

Variables

This section is empty.

Functions

func CheckOverlay

func CheckOverlay(author, abi []string, d *Dir) []string

CheckOverlay reports every way an ABI install would collide with the author's own stack tree, as messages naming both sides. author and abi are the stack paths each side contributes ("100/a.txcl", "100/mock-request.json", "FILES/x.js", the markers, the provenance file). An empty result means the two lay over each other cleanly.

  • the same path from both sides (an op, a scope's mock, a file);
  • an author file under a "_" root public/ makes public: it would be served too;
  • an author file under an immutable prefix: it would be cached for a year;
  • any author FILES/_txco/: the installer owns it in a bound stack.

func ParseProvenance

func ParseProvenance(data []byte) ([]string, error)

ParseProvenance reads a provenance file's owned paths.

func Provenance

func Provenance(owned []string) []byte

Provenance renders the provenance file for an install that owns paths (stack paths; the file itself is added).

Types

type Dir

type Dir struct {
	// Path is the directory, absolute.
	Path     string
	Manifest *Manifest
	// Public is every file under public/, as a FILES/-relative path (the
	// stack path is "FILES/" + it), sorted. Dot paths and symlinks are not
	// in it: they never deploy.
	Public []string
	// HasServer: the manifest names a server entry.
	HasServer bool
	// HasOps: an ops/ directory exists.
	HasOps bool
	// Warnings are worth telling the author but don't stop an install.
	Warnings []string
}

Dir is a loaded ABI directory.

func Load

func Load(dir string) (*Dir, error)

Load reads and checks an ABI directory. It reads paths only, never the bytes of public/ (collecting them is the installer's job).

func (*Dir) Markers

func (d *Dir) Markers() []string

Markers returns the stack paths (FILES/…) of the markers an install writes, sorted: one public marker per private root public/ installs, one immutable marker per manifest prefix.

func (*Dir) PublicRoots

func (d *Dir) PublicRoots() []string

PublicRoots are the private roots (paths cut at their first "_" segment) public/ installs, sorted: each gets a public marker.

type Manifest

type Manifest struct {
	ABI       int      `json:"abi"`
	Server    *Server  `json:"server,omitempty"`
	Immutable []string `json:"immutable,omitempty"`
}

Manifest is txco-web.json.

func ParseManifest

func ParseManifest(data []byte) (*Manifest, error)

ParseManifest validates data against the manifest schema, then the rules a schema can't express, and decodes it.

func ReadManifest

func ReadManifest(dir string) (*Manifest, error)

ReadManifest reads and parses <dir>/txco-web.json.

func (*Manifest) ImmutablePrefixes

func (m *Manifest) ImmutablePrefixes() []string

ImmutablePrefixes returns the manifest's immutable prefixes, each ending in "/", sorted.

type ManifestError

type ManifestError struct {
	Problems []Problem
}

ManifestError lists everything wrong with a manifest.

func (*ManifestError) Error

func (e *ManifestError) Error() string

type Problem

type Problem struct {
	Pointer string
	Message string
}

Problem is one thing wrong with a manifest, at a JSON pointer.

type Server

type Server struct {
	Entry string `json:"entry"`
}

Server names the application server's entry module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL