Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPathNotFound = errors.New("path not found")
Functions ¶
func NewRootCommand ¶
NewRootCommand returns the root cobra.Command for the w9y CLI.
Types ¶
type BlobStore ¶
type BlobStore interface {
Get(path string) (Blob, error)
Set(path, hash string) error
SetWithTime(path, hash string, time int64) error
Delete(path string) error
List() (map[string]Blob, error)
SetAlias(alias, target string) error
GetAlias(alias string) (string, error)
ListAliases() (map[string]string, error)
DataDir() string
}
BlobStore provides access to the path→blob mapping backed by symlinks.
func NewBlobStore ¶
NewBlobStore returns a symlink-backed BlobStore.
Each path entry is a symlink under <dataDir>/paths/ pointing to ../blob/<sha256>.wasm.gz. The symlink's own mtime records the upload time. Aliases are symlinks whose target is another path (not a blob).
type BuildJob ¶
type BuildJob struct {
ID string `json:"id"`
Spec string `json:"spec"`
Runtime string `json:"runtime"`
Status string `json:"status"` // pending, building, done, error
Resolved string `json:"resolved,omitempty"`
Result string `json:"result,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
DoneAt *time.Time `json:"done_at,omitempty"`
}
type GoWasmBuilder ¶
type GoWasmBuilder struct {
BlobStore
// contains filtered or unexported fields
}
GoWasmBuilder builds Go WASM binaries on demand and deduplicates concurrent builds for the same remotePath.
func NewGoWasmBuilder ¶
func NewGoWasmBuilder(store BlobStore) *GoWasmBuilder
NewGoWasmBuilder creates a new GoWasmBuilder.
func (*GoWasmBuilder) BuildOrWait ¶
func (b *GoWasmBuilder) BuildOrWait(importPath, version, remotePath string, reqCtx context.Context) (string, error)
BuildOrWait checks the cache first. If already built, returns immediately. Otherwise, it either becomes the builder or waits for the in-flight build.
func (*GoWasmBuilder) TinyBuildOrWait ¶
func (b *GoWasmBuilder) TinyBuildOrWait(importPath, version, remotePath string, reqCtx context.Context) (string, error)
TinyBuildOrWait is like BuildOrWait but uses TinyGo to build.
type JobStore ¶
type JobStore struct {
// contains filtered or unexported fields
}
func NewJobStore ¶
func NewJobStore() *JobStore
func (*JobStore) SetBuilding ¶
func (*JobStore) SetResolved ¶
type Manifest ¶
type Manifest struct {
Module string // manifest name (e.g. "go")
GoVersion string // Go toolchain version (optional)
Version string // shared default version (optional)
Entries []ManifestEntry
}
Manifest describes a named group of WASM output files mapped to Go import paths, using a go.mod-like format.
func ParseManifest ¶
ParseManifest parses a go.mod-like manifest from data. It uses golang.org/x/mod/modfile.ParseLax for lexing, then interprets custom directives:
module <name> — manifest name (required) go <version> — Go toolchain version (optional) version <semver> — shared default version (optional) <output> <import> — entry line <output> <import>@<ver> — entry with per-entry version override
type ManifestEntry ¶
type ManifestEntry struct {
Output string // e.g. "bin/go"
Source string // e.g. "github.com/golang/go/src/cmd/go"
Version string // per-entry version override (empty = use manifest default or @latest)
}
ManifestEntry maps a single output path to a Go import path with an optional per-entry version override.
type ManifestStore ¶
type ManifestStore struct {
// contains filtered or unexported fields
}
ManifestStore stores manifests as text files under dataDir/manifests/.
func NewManifestStore ¶
func NewManifestStore(dataDir string) *ManifestStore