Documentation ¶
Index ¶
- Constants
- Variables
- func AddServersAsResources(ctx context.Context, pl EarlyPackageLoader, owner *schema.PackageRef, ...) error
- func Ensure(ctx context.Context, packages pkggraph.PackageLoader, ...) error
- func FinalizePackage(ctx context.Context, env *schema.Environment, pl EarlyPackageLoader, ...) (*pkggraph.Package, error)
- func FindModuleRoot(dir string) (string, error)
- func FindProvider(pkg *pkggraph.Package, packageName schema.PackageName, typeName string) (*schema.Node, *schema.Provides)
- func GetExtension(extensions []*anypb.Any, msg proto.Message) bool
- func IsSecretResource(ref packageRefLike) bool
- func IsServerResource(ref packageRefLike) bool
- func LoadPackageByName(ctx context.Context, env cfg.Context, name schema.PackageName) (*pkggraph.Package, error)
- func LoadResources(ctx context.Context, pl pkggraph.PackageLoader, loc pkggraph.Location, ...) ([]pkggraph.ResourceInstance, error)
- func MakeProtoParseOpts(ctx context.Context, p pkggraph.PackageLoader, workspace *schema.Workspace) (protos.ParseOpts, error)
- func ModuleAt(ctx context.Context, path string, args ModuleAtArgs) (pkggraph.WorkspaceData, error)
- func ModuleHead(ctx context.Context, resolved *ResolvedPackage) (*schema.Workspace_Dependency, error)
- func MustExtension(extensions []*anypb.Any, msg proto.Message) error
- func RawFindModuleRoot(dir string, names ...string) (string, error)
- func RawModuleAt(ctx context.Context, path string) (pkggraph.WorkspaceData, error)
- func RegisterFrameworkHandler(framework schema.Framework, handler FrameworkHandler)
- func ResolveModuleVersion(ctx context.Context, packageName string) (*schema.Workspace_Dependency, error)
- func TransformFunction(loc pkggraph.Location, function *schema.ExperimentalFunction) error
- func TransformNode(ctx context.Context, pl pkggraph.PackageLoader, loc pkggraph.Location, ...) error
- func TransformServer(ctx context.Context, pl pkggraph.PackageLoader, srv *schema.Server, ...) (*schema.Server, error)
- func ValidateServerID(n *schema.Server) error
- func WithMissingModuleResolver(moduleResolver MissingModuleResolver) packageLoaderOpt
- type CueService
- type EarlyPackageLoader
- type ExtendNodeHookResult
- type ExtendServerHookResult
- type FrameworkHandler
- type Frontend
- type LocalModule
- type MissingModuleResolver
- type ModuleAtArgs
- type PackageLoader
- func (pl *PackageLoader) ExternalLocation(ctx context.Context, mod *schema.Workspace_Dependency, ...) (pkggraph.Location, error)
- func (pl *PackageLoader) LoadByName(ctx context.Context, packageName schema.PackageName) (*pkggraph.Package, error)
- func (pl *PackageLoader) MatchModuleReplace(ctx context.Context, packageName schema.PackageName) (*pkggraph.Location, error)
- func (pl *PackageLoader) Resolve(ctx context.Context, original schema.PackageName) (pkggraph.Location, error)
- func (pl *PackageLoader) Seal() pkggraph.SealedPackageLoader
- func (pl *PackageLoader) Stats(ctx context.Context) PackageLoaderStats
- func (pl *PackageLoader) WorkspaceOf(ctx context.Context, module *pkggraph.Module) (fs.FS, error)
- type PackageLoaderStats
- type PackageType
- type ResolvedPackage
- type Root
- func (root *Root) Abs() string
- func (root *Root) DevHost() *schema.DevHost
- func (root *Root) EditableWorkspace() pkggraph.EditableWorkspaceData
- func (root *Root) ErrorLocation() string
- func (root *Root) ModuleName() string
- func (root *Root) ReadOnlyFS() fs.ReadDirFS
- func (root *Root) ReadWriteFS() fnfs.ReadWriteFS
- func (root *Root) RelPackage(rel string) fnfs.Location
- func (root *Root) Workspace() cfg.Workspace
- type SchemaList
- type SealHelper
- type Sealed
- type ServerFrameworkExt
- type ServerInputs
Constants ¶
const StartupTestBinary = "namespacelabs.dev/foundation/std/startup/testdriver"
Variables ¶
var ExtendNodeHook []func(context.Context, pkggraph.PackageLoader, pkggraph.Location, *schema.Node) (*ExtendNodeHookResult, error)
var ExtendServerHook []func(pkggraph.Location, *schema.Server) ExtendServerHookResult
var (
FrameworkHandlers = map[schema.Framework]FrameworkHandler{}
)
var MakeFrontend func(EarlyPackageLoader, *schema.Environment) Frontend
var ModuleLoader interface { FindModuleRoot(string) (string, error) ModuleAt(context.Context, string) (pkggraph.WorkspaceData, error) }
Functions ¶
func AddServersAsResources ¶ added in v0.0.83
func AddServersAsResources(ctx context.Context, pl EarlyPackageLoader, owner *schema.PackageRef, servers []schema.PackageName, pack *schema.ResourcePack) error
func Ensure ¶
func Ensure(ctx context.Context, packages pkggraph.PackageLoader, packageName schema.PackageName) error
func FinalizePackage ¶
func FinalizePackage(ctx context.Context, env *schema.Environment, pl EarlyPackageLoader, pp *pkggraph.Package) (*pkggraph.Package, error)
This function contains frontend-agnostic validation and processing code.
func FindModuleRoot ¶
func FindProvider ¶
func IsSecretResource ¶
func IsSecretResource(ref packageRefLike) bool
func IsServerResource ¶
func IsServerResource(ref packageRefLike) bool
func LoadPackageByName ¶
func LoadResources ¶
func LoadResources(ctx context.Context, pl pkggraph.PackageLoader, loc pkggraph.Location, pack *schema.ResourcePack) ([]pkggraph.ResourceInstance, error)
func MakeProtoParseOpts ¶
func ModuleAt ¶
func ModuleAt(ctx context.Context, path string, args ModuleAtArgs) (pkggraph.WorkspaceData, error)
Loads and validates a module at a given path.
func ModuleHead ¶
func ModuleHead(ctx context.Context, resolved *ResolvedPackage) (*schema.Workspace_Dependency, error)
func RawModuleAt ¶
RawModuleAt returns a schema.WorkspaceData with a reference to the workspace filename tried, even when errors are returned.
func RegisterFrameworkHandler ¶
func RegisterFrameworkHandler(framework schema.Framework, handler FrameworkHandler)
func ResolveModuleVersion ¶
func TransformFunction ¶
func TransformFunction(loc pkggraph.Location, function *schema.ExperimentalFunction) error
func TransformNode ¶
func TransformServer ¶
func ValidateServerID ¶
func WithMissingModuleResolver ¶
func WithMissingModuleResolver(moduleResolver MissingModuleResolver) packageLoaderOpt
Types ¶
type CueService ¶
type EarlyPackageLoader ¶
type EarlyPackageLoader interface { pkggraph.PackageLoader WorkspaceOf(context.Context, *pkggraph.Module) (fs.FS, error) }
EarlyPackageLoader is available during package graph construction, and has the ability to load workspace contents as well. All of the contents that are loaded through WorkspaceOf are retained, and stored as part of the config image, so that package loading is fully reproducible.
type ExtendNodeHookResult ¶
type ExtendNodeHookResult struct { Import []schema.PackageName LoadPackages []schema.PackageName // Packages to also be loaded by nodes, but that won't be listed as dependencies. }
type ExtendServerHookResult ¶
type ExtendServerHookResult struct {
Import []schema.PackageName
}
type FrameworkHandler ¶
type FrameworkHandler interface { PreParseServer(context.Context, pkggraph.Location, *ServerFrameworkExt) error PostParseServer(context.Context, *Sealed) error // List of packages that should be added as server dependencies, when the target environment's purpose is DEVELOPMENT. DevelopmentPackages() []schema.PackageName }
XXX we're injection Location in these, which allows for loading arbitrary files for the workspace; Ideally we'd pass a PackageLoader instead.
type LocalModule ¶
LocalModule represents a module that is present in the specified LocalPath.
func DownloadModule ¶
func DownloadModule(ctx context.Context, dep *schema.Workspace_Dependency, force bool) (*LocalModule, error)
type MissingModuleResolver ¶
type MissingModuleResolver interface {
Resolve(context.Context, schema.PackageName) (*schema.Workspace_Dependency, error)
}
type ModuleAtArgs ¶
type ModuleAtArgs struct {
SkipAPIRequirements bool
}
type PackageLoader ¶
type PackageLoader struct {
// contains filtered or unexported fields
}
Parsing packages often as an exponential factor because nodes tend to depend on complete whole sub-trees. During a single root load, we maintain a cache of already loaded packages to minimize this fan-out cost.
func NewPackageLoader ¶
func NewPackageLoader(env cfg.Context, opt ...packageLoaderOpt) *PackageLoader
func (*PackageLoader) ExternalLocation ¶
func (pl *PackageLoader) ExternalLocation(ctx context.Context, mod *schema.Workspace_Dependency, packageName schema.PackageName) (pkggraph.Location, error)
func (*PackageLoader) LoadByName ¶
func (pl *PackageLoader) LoadByName(ctx context.Context, packageName schema.PackageName) (*pkggraph.Package, error)
func (*PackageLoader) MatchModuleReplace ¶
func (pl *PackageLoader) MatchModuleReplace(ctx context.Context, packageName schema.PackageName) (*pkggraph.Location, error)
func (*PackageLoader) Resolve ¶
func (pl *PackageLoader) Resolve(ctx context.Context, original schema.PackageName) (pkggraph.Location, error)
func (*PackageLoader) Seal ¶
func (pl *PackageLoader) Seal() pkggraph.SealedPackageLoader
func (*PackageLoader) Stats ¶
func (pl *PackageLoader) Stats(ctx context.Context) PackageLoaderStats
func (*PackageLoader) WorkspaceOf ¶
type PackageLoaderStats ¶
type PackageType ¶
type PackageType int
const ( PackageType_None PackageType = iota PackageType_Extension PackageType_Service PackageType_Server PackageType_Binary PackageType_Test PackageType_NewSyntax // TODO consider refining )
type ResolvedPackage ¶
func ResolveModule ¶
func ResolveModule(ctx context.Context, packageName string) (*ResolvedPackage, error)
type Root ¶
func (*Root) EditableWorkspace ¶
func (root *Root) EditableWorkspace() pkggraph.EditableWorkspaceData
func (*Root) ModuleName ¶
func (*Root) ReadOnlyFS ¶
func (*Root) ReadWriteFS ¶
func (root *Root) ReadWriteFS() fnfs.ReadWriteFS
type SchemaList ¶
type SchemaList struct { Root *Root Locations []fnfs.Location Types []PackageType }
func ListSchemas ¶
Returns a list of all of the schema definitions found under root.
type SealHelper ¶
type SealHelper struct {
AdditionalServerDeps func(schema.Framework) ([]schema.PackageName, error)
}
type Sealed ¶
type Sealed struct { Location pkggraph.Location Proto *schema.Stack_Entry FileDeps []string Deps []*pkggraph.Package ParsedPackage *pkggraph.Package }
func Seal ¶
func Seal(ctx context.Context, loader pkggraph.PackageLoader, focus schema.PackageName, helper *SealHelper) (Sealed, error)
type ServerFrameworkExt ¶
type ServerFrameworkExt struct { Include []schema.PackageName FrameworkSpecific *anypb.Any }
type ServerInputs ¶
type ServerInputs struct {
Services []*schema.GrpcExportService
}