projects

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 32 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 projects is the filesystem-backed implementation of service.ProjectStore. It discovers the `project.yaml` and `design.yaml` descriptors (agni issue 170). A `design.yaml` names a design, and a `project.yaml` holds the config a team shares across a set of designs.

It is ONE implementation of that port. Tree walking, descriptor file names and design-folder-relative paths are facts about storing projects in directories. A database-backed store would not share them. So the port lives in `service/`, and nothing above it imports this package.

The descriptors parse straight into the wire types (`webapi.Project`, `webapi.Design`), with no third Go shape between the YAML and the proto, because the proto is the contract (CONSTRAINTS C2).

Index

Constants

View Source
const (
	ProjectDescriptor = "project.yaml"
	DesignDescriptor  = "design.yaml"
)

The two descriptor file names, confined to this package for the reason in the package doc.

View Source
const MaxDepth = 4

MaxDepth bounds the downward walk that discovers descriptors under a tree. The tree root is depth 0. An operator can hand the server any folder as a tree, such as a build output or a home directory, so an unbounded walk would stat all of it on every listing. Four levels reaches `<root>/<team>/<project>/<design>/` with one to spare.

Variables

This section is empty.

Functions

func CleanRel

func CleanRel(rel string) string

CleanRel normalizes a descriptor-relative file name for comparison (forward slashes, no `./`, no trailing slash). It is exported because the store joins on this rule. A second definition of "clean" would stop a companion being recognised as one.

func PackFromFiles added in v0.9.0

func PackFromFiles(files []string, read func(string) ([]byte, error)) (id string, pack *webapi.Pack, kept []string, err error)

PackFromFiles reads the pack a project folder's files make (agni issues 1697, 1746). files are the folder's paths, relative to it and slash-separated, and read returns one file's contents. Only the project.yaml at the folder's top is read.

It returns the project's id and the pack, its config bound from project.yaml and its files the paths the config's profile, param, symbol, library and query tiers name, and the item files of any checklist written as items_dir (agni issue 1812). Each tier keeps a mount:// URI as written, and a relative path names a file or a folder among files. kept lists those paths, sorted. A pack's files carry no hash here, since the caller knows its own. The folder's other files, such as its designs, are no part of the pack.

A folder with no project.yaml, a project.yaml that extends another, or a tier naming a path outside the folder or among no files is service.ErrInvalidArgument.

func ResolveChecklistDirs added in v0.11.0

func ResolveChecklistDirs(cfg *webapi.AnalysisConfig, dirs []ChecklistDir, list func(dir string) ([]string, error), read func(string) ([]byte, error)) ([]string, error)

ResolveChecklistDirs reads each folder checklist src declares into cfg's Checklists, through review.ItemsDir, which says how a folder of item files reads (agni issue 1812). list returns every file under a folder, as slash-separated paths relative to the descriptor's folder, and read returns one file's contents. It returns every path it read, files and folders, so a cache can watch them.

func UnlistedInFiles added in v0.11.2

func UnlistedInFiles(files []string, read func(string) ([]byte, error)) ([]string, error)

UnlistedInFiles reads the project.yaml among a project folder's files and returns the tier folders among files it lists none of, for a pack read from files rather than a tree. files are relative and slash-separated, as PackFromFiles takes them. A folder with no project.yaml returns nil, since PackFromFiles refuses it on its own.

func ViewsRoot added in v0.9.0

func ViewsRoot(uploads string) string

ViewsRoot is the folder a server serves as the uploads mount, or "" for a store with no uploads.

func WriteDesign

func WriteDesign(w io.Writer, header, id, title, entry string, companions []string, src Sources) error

WriteDesign writes a `design.yaml`, the write half of ParseDesign.

entry and companions are descriptor-relative names. WriteDesign checks and cleans them as ParseDesign does, so a caller cannot write a descriptor that ParseDesign would reject. src.Extends names the design's project, "" for a design in none.

func WriteProject

func WriteProject(w io.Writer, header, id, title string, src Sources) error

WriteProject writes a `project.yaml`, the write half of ParseProject. It lives here so the descriptor SHAPE has one definition, and TestDescriptorRoundTrip pins the two halves together.

src names the project's parent and its file tiers, as ParseProject returns them. A scaffolder appends the conventions and checklists sections. Their content is prose for an operator to edit, and this writer has no value of its own to put there.

header is prose written as a YAML comment above the document, "" for none.

Types

type BlobDir added in v0.9.0

type BlobDir struct {
	// contains filtered or unexported fields
}

BlobDir is the uploads' blob store with the byte-slice calls agni's stores and service.UploadStore use (agni issues 1739, 1759). It is goapplib's blobs.Dir at <uploads>/blobs, or a bucket behind that folder for an s3:// or gs:// --uploads (agni issue 1730). A server reads and writes uploaded contents through it, so an upload outlives a restart.

func NewBlobDir added in v0.9.0

func NewBlobDir(uploads string) (*BlobDir, error)

NewBlobDir opens the blob folder under uploads, creating it if absent. Its layout is sha256/ab/cdef..., which agni has always used, so blobs from an older agni stay where they are.

func NewBlobDirOver added in v0.11.0

func NewBlobDirOver(l blobs.Linker) *BlobDir

NewBlobDirOver wraps a blob store the server opened, such as a bucket behind a local folder.

func (*BlobDir) Get added in v0.9.0

func (b *BlobDir) Get(hash string) ([]byte, bool)

Get returns the contents stored under hash. A hash the folder lacks, a malformed one, or contents that no longer match it report false.

func (b *BlobDir) Link(hash, to string) error

Link makes the file at to hold hash's contents, hard-linking where the filesystem allows. A view built from links keeps its files when a sweep later removes the blob.

func (*BlobDir) Put added in v0.9.0

func (b *BlobDir) Put(p []byte) (string, error)

Put stores p and returns its hash, "sha256:<hex>". Storing contents already held writes nothing.

func (*BlobDir) Store added in v0.11.0

func (b *BlobDir) Store() blobs.Linker

Store is the library's store, for a sweep and for the mounts registry.

type ChecklistDir added in v0.11.0

type ChecklistDir struct {
	Index int
	Name  string
	Dir   string
}

ChecklistDir is a checklist a descriptor declares as a folder of item files, with items_dir in place of areas (agni issue 1812). Index is the checklist's place in the config's Checklists, and Dir is the folder relative to the descriptor.

type DirPacks added in v0.9.0

type DirPacks struct {
	// contains filtered or unexported fields
}

DirPacks keeps packs as one protojson record each, `<id>.json`, in a records.Store (agni issues 1704, 1733). A pack's files are kept by hash in the uploads' BlobDir, beside the designs' files. Each version of a pack's files is linked into a view, `@packs/<id>/<rev>/` under the uploads mount, which is never changed once built. So a pack's relative paths resolve against a mount:// folder on any host that serves the uploads mount.

Each write replaces a record whole, so a reader sees the old record or the new one. One mutex serialises every write.

func NewDirPacks added in v0.9.0

func NewDirPacks(dir string, blobs *BlobDir, views, mount string) (*DirPacks, error)

NewDirPacks returns packs kept in dir, created if absent. blobs and views are the uploads store's blob folder and the root it serves as the mount named mount, and both are nil and "" on a server with no uploads. Such a store keeps packs whose config names only mount:// URIs.

func NewPacks added in v0.11.0

func NewPacks(recs records.Store, blobs *BlobDir, views, mount string) *DirPacks

NewPacks is NewDirPacks with the records in recs, each pack at `<id>.json` (agni issue 1733).

func (*DirPacks) CreatePack added in v0.9.0

func (r *DirPacks) CreatePack(ctx context.Context, id string, p *webapi.Pack, blobs service.BlobSource) (*webapi.Pack, error)

CreatePack keeps a new pack.

func (*DirPacks) DeletePack added in v0.9.0

func (r *DirPacks) DeletePack(ctx context.Context, id string) error

DeletePack removes a pack's record. Its views stay until the next Sweep, so a snapshot read under it keeps answering until it is read again.

func (*DirPacks) Hashes added in v0.9.0

func (r *DirPacks) Hashes(ctx context.Context) (map[string]bool, error)

Hashes returns the hash of every file a kept pack names, so the uploads sweep keeps their blobs.

func (*DirPacks) Pack added in v0.9.0

func (r *DirPacks) Pack(ctx context.Context, id string) (*webapi.Pack, error)

Pack reads one pack, or answers ErrNotFound.

func (*DirPacks) Packs added in v0.9.0

func (r *DirPacks) Packs(ctx context.Context) ([]*webapi.Pack, error)

Packs reads every pack, ordered by name.

func (*DirPacks) RebuildViews added in v0.11.0

func (r *DirPacks) RebuildViews(ctx context.Context) (int, error)

RebuildViews builds the view of each pack's files that the uploads folder lacks, from the blobs, as DirStore.RebuildViews does for designs (agni issue 1730). It returns how many it built.

func (*DirPacks) Sweep added in v0.9.0

func (r *DirPacks) Sweep(ctx context.Context, grace time.Duration) (int, error)

Sweep removes each view under `@packs/` that no kept pack reads now (agni issue 1746). That is a view of an earlier version of a pack, or every view of a deleted pack. A view newer than grace stays, so a snapshot read under a pack a moment before a restart keeps its files until it is read again. A pack's blobs stay, since the uploads sweep keeps the hashes Hashes returns. It reports how many views it removed.

func (*DirPacks) UpdatePack added in v0.9.0

func (r *DirPacks) UpdatePack(ctx context.Context, id string, update func(*webapi.Pack) error, blobs service.BlobSource) (*webapi.Pack, error)

UpdatePack changes a pack as one change of its record (records.Update): when another server wrote the pack in between, update runs again on what it wrote (agni issue 1823).

type DirProjects added in v0.9.0

type DirProjects struct {
	// contains filtered or unexported fields
}

DirProjects keeps stored projects as one protojson record each, `<id>.json` (agni issues 1694, 1733). A stored project is a title and a list of design names, a few hundred bytes. The records sit in a folder or in sqlite, as records.Store keeps them, and each write replaces a record whole.

func NewDirProjects added in v0.9.0

func NewDirProjects(dir string) (*DirProjects, error)

NewDirProjects returns records kept as files in dir, created if absent.

func NewProjects added in v0.11.0

func NewProjects(recs records.Store) *DirProjects

NewProjects returns projects kept in recs, each at `<id>.json`.

func (*DirProjects) Create added in v0.11.0

func (r *DirProjects) Create(ctx context.Context, id string, p *webapi.Project) error

Create writes a new record, or answers ErrAlreadyExists, across servers sharing the records.

func (*DirProjects) Delete added in v0.9.0

func (r *DirProjects) Delete(ctx context.Context, id string) error

Delete removes a record, or answers ErrNotFound.

func (*DirProjects) Get added in v0.9.0

func (r *DirProjects) Get(ctx context.Context, id string) (*webapi.Project, error)

Get reads one record, or answers ErrNotFound.

func (*DirProjects) List added in v0.9.0

func (r *DirProjects) List(ctx context.Context) ([]*webapi.Project, error)

List reads every record, ordered by name.

func (*DirProjects) Put added in v0.9.0

func (r *DirProjects) Put(ctx context.Context, id string, p *webapi.Project) error

Put writes a record, replacing any it had.

func (*DirProjects) Update added in v0.11.0

func (r *DirProjects) Update(ctx context.Context, id string, update func(*webapi.Project) error) (*webapi.Project, error)

Update changes a record as one change of it (records.Update), running update again when another writer changed the record in between.

type DirReports added in v0.9.0

type DirReports struct {
	// contains filtered or unexported fields
}

DirReports keeps reports as one protojson record each, `<design>/<report>.json` (agni issues 1704, 1733). A report is a few hundred findings, so a record each is enough. The records sit in a folder or in sqlite, as records.Store keeps them. Each is written whole, so a reader sees the whole report or none, and the store refuses a create of a taken id.

func NewDirReports added in v0.9.0

func NewDirReports(dir string) (*DirReports, error)

NewDirReports returns reports kept as files in dir, created if absent.

func NewReports added in v0.11.0

func NewReports(recs records.Store) *DirReports

NewReports returns reports kept in recs, each at `<design>/<report>.json`.

func (*DirReports) CreateReport added in v0.9.0

func (r *DirReports) CreateReport(ctx context.Context, design, id string, in *webapi.Report) (*webapi.Report, error)

CreateReport keeps a new report.

func (*DirReports) DeleteReport added in v0.9.0

func (r *DirReports) DeleteReport(ctx context.Context, design, id string) error

DeleteReport removes one report, or answers ErrNotFound.

func (*DirReports) DeleteReports added in v0.9.0

func (r *DirReports) DeleteReports(ctx context.Context, design string) error

DeleteReports removes a design's reports.

func (*DirReports) Report added in v0.9.0

func (r *DirReports) Report(ctx context.Context, design, id string) (*webapi.Report, error)

Report reads one report, or answers ErrNotFound.

func (*DirReports) Reports added in v0.9.0

func (r *DirReports) Reports(ctx context.Context, design string) ([]*webapi.Report, error)

Reports reads every report of a design, newest first.

type DirStore added in v0.9.0

type DirStore struct {
	// contains filtered or unexported fields
}

DirStore is the folder adapter of service.DesignStore (agni issues 1693, 1696, 1739). It keeps a design's record apart from its files.

The record is one YAML record per design, `<id>.yaml`, in a records.Store: a folder for `--store file://`, or sqlite rows for `--store sqlite://` (agni issue 1733). It holds the design's title, series and flatten_hierarchy, and each artifact's type, entry and manifest of paths and hashes. It holds no file bytes.

The files live in the uploads mount. Each file's contents sit once in a BlobDir, by hash. A design reads through a view, `<id>/<rev>/<artifact>/<path>` under the mount, whose files are hard links to the blobs. The view also holds a `design.yaml` written from the record, so the engine finds the design's entry and companions beside its files, as it does in any folder. The record stays the only source, and the view is rebuilt from it and the blobs.

A view is never changed once built. A write builds a new revision's view beside the old one, then renames the record over its old version, so a reader sees the old design or the new one. An old view stays until Sweep finds nothing pointing at it, so a snapshot read from it keeps answering. One mutex serialises every write, since a write is rare beside reads.

func NewDirStore added in v0.9.0

func NewDirStore(recordsDir, uploads, mount string) (*DirStore, error)

NewDirStore returns a store keeping records as files in the folder recordsDir and files in uploads, each created if absent. It is NewStore over a records.Dir.

func NewStore added in v0.11.0

func NewStore(recs records.Store, uploads, mount string) (*DirStore, error)

NewStore returns a store keeping records in recs and files in uploads, created if absent. mount names the mount a server serves the views under, and each design's URIs are written against it. With uploads empty the store keeps records only, and a write of an artifact's files is FAILED_PRECONDITION. The views are folders on this server's disk whatever recs is, since the engine reads a design through a folder.

func NewStoreOver added in v0.11.0

func NewStoreOver(recs records.Store, uploads, mount string, b *BlobDir) (*DirStore, error)

NewStoreOver is NewStore with the uploads' blob store b, such as a bucket behind the local folder (agni issue 1730). A nil b opens the folder's own blobs.

func (*DirStore) Artifacts added in v0.9.0

func (s *DirStore) Artifacts(_ context.Context, id string) ([]*webapi.Artifact, error)

Artifacts reads a design's artifacts from its record, ordered by id.

func (*DirStore) Blobs added in v0.9.0

func (s *DirStore) Blobs() *BlobDir

Blobs is the store's blob folder, or nil for a store with no uploads. A server reads and writes uploaded contents through it, so an upload outlives a restart.

func (*DirStore) CreateDesign added in v0.9.0

func (s *DirStore) CreateDesign(ctx context.Context, id string, rec service.DesignRecord) (*webapi.Design, error)

CreateDesign writes a new design's record, with no artifacts.

func (*DirStore) DeleteArtifact added in v0.9.0

func (s *DirStore) DeleteArtifact(ctx context.Context, id, artifactID string) error

DeleteArtifact removes one artifact, rewriting the design's record without it.

func (*DirStore) DeleteDesign added in v0.9.0

func (s *DirStore) DeleteDesign(_ context.Context, id string) error

DeleteDesign removes a design's record. Its views and blobs stay until Sweep, so a snapshot read from them keeps answering until then.

func (*DirStore) Design added in v0.9.0

func (s *DirStore) Design(_ context.Context, id string) (*webapi.Design, error)

Design reads one stored design from its record.

func (*DirStore) Designs added in v0.9.0

func (s *DirStore) Designs(ctx context.Context) ([]*webapi.Design, error)

Designs reads every stored design, ordered by name.

func (*DirStore) PutRevision added in v0.10.0

func (s *DirStore) PutRevision(ctx context.Context, id, ref string, writes []service.ArtifactWrite, blobs service.BlobSource) (*webapi.DesignRevision, *webapi.Design, error)

PutRevision keeps design id with writes applied as a revision, building its view, and leaves the design's record as it is.

func (*DirStore) RebuildViews added in v0.11.0

func (s *DirStore) RebuildViews(ctx context.Context) (int, error)

RebuildViews builds every view a record names that the uploads folder lacks: each design's current one and each kept revision's (agni issue 1730). Views are hard links to blobs, so a server whose local folder was lost, as an s3:// or gs:// --uploads allows, rebuilds them from the blobs, which the bucket refills on demand. It returns how many it built. A store with no uploads builds none.

func (*DirStore) Revision added in v0.10.0

func (s *DirStore) Revision(_ context.Context, id, rev string) (*webapi.DesignRevision, *webapi.Design, error)

Revision returns the kept revision whose id or one of whose refs is rev.

func (*DirStore) RevisionArtifacts added in v0.10.0

func (s *DirStore) RevisionArtifacts(_ context.Context, id, rev string) ([]*webapi.Artifact, error)

RevisionArtifacts returns design id's artifacts as of the kept revision whose id or one of whose refs is rev (agni issue 1774). A rev it doesn't keep is ErrNotFound.

func (*DirStore) Revisions added in v0.10.0

func (s *DirStore) Revisions(_ context.Context, id string) ([]*webapi.DesignRevision, error)

Revisions returns design id's kept revisions, newest first, and by id among those kept at one time.

func (*DirStore) Sweep added in v0.9.0

func (s *DirStore) Sweep(keep map[string]bool, grace time.Duration, more ...blobs.Referrer) (views, removed int, err error)

Sweep removes views no record names and blobs nothing points at, each only once it is older than grace. keep adds hashes something else holds, such as a snapshot sent as files, and more adds referrers such as the mounts registry's snapshots (agni issue 1759). It returns how many views and blobs it removed.

func (*DirStore) UpdateDesign added in v0.9.0

func (s *DirStore) UpdateDesign(ctx context.Context, id string, update func(*service.DesignRecord)) (*webapi.Design, error)

UpdateDesign rewrites a design's record and keeps its artifacts.

func (*DirStore) WithRevisionPins added in v0.10.0

func (s *DirStore) WithRevisionPins(pins func(ctx context.Context, id string) (map[string]bool, error)) *DirStore

WithRevisionPins makes a prune keep the revisions pins names for a design, and returns s (agni issue 1774). The server pins the revisions its reports ran on, so a report always opens its files.

func (*DirStore) WriteArtifacts added in v0.9.0

func (s *DirStore) WriteArtifacts(ctx context.Context, id string, writes []service.ArtifactWrite, blobs service.BlobSource) ([]*webapi.Artifact, error)

WriteArtifacts replaces or creates artifacts in one write of the design's record.

type FSStore

type FSStore struct {
	// contains filtered or unexported fields
}

FSStore is the filesystem-backed service.ProjectStore. Nothing above the port knows it exists. The tree walking below is only true of keeping projects in directories.

It caches, but every read revalidates against the filesystem before returning, so an operator's edit to a descriptor is visible on the very next request. See cache.go.

func NewFSStore

func NewFSStore(trees ...Tree) *FSStore

NewFSStore returns a store over the given trees, searched in order.

func NewFSStoreFunc added in v0.9.0

func NewFSStoreFunc(trees func() []Tree) *FSStore

NewFSStoreFunc returns a store over the trees trees returns, asked again on every read. The cache still revalidates against each tree's files, so a tree replaced under the same mount name is walked afresh.

func (*FSStore) Designs

func (s *FSStore) Designs(ctx context.Context, parent string) ([]*webapi.Design, error)

Designs returns one project's designs, ordered by resource name. A design belongs to the project when its descriptor names that project in `extends`. A design may sit anywhere a mount reaches, since it names its parent and is not found under it. Each is named "designs/{design}" (agni issue 1694), and two folders declaring one id both appear, for the catalog to report.

func (*FSStore) OnUnlisted added in v0.11.2

func (s *FSStore) OnUnlisted(fn func(Unlisted)) *FSStore

OnUnlisted makes s call fn for each descriptor it parses that sits beside a tier folder it doesn't list (agni issue 1861), and returns s. fn runs again only when the descriptor changes.

func (*FSStore) Project

func (s *FSStore) Project(ctx context.Context, name string) (*webapi.Project, error)

Project returns one project by resource name, or ErrNotFound.

func (*FSStore) Projects

func (s *FSStore) Projects(context.Context) ([]*webapi.Project, error)

Projects discovers every project across the trees, ordered by resource name.

A duplicate id is an ERROR. A first-wins pick could answer a question about project A with project B's designs.

func (*FSStore) ResolveDesign

func (s *FSStore) ResolveDesign(_ context.Context, uri mounts.URI) (*webapi.Design, *webapi.Project, error)

ResolveDesign maps a URI to the design containing it and the project that design extends. It walks UP from the URI's path to find the design, so the answer costs a few stats however many designs a tree holds. The design names its project, and ResolveDesign never takes one found above it.

A miss is (nil, nil, nil), the ordinary state of a mounted folder.

A design that extends nothing is NOT a miss. It comes back with its declaration intact, named "designs/{design}" like any other (agni issue 1694), and with no project. Suppose instead that a project descriptor sits above a design that extends nothing. The author most likely forgot the `extends`, and reading the design would run it on the built-in config with nothing said. So that case is an error.

type MountedDesigns added in v0.9.0

type MountedDesigns struct {
	// contains filtered or unexported fields
}

MountedDesigns reads the designs declared in mounted folders as standalone designs, each named "designs/{design}" by the id its `design.yaml` declares (agni issue 1693). It has no writes, so a service.DesignCatalog refuses a write to one of its designs as read-only.

A design that extends a project keeps that project's resource name in config.extends.

func NewMountedDesigns added in v0.9.0

func NewMountedDesigns(trees ...Tree) *MountedDesigns

NewMountedDesigns reads the given trees. Leave out a tree a DirStore keeps, or each of its designs is held twice.

func NewMountedDesignsFunc added in v0.9.0

func NewMountedDesignsFunc(trees func() []Tree) *MountedDesigns

NewMountedDesignsFunc reads the trees trees returns, asked again on every read, so a mount made at runtime is read at once (agni issue 1735).

func (*MountedDesigns) Design added in v0.9.0

func (m *MountedDesigns) Design(ctx context.Context, id string) (*webapi.Design, error)

Design returns one mounted design by id. Two folders declaring it is ErrFailedPrecondition naming both.

func (*MountedDesigns) Designs added in v0.9.0

func (m *MountedDesigns) Designs(context.Context) ([]*webapi.Design, error)

Designs returns every mounted design, ordered by name. Two folders declaring one id both appear.

type Sources added in v0.3.6

type Sources struct {
	Extends  string
	Profiles []string
	Params   []string
	Symbols  []string
	Lib      []string
	Queries  []string
	// ChecklistDirs are the checklists written as a folder of item files (agni issue 1812). The
	// config holds each one's name until ResolveChecklistDirs reads its folder.
	ChecklistDirs []ChecklistDir
}

Sources holds a descriptor's references outside itself, as written. They are the descriptor it extends and the files of each tier, each a descriptor-relative path or a mount:// URI. Only the store knows where the descriptor sits, so the store resolves them, and there a source naming nothing is an error.

func ParseDesign

func ParseDesign(r io.Reader) (id string, d *webapi.Design, src Sources, err error)

ParseDesign reads a `design.yaml`. It returns the declared id, the wire message and the design's sources. Like ParseProject, it returns the id separately and refuses an unknown field.

`entry_uri` and `companion_uris` come back holding DESIGN-FOLDER-RELATIVE NAMES, not URIs. The store turns them into URIs when it locates the design, and nothing outside this package observes the intermediate state.

An entry or companion that escapes the design folder is rejected here, not where a loader would open it. The error then names the descriptor, and the operator knows which file to fix.

func ParseProject

func ParseProject(r io.Reader) (id string, p *webapi.Project, src Sources, err error)

ParseProject reads a `project.yaml`. It returns the declared id, the wire message and the project's sources, and the store resolves those sources.

The id comes back SEPARATELY rather than as `Project.name`, because a bare id is not a resource name and only the store knows where the descriptor was reached.

An unknown field is an ERROR, so a misspelled key in a hand-written descriptor fails loudly rather than silently configuring nothing. A design's own keys are refused too, naming where they go.

type Tree

type Tree struct {
	// Mount is the name callers use to address this tree. It is also the value of Project.mount.
	Mount string
	FS    fs.FS
}

Tree is one named filesystem for the store to look in. It is a mount on a server, a bounded slice of the local filesystem for the CLI, or an embedded FS in a test.

type Unlisted added in v0.11.2

type Unlisted struct {
	// Descriptor is the project.yaml or design.yaml, as a mount:// URI, zero for a project.yaml read
	// from files. A caller that knows where the mount sits on disk names it by its path instead.
	Descriptor mounts.URI
	// Tiers are the folder names, in tierFolders order.
	Tiers []string
}

Unlisted is a descriptor that sits beside folders named like its file tiers and lists none of them (agni issue 1861). Releases before agni 1136 found a profiles/ or params/ folder by its name, so a project written for them still loads, and runs without those tiers and with no error.

func (Unlisted) Note added in v0.11.2

func (u Unlisted) Note(where string) string

Note is the line a surface prints for u, naming the descriptor as where.

Jump to

Keyboard shortcuts

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