artifact

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package artifact defines how the engine NAMES a stored artifact: a design, a board export, a datasheet, a checklist, anything the injected Loader resolves to bytes.

One string, one field:

mount://boards/designs/gateway/gateway.edn

It replaces a `(mount, path)` pair that 24 request messages carried as two fields (#179).

Why the authority is always `mount`

Not `s3://` or `db://`. The authority is the mount NAME, a key in a server-defined namespace, and what it resolves to is the deployment's business. A per-store scheme would put the storage kind in the client's hands, which the Loader and ProjectStore ports exist to prevent.

Why a URI rather than a path

The mount is the containment boundary and `..` cannot escape it. Relative resolution between related files (a KiCad schematic naming its sub-sheets, a symbol library referenced from inside a file) becomes one specified operation, and a URI path is always slash-separated, so the platform-separator split `formats.Loader` warns about cannot break a sibling lookup on Windows.

Grouping is NOT expressed here. A design's relationship to its board companion is DECLARED in a `design.yaml`, not encoded in a path or inferred from a stem.

Index

Constants

View Source
const Scheme = "mount"

Scheme is the only scheme an artifact URI uses. See the package doc for why it is fixed.

Variables

This section is empty.

Functions

This section is empty.

Types

type URI

type URI struct {
	// Mount is the authority: a key in a server-defined namespace, never a host path.
	Mount string
	// Path is the mount-relative path, cleaned, slash-separated, with no leading slash. The mount
	// ROOT is the empty string, as a directory listing of a whole mount asks for.
	Path string
}

URI is a parsed artifact URI: the mount it lives in, and the mount-relative path within it.

A parsed URI is a CONTAINED one. Parse rejects anything that escapes its mount, so callers can pass a value of this type around without re-checking containment.

func New

func New(mount, p string) (URI, error)

New builds a URI from a mount and a mount-relative path, applying the same containment rules as Parse. It exists so code holding the two halves (an adapter reading a config flag, a test) cannot assemble a string that Parse would then reject.

func Parse

func Parse(s string) (URI, error)

Parse reads an artifact URI.

A bare path, an absolute path, a different scheme, or a path escaping its mount are all errors rather than best-effort readings, because this is the containment boundary and a permissive parse here is a path traversal everywhere above it. The error names the broken rule, since these arrive from a wire and a client needs to fix its own call.

func (URI) Base

func (u URI) Base() string

Base returns the final path element, the way path.Base does, and "" for a mount root.

func (URI) Dir

func (u URI) Dir() URI

Dir returns the URI of the directory containing this one, or the mount root for a top-level entry.

func (URI) IsZero

func (u URI) IsZero() bool

IsZero reports whether the URI names nothing, which is how an absent optional field reads.

func (URI) Join

func (u URI) Join(elem ...string) (URI, error)

Join returns the URI of a child of this one.

func (URI) Resolve

func (u URI) Resolve(rel string) (URI, error)

Resolve returns the URI naming `rel` interpreted RELATIVE to this one, the way a browser resolves a relative href against the page it is on.

A reader calls this when a schematic names its sub-sheets or a symbol library. A reference is resolved against this URI's DIRECTORY, so resolving "sub/sheet1.kicad_sch" against ".../designs/gateway/gateway.kicad_sch" yields ".../designs/gateway/sub/sheet1.kicad_sch".

A result outside the mount is an error, so a file naming "../../etc/passwd" cannot leave the mount it was read from.

func (URI) String

func (u URI) String() string

String renders the URI. It round-trips with Parse.

Jump to

Keyboard shortcuts

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