Documentation ¶
Index ¶
- Variables
- func CheckLoad(ctx context.Context, pl PackageLoader, loc Location, ref *schema.PackageRef) error
- func ParseAndLoadRef(ctx context.Context, pl PackageLoader, loc Location, ref string) (*schema.PackageRef, error)
- func ValidateFoundation(what string, minimumVersion int, lmf LoadModuleFunc) error
- type Context
- type EditableWorkspaceData
- type ExpectedResourceInstance
- type LoadModuleFunc
- type Location
- type MinimalPackageLoader
- type Module
- func (mod *Module) Abs() string
- func (mod *Module) ChangeTrigger(rel string, excludes []string) compute.Computable[any]
- func (mod *Module) DefinitionFile() string
- func (mod *Module) ErrorLocation() string
- func (mod *Module) IsExternal() bool
- func (mod *Module) MakeLocation(relPath string) Location
- func (mod *Module) ModuleName() string
- func (mod *Module) ReadOnlyFS(rel ...string) fs.FS
- func (mod *Module) ReadWriteFS() fnfs.ReadWriteFS
- func (mod *Module) RootLocation() Location
- func (mod *Module) VCS(ctx context.Context) (*runtime.BuildVCS, error)
- func (mod *Module) Version() string
- type Modules
- type MutableModule
- type Package
- func (pr *Package) LookupBinary(name string) (*schema.Binary, error)
- func (pr *Package) LookupResourceClass(name string) *ResourceClass
- func (pr *Package) LookupResourceInstance(name string) *ResourceInstance
- func (pr *Package) LookupResourceProvider(classRef *schema.PackageRef) *ResourceProvider
- func (pr *Package) LookupSecret(name string) *schema.SecretSpec
- func (pr *Package) Node() *schema.Node
- func (pr *Package) PackageName() schema.PackageName
- type PackageLoader
- type PreStartup
- type PrepareHook
- type ProvisionInputs
- type ResourceClass
- type ResourceInstance
- type ResourceProvider
- type ResourceSpec
- type SealedContext
- type SealedPackageLoader
- type StackEndpoints
- type StartupInputs
- type UserType
- type ValueWithPath
- type WorkspaceData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PackageLoaderInjection = execution.Define[PackageLoader]("ns.pkggraph.package-loader") MutableModuleInjection = execution.Define[MutableModule]("ns.pkggraph.mutable-module") )
Functions ¶
func CheckLoad ¶ added in v0.0.117
func CheckLoad(ctx context.Context, pl PackageLoader, loc Location, ref *schema.PackageRef) error
func ParseAndLoadRef ¶ added in v0.0.117
func ParseAndLoadRef(ctx context.Context, pl PackageLoader, loc Location, ref string) (*schema.PackageRef, error)
func ValidateFoundation ¶ added in v0.0.110
func ValidateFoundation(what string, minimumVersion int, lmf LoadModuleFunc) error
Types ¶
type Context ¶
type Context interface { cfg.Context PackageLoader }
type EditableWorkspaceData ¶
type EditableWorkspaceData interface { FormatTo(io.Writer) error WithModuleName(string) WorkspaceData WithSetDependency(...*schema.Workspace_Dependency) WorkspaceData WithReplacedDependencies([]*schema.Workspace_Dependency) WorkspaceData WithSetEnvironment(...*schema.Workspace_EnvironmentSpec) WorkspaceData }
type ExpectedResourceInstance ¶
type ExpectedResourceInstance struct { Name *schema.PackageRef Class ResourceClass DefaultResource *schema.PackageRef }
type LoadModuleFunc ¶ added in v0.0.110
type LoadModuleFunc func(schema.PackageName) (*Module, error)
func ModuleFromLoader ¶ added in v0.0.110
func ModuleFromLoader(ctx context.Context, pl PackageLoader) LoadModuleFunc
func ModuleFromModules ¶ added in v0.0.110
func ModuleFromModules(mods Modules) LoadModuleFunc
type Location ¶
type Location struct { Module *Module PackageName schema.PackageName // contains filtered or unexported fields }
func NewLocationForTesting ¶
func (Location) Abs ¶
Abs returns an absolute path to the location. If path segments are passed in, the combined relative path is returned.
func (Location) CheckRel ¶
CheckRel returns a path relative to the module. If the path attempts to escape the module, an error is returned.
func (Location) ErrorLocation ¶
ErrorLocation implements the fnerrors.Location interface.
func (Location) GetPackageName ¶ added in v0.0.167
GetPackageName implements the schema.PackageNameLike interface.
type MinimalPackageLoader ¶ added in v0.0.81
type Module ¶
func (*Module) ChangeTrigger ¶ added in v0.0.109
func (*Module) DefinitionFile ¶ added in v0.0.112
func (*Module) ErrorLocation ¶
Implements fnerrors.Location.
func (*Module) IsExternal ¶
An external module is downloaded from a remote location and stored in the cache. It always has a version.
func (*Module) MakeLocation ¶
func (*Module) ModuleName ¶
func (*Module) ReadWriteFS ¶
func (mod *Module) ReadWriteFS() fnfs.ReadWriteFS
func (*Module) RootLocation ¶
type MutableModule ¶
type MutableModule interface { ModuleName() string // The module that this workspace corresponds to. ReadWriteFS() fnfs.ReadWriteFS }
type Package ¶
type Package struct { Location Location PackageSources fs.FS // Filenames included will be relative to the module root, not the package. NewFrontend bool // If set to true, the new frontend parser was used to load this package. // One of. Extension *schema.Node Service *schema.Node Server *schema.Server ServerFragment *schema.ServerFragment // Includes auto-generated (e.g. server startup) tests. Tests []*schema.Test // Inlined or explicitly defined binaries. Binaries []*schema.Binary // Integration that has been applied to the server in this package. May be nil. // Shouldn't be used outside of workspace.FinalizePackage. Integration *schema.Integration // Parsed secret definitions within the package. Secrets []*schema.SecretSpec // Parsed volume definitions within the package. Volumes []*schema.Volume // Resources associated with node types. Provides map[string]*protos.FileDescriptorSetAndDeps // key: `Provides.Name` Services map[string]*protos.FileDescriptorSetAndDeps // key: fully qualified service name PackageData []*types.Resource // Parsed resources Resources []ResourceInstance ResourceClasses []ResourceClass ResourceProviders []ResourceProvider // Hooks PrepareHooks []PrepareHook LegacyComputeStartup PreStartup ComputePlanWith []*schema.Invocation // Will generate further plan contents. // Raw resources definitions within a package. ResourceClassSpecs []*schema.ResourceClass ResourceProvidersSpecs []*schema.ResourceProvider ResourceInstanceSpecs []*schema.ResourceInstance }
func LoadBinary ¶
func LoadBinary(ctx context.Context, pl PackageLoader, ref *schema.PackageRef) (*Package, *schema.Binary, error)
func (*Package) LookupResourceClass ¶
func (pr *Package) LookupResourceClass(name string) *ResourceClass
func (*Package) LookupResourceInstance ¶
func (pr *Package) LookupResourceInstance(name string) *ResourceInstance
func (*Package) LookupResourceProvider ¶
func (pr *Package) LookupResourceProvider(classRef *schema.PackageRef) *ResourceProvider
func (*Package) LookupSecret ¶
func (pr *Package) LookupSecret(name string) *schema.SecretSpec
func (*Package) PackageName ¶
func (pr *Package) PackageName() schema.PackageName
type PackageLoader ¶
type PackageLoader interface { Resolve(ctx context.Context, packageName schema.PackageName) (Location, error) LoadByName(ctx context.Context, packageName schema.PackageName) (*Package, error) // Ensure that a package is being loaded. // Guaranteed to return immediately if the package is already being loaded concurrently. // This is important to avoid deadlocks on cyclic dependencies. Ensure(ctx context.Context, packageName schema.PackageName) error }
type PreStartup ¶
type PreStartup interface {
EvalStartup(context.Context, Context, StartupInputs, []ValueWithPath) (*schema.StartupPlan, error)
}
type PrepareHook ¶
type PrepareHook struct { InvokeInternal string InvokeBinary *schema.Invocation }
type ProvisionInputs ¶
type ProvisionInputs struct {
ServerLocation Location
}
type ResourceClass ¶
type ResourceClass struct { Ref *schema.PackageRef Source *schema.ResourceClass DefaultProvider schema.PackageName // May be empty. InstanceType UserType }
func LookupResourceClass ¶
func LookupResourceClass(ctx context.Context, pl MinimalPackageLoader, owner *Package, ref *schema.PackageRef) (*ResourceClass, error)
func (ResourceClass) PackageName ¶
func (rc ResourceClass) PackageName() schema.PackageName
type ResourceInstance ¶
type ResourceInstance struct { ResourceID string ResourceRef *schema.PackageRef Spec ResourceSpec }
func LookupResource ¶ added in v0.0.157
func LookupResource(ctx context.Context, pl MinimalPackageLoader, owner *Package, ref *schema.PackageRef) (*ResourceInstance, error)
type ResourceProvider ¶
type ResourceProvider struct { Spec *schema.ResourceProvider ProviderID string IntentType *UserType Resources []ResourceInstance ResourceInputs []ExpectedResourceInstance }
func (ResourceProvider) LookupExpected ¶
func (rp ResourceProvider) LookupExpected(name *schema.PackageRef) *ExpectedResourceInstance
type ResourceSpec ¶
type ResourceSpec struct { Source *schema.ResourceInstance Intent *anypb.Any // XXX always use serialized JSON. IntentType *UserType Class ResourceClass Provider *ResourceProvider ResourceInputs []ResourceInstance // Resources passed to the provider. }
type SealedContext ¶
type SealedContext interface { cfg.Context SealedPackageLoader }
func MakeSealedContext ¶
func MakeSealedContext(env cfg.Context, pr SealedPackageLoader) SealedContext
type SealedPackageLoader ¶
type SealedPackageLoader interface { PackageLoader Modules Packages() []*Package }
type StackEndpoints ¶
type StackEndpoints interface {
EndpointsBy(schema.PackageName) []*schema.Endpoint
}
type StartupInputs ¶
type StartupInputs struct { ServerImage string // Result of imageID.ImageRef(), not oci.ImageID to avoid cycles. Stack StackEndpoints ServerRootAbs string }
type UserType ¶
type UserType struct { Descriptor protoreflect.MessageDescriptor Sources *protos.FileDescriptorSetAndDeps Registry *protoregistry.Files }
type ValueWithPath ¶
type WorkspaceData ¶
Click to show internal directories.
Click to hide internal directories.