sourceview

package
v0.1.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 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 sourceview resolves portable repository identities to exactly one local checkout per repository for one command invocation.

Index

Constants

View Source
const EnvName = "FACET_SOURCE_VIEW"
View Source
const LocalName = ".facet/sources.local.yaml"

Variables

This section is empty.

Functions

func IsError

func IsError(err error) bool

func LoadLocalSpecSources

func LoadLocalSpecSources(root string) (map[string]string, error)

LoadLocalSpecSources reads the checkout overrides used by spec update.

func SelectionError

func SelectionError(message string) error

Types

type Binding

type Binding struct {
	Repository string `yaml:"repository" json:"repository"`
	Checkout   string `yaml:"checkout" json:"-"`
}

type Config

type Config struct {
	Repositories       map[string]Repository `yaml:"repositories" json:"repositories"`
	RegistryRepository string                `yaml:"registry_repository,omitempty" json:"registry_repository,omitempty"`
	DefaultView        string                `yaml:"default_view,omitempty" json:"default_view,omitempty"`
	Views              map[string]View       `yaml:"views" json:"views"`
}

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML keeps this opt-in block closed even though older project-wide configuration permits plugin-specific extensions elsewhere. Personal checkout locations belong only in the ignored local bindings file.

func (Config) Validate

func (c Config) Validate() error

type LocalConfig

type LocalConfig struct {
	Bindings map[string]Binding `yaml:"bindings" json:"-"`
}

func (*LocalConfig) UnmarshalYAML

func (c *LocalConfig) UnmarshalYAML(unmarshal func(any) error) error

type Repository

type Repository struct {
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
}

type ResolvedView

type ResolvedView struct {
	Name               string                `json:"name"`
	RegistryRepository string                `json:"registry_repository,omitempty"`
	Sources            map[string]Source     `json:"sources"`
	Repositories       map[string]Repository `json:"repositories"`
	// contains filtered or unexported fields
}

func Failed

func Failed(name string, err error) *ResolvedView

func Resolve

func Resolve(root string, cfg Config, selected string) (*ResolvedView, error)

func ResolveCommittedBindings

func ResolveCommittedBindings(root string, cfg Config, local LocalConfig, selected string, revisions map[string]string) (*ResolvedView, error)

ResolveCommittedBindings validates identities and refs without reading working tree content. The calling revision verifier materializes the returned commits.

func ResolveWithBindings

func ResolveWithBindings(root string, cfg Config, local LocalConfig, selected string) (*ResolvedView, error)

@facet: registry/layout/source-views @facet-role: primary

func (*ResolvedView) Ordered

func (v *ResolvedView) Ordered() []Source

func (*ResolvedView) Qualify

func (v *ResolvedView) Qualify(repository, relative string) (string, error)

func (*ResolvedView) ResolveReference

func (v *ResolvedView) ResolveReference(ref string) (Source, string, error)

func (*ResolvedView) Source

func (v *ResolvedView) Source(repository string) (Source, error)

func (*ResolvedView) Validate

func (v *ResolvedView) Validate() error

type Selection

type Selection struct {
	Binding string `yaml:"binding" json:"binding"`
	Ref     string `yaml:"ref,omitempty" json:"ref,omitempty"`
}

type Source

type Source struct {
	Repository  string `json:"repository"`
	Binding     string `json:"binding"`
	Root        string `json:"-"`
	Ref         string `json:"ref,omitempty"`
	Revision    string `json:"revision"`
	Dirty       bool   `json:"dirty"`
	ContentHash string `json:"content_hash"`
	// contains filtered or unexported fields
}

func (Source) Files

func (s Source) Files() ([]string, error)

func (Source) Read

func (s Source) Read(relative string) ([]byte, error)

Read validates the requested file against the invocation snapshot. Callers publishing an aggregate result must also Validate the complete view before and after their operation; this avoids rehashing every repository per file.

func (Source) ValidateWorkingTree

func (s Source) ValidateWorkingTree() error

type View

type View struct {
	Sources map[string]Selection `yaml:"sources" json:"sources"`
}

Jump to

Keyboard shortcuts

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