pkggraph

package
v0.0.100 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

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

This section is empty.

Types

type Context

type Context interface {
	cfg.Context
	PackageLoader
}

type ContextWithMutableModule

type ContextWithMutableModule interface {
	Context
	MutableModule
}

type EditableWorkspaceData

type EditableWorkspaceData interface {
	FormatTo(io.Writer) error

	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
}

type Location

type Location struct {
	Module      *Module
	PackageName schema.PackageName
	// contains filtered or unexported fields
}

func NewLocationForTesting

func NewLocationForTesting(root *Module, packageName, path string) Location

func (Location) Abs

func (loc Location) Abs(rel ...string) string

Abs returns an absolute path to the location. If path segments are passed in, the combined relative path is returned.

func (Location) CheckRel

func (loc Location) CheckRel(rel string) (string, error)

CheckRel returns a path relative to the module. If the path attempts to escape the module, an error is returned.

func (Location) ErrorLocation

func (loc Location) ErrorLocation() string

ErrorLocation implements the fnerrors.Location interface.

func (Location) Rel

func (loc Location) Rel(rel ...string) string

Rel returns a path to the location, relative to the workspace root. If path segments are passed in, the combined relative path is returned.

func (Location) String

func (loc Location) String() string

type MinimalPackageLoader added in v0.0.81

type MinimalPackageLoader interface {
	LoadByName(ctx context.Context, packageName schema.PackageName) (*Package, error)
}

type Module

type Module struct {
	Workspace     *schema.Workspace
	WorkspaceData WorkspaceData
	// contains filtered or unexported fields
}

func NewModule

func NewModule(w *schema.Workspace, lf *schema.Workspace_LoadedFrom, version string) *Module

func (*Module) Abs

func (mod *Module) Abs() string

func (*Module) ErrorLocation

func (mod *Module) ErrorLocation() string

Implements fnerrors.Location.

func (*Module) IsExternal

func (mod *Module) IsExternal() bool

An external module is downloaded from a remote location and stored in the cache. It always has a version.

func (*Module) MakeLocation

func (mod *Module) MakeLocation(relPath string) Location

func (*Module) ModuleName

func (mod *Module) ModuleName() string

func (*Module) ReadOnlyFS

func (mod *Module) ReadOnlyFS() fs.FS

func (*Module) ReadWriteFS

func (mod *Module) ReadWriteFS() fnfs.ReadWriteFS

func (*Module) RootLocation

func (mod *Module) RootLocation() Location

func (*Module) VCS

func (mod *Module) VCS(ctx context.Context) (*runtime.BuildVCS, error)

func (*Module) Version

func (mod *Module) Version() string

func (*Module) VersionedFS

func (mod *Module) VersionedFS(rel string, observeChanges bool) compute.Computable[wscontents.Versioned]

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.
	Parsed         PreProvision

	// One of.
	Extension            *schema.Node
	Service              *schema.Node
	Server               *schema.Server
	ExperimentalFunction *schema.ExperimentalFunction

	// 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

	// 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) LookupBinary

func (pr *Package) LookupBinary(name string) (*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) Node

func (pr *Package) Node() *schema.Node

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)
}

type PreProvision

type PreProvision interface {
	EvalProvision(context.Context, cfg.Context, ProvisionInputs) (ProvisionPlan, 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 PreparedProvisionPlan

type PreparedProvisionPlan struct {
	DeclaredStack   []schema.PackageName
	Sidecars        []*schema.SidecarContainer
	Inits           []*schema.SidecarContainer
	ComputePlanWith []*schema.Invocation // Will generate further plan contents.
}

func (*PreparedProvisionPlan) AppendWith

func (p *PreparedProvisionPlan) AppendWith(rhs PreparedProvisionPlan)

type ProvisionInputs

type ProvisionInputs struct {
	ServerLocation Location
}

type ProvisionPlan

type ProvisionPlan struct {
	Startup PreStartup

	// All fields on Nodes. Servers only allow specifying `Provisioning`.
	PreparedProvisionPlan

	// Server only.
	Naming *schema.Naming
}

type ResourceClass

type ResourceClass struct {
	Ref          *schema.PackageRef
	Source       *schema.ResourceClass
	IntentType   UserType
	InstanceType UserType
}

func (ResourceClass) PackageName

func (rc ResourceClass) PackageName() schema.PackageName

type ResourceInstance

type ResourceInstance struct {
	ResourceRef *schema.PackageRef
	Spec        ResourceSpec
}

type ResourceProvider

type ResourceProvider struct {
	Spec *schema.ResourceProvider

	Resources      []ResourceInstance
	ResourceInputs []ExpectedResourceInstance
}

func (ResourceProvider) LookupExpected

func (rp ResourceProvider) LookupExpected(name *schema.PackageRef) *ExpectedResourceInstance

type ResourceSpec

type ResourceSpec struct {
	Source         *schema.ResourceInstance
	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() []*Module
	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 ValueWithPath struct {
	Need  *schema.Need
	Value any
}

type WorkspaceData

type WorkspaceData interface {
	cfg.Workspace

	AbsPath() string
	DefinitionFile() string
	RawData() []byte

	EditableWorkspaceData
}

Jump to

Keyboard shortcuts

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