core

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 73 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DetachGracePeriod is an arbitrary amount of time between when a service is
	// no longer actively used and before it is detached. This is to avoid repeated
	// stopping and re-starting of the same service in rapid succession.
	DetachGracePeriod = 10 * time.Second

	// TerminateGracePeriod is an arbitrary amount of time between when a service is
	// sent a graceful stop (SIGTERM) and when it is sent an immediate stop (SIGKILL).
	TerminateGracePeriod = 10 * time.Second
)
View Source
const InstrumentationLibrary = "dagger.io/core"
View Source
const (
	ModuleName = "daggercore"
)
View Source
const (
	ShimEnableTTYEnvVar = "_DAGGER_ENABLE_TTY"
)

Variables

View Source
var (
	CacheSharingModeShared = CacheSharingModes.Register("SHARED",
		"Shares the cache volume amongst many build pipelines")
	CacheSharingModePrivate = CacheSharingModes.Register("PRIVATE",
		"Keeps a cache volume for a single build pipeline")
	CacheSharingModeLocked = CacheSharingModes.Register("LOCKED",
		"Shares the cache volume amongst many build pipelines, but will serialize the writes")
)
View Source
var (
	CompressionGzip         = ImageLayerCompressions.Register("Gzip")
	CompressionZstd         = ImageLayerCompressions.Register("Zstd")
	CompressionEStarGZ      = ImageLayerCompressions.Register("EStarGZ")
	CompressionUncompressed = ImageLayerCompressions.Register("Uncompressed")
)
View Source
var (
	OCIMediaTypes    = ImageMediaTypesEnum.Register("OCIMediaTypes")
	DockerMediaTypes = ImageMediaTypesEnum.Register("DockerMediaTypes")
)
View Source
var (
	ModuleSourceKindLocal = ModuleSourceKindEnum.Register("LOCAL_SOURCE")
	ModuleSourceKindGit   = ModuleSourceKindEnum.Register("GIT_SOURCE")
)
View Source
var (
	NetworkProtocolTCP = NetworkProtocols.Register("TCP")
	NetworkProtocolUDP = NetworkProtocols.Register("UDP")
)
View Source
var (
	TypeDefKindString = TypeDefKinds.Register("STRING_KIND",
		"A string value.")
	TypeDefKindInteger = TypeDefKinds.Register("INTEGER_KIND",
		"An integer value.")
	TypeDefKindBoolean = TypeDefKinds.Register("BOOLEAN_KIND",
		"A boolean value.")
	TypeDefKindList = TypeDefKinds.Register("LIST_KIND",
		"A list of values all having the same type.",
		"Always paired with a ListTypeDef.")
	TypeDefKindObject = TypeDefKinds.Register("OBJECT_KIND",
		"A named type defined in the GraphQL schema, with fields and functions.",
		"Always paired with an ObjectTypeDef.")
	TypeDefKindInterface = TypeDefKinds.Register("INTERFACE_KIND",
		`A named type of functions that can be matched+implemented by other
		objects+interfaces.`,
		"Always paired with an InterfaceTypeDef.")
	TypeDefKindInput = TypeDefKinds.Register("INPUT_KIND",
		`A graphql input type, used only when representing the core API via TypeDefs.`,
	)
	TypeDefKindVoid = TypeDefKinds.Register("VOID_KIND",
		"A special kind used to signify that no value is returned.",
		`This is used for functions that have no return value. The outer TypeDef
		specifying this Kind is always Optional, as the Void is never actually
		represented.`,
	)
)
View Source
var CacheSharingModes = dagql.NewEnum[CacheSharingMode]()
View Source
var ErrNoCurrentModule = fmt.Errorf("no current module")
View Source
var ImageLayerCompressions = dagql.NewEnum[ImageLayerCompression]()
View Source
var ImageMediaTypesEnum = dagql.NewEnum[ImageMediaTypes]()
View Source
var ModuleSourceKindEnum = dagql.NewEnum[ModuleSourceKind]()
View Source
var NetworkProtocols = dagql.NewEnum[NetworkProtocol]()
View Source
var SeenCacheKeys = new(sync.Map)
View Source
var TypeDefKinds = dagql.NewEnum[TypeDefKind]()

Functions

func AddEnv added in v0.6.0

func AddEnv(env []string, name, value string) []string

AddEnv adds or updates an environment variable in 'env'.

func GetLocalSecretAccessor added in v0.10.0

func GetLocalSecretAccessor(ctx context.Context, parent *Query, name string) (string, error)

func LoadBlob added in v0.9.7

func LoadBlob(ctx context.Context, srv *dagql.Server, desc specs.Descriptor) (i dagql.Instance[*Directory], err error)

func LookupEnv added in v0.6.0

func LookupEnv(env []string, name string) (string, bool)

LookupEnv returns the value of an environment variable.

func NewSecretAccessor added in v0.10.0

func NewSecretAccessor(name string, scope string) string

func Tracer added in v0.11.0

func Tracer() trace.Tracer

func WalkEnv added in v0.6.0

func WalkEnv(env []string, fn func(string, string, string))

WalkEnv iterates over all environment variables with parsed key and value, and original string.

Types

type AliasSet added in v0.3.13

type AliasSet []string

func (AliasSet) String added in v0.3.13

func (set AliasSet) String() string

func (AliasSet) Union added in v0.8.5

func (set AliasSet) Union(other AliasSet) AliasSet

func (AliasSet) With added in v0.3.13

func (set AliasSet) With(alias string) AliasSet

type BuildArg added in v0.3.8

type BuildArg struct {
	Name  string `field:"true" doc:"The build argument name."`
	Value string `field:"true" doc:"The build argument value."`
}

func (BuildArg) TypeDescription added in v0.9.7

func (BuildArg) TypeDescription() string

func (BuildArg) TypeName added in v0.9.7

func (BuildArg) TypeName() string

type CacheSharingMode added in v0.3.12

type CacheSharingMode string

func (CacheSharingMode) Decoder added in v0.9.7

func (mode CacheSharingMode) Decoder() dagql.InputDecoder

func (CacheSharingMode) MarshalJSON added in v0.9.0

func (mode CacheSharingMode) MarshalJSON() ([]byte, error)

CacheSharingMode marshals to its lowercased value.

NB: as far as I can recall this is purely for ~*aesthetic*~. GraphQL consts are so shouty!

func (CacheSharingMode) ToLiteral added in v0.9.7

func (mode CacheSharingMode) ToLiteral() call.Literal

func (CacheSharingMode) Type added in v0.9.7

func (mode CacheSharingMode) Type() *ast.Type

func (CacheSharingMode) TypeDescription added in v0.9.7

func (mode CacheSharingMode) TypeDescription() string

func (*CacheSharingMode) UnmarshalJSON added in v0.9.0

func (mode *CacheSharingMode) UnmarshalJSON(payload []byte) error

CacheSharingMode marshals to its lowercased value.

NB: as far as I can recall this is purely for ~*aesthetic*~. GraphQL consts are so shouty!

type CacheVolume

type CacheVolume struct {
	Keys []string `json:"keys"`
}

CacheVolume is a persistent volume with a globally scoped identifier.

func NewCache

func NewCache(keys ...string) *CacheVolume

func (*CacheVolume) Clone added in v0.5.1

func (cache *CacheVolume) Clone() *CacheVolume

func (*CacheVolume) Sum added in v0.5.1

func (cache *CacheVolume) Sum() string

Sum returns a checksum of the cache tokens suitable for use as a cache key.

func (*CacheVolume) Type added in v0.9.7

func (*CacheVolume) Type() *ast.Type

func (*CacheVolume) TypeDescription added in v0.9.7

func (*CacheVolume) TypeDescription() string

type CacheVolumeID added in v0.9.0

type CacheVolumeID = dagql.ID[*CacheVolume]

type CallInput added in v0.8.8

type CallInput struct {
	Name  string
	Value dagql.Typed
}

type CallOpts added in v0.9.7

type CallOpts struct {
	Inputs         []CallInput
	ParentVal      map[string]any
	Cache          bool
	Pipeline       pipeline.Path
	SkipSelfSchema bool
}

type Callable added in v0.9.7

type Callable interface {
	Call(context.Context, *call.ID, *CallOpts) (dagql.Typed, error)
	ReturnType() (ModType, error)
	ArgType(argName string) (ModType, error)
}

type CallableField added in v0.9.7

type CallableField struct {
	Module *Module
	Field  *FieldTypeDef
	Return ModType
}

func (*CallableField) ArgType added in v0.9.7

func (f *CallableField) ArgType(argName string) (ModType, error)

func (*CallableField) Call added in v0.9.7

func (f *CallableField) Call(ctx context.Context, id *call.ID, opts *CallOpts) (dagql.Typed, error)

func (*CallableField) ReturnType added in v0.9.7

func (f *CallableField) ReturnType() (ModType, error)

type ClientCallContext added in v0.9.7

type ClientCallContext struct {
	Root *Query

	// the DAG of modules being served to this client
	Deps *ModDeps

	// If the client is itself from a function call in a user module, these are set with the
	// metadata of that ongoing function call
	Module *Module
	FnCall *FunctionCall
}

type Container

type Container struct {
	Query *Query

	// The container's root filesystem.
	FS *pb.Definition `json:"fs"`

	// Image configuration (env, workdir, etc)
	Config specs.ImageConfig `json:"cfg"`

	// List of GPU devices that will be exposed to the container
	EnabledGPUs []string `json:"enabledGPUs,omitempty"`

	// Mount points configured for the container.
	Mounts ContainerMounts `json:"mounts,omitempty"`

	// Meta is the /dagger filesystem. It will be null if nothing has run yet.
	Meta *pb.Definition `json:"meta,omitempty"`

	// The platform of the container's rootfs.
	Platform Platform `json:"platform,omitempty"`

	// Secrets to expose to the container.
	Secrets []ContainerSecret `json:"secret_env,omitempty"`

	// Sockets to expose to the container.
	Sockets []ContainerSocket `json:"sockets,omitempty"`

	// Image reference
	ImageRef string `json:"image_ref,omitempty"`

	// Ports to expose from the container.
	Ports []Port `json:"ports,omitempty"`

	// Services to start before running the container.
	Services ServiceBindings `json:"services,omitempty"`

	// Focused indicates whether subsequent operations will be
	// focused, i.e. shown more prominently in the UI.
	Focused bool `json:"focused"`

	// The args to invoke when using the terminal api on this container.
	DefaultTerminalCmd DefaultTerminalCmdOpts `json:"defaultTerminalCmd,omitempty"`
}

Container is a content-addressed container.

func NewContainer added in v0.3.3

func NewContainer(root *Query, platform Platform) (*Container, error)

func (*Container) AsTarball added in v0.9.0

func (container *Container) AsTarball(
	ctx context.Context,
	platformVariants []*Container,
	forcedCompression ImageLayerCompression,
	mediaTypes ImageMediaTypes,
) (*File, error)

func (*Container) Build

func (container *Container) Build(
	ctx context.Context,
	contextDir *Directory,
	dockerfile string,
	buildArgs []BuildArg,
	target string,
	secrets []*Secret,
) (*Container, error)

func (*Container) Clone added in v0.5.1

func (container *Container) Clone() *Container

Clone returns a deep copy of the container suitable for modifying in a WithXXX method.

func (*Container) Directory

func (container *Container) Directory(ctx context.Context, dirPath string) (*Directory, error)

func (Container) Evaluate added in v0.3.13

func (container Container) Evaluate(ctx context.Context) (*buildkit.Result, error)

func (*Container) Export added in v0.3.3

func (container *Container) Export(
	ctx context.Context,
	dest string,
	platformVariants []*Container,
	forcedCompression ImageLayerCompression,
	mediaTypes ImageMediaTypes,
) error

func (*Container) FSState added in v0.5.1

func (container *Container) FSState() (llb.State, error)

FSState returns the container's root filesystem mount state. If there is none (as with an empty container ID), it returns scratch.

func (*Container) File

func (container *Container) File(ctx context.Context, filePath string) (*File, error)

func (*Container) From

func (container *Container) From(ctx context.Context, addr string) (*Container, error)

func (*Container) ImageConfig

func (container *Container) ImageConfig(ctx context.Context) (specs.ImageConfig, error)

func (*Container) ImageRefOrErr added in v0.5.1

func (container *Container) ImageRefOrErr(ctx context.Context) (string, error)

func (*Container) Import added in v0.5.0

func (container *Container) Import(
	ctx context.Context,
	source *File,
	tag string,
) (*Container, error)

func (*Container) MetaFileContents added in v0.3.5

func (container *Container) MetaFileContents(ctx context.Context, filePath string) (string, error)

func (*Container) MetaState added in v0.5.1

func (container *Container) MetaState() (*llb.State, error)

MetaState returns the container's metadata mount state. If the container has yet to run, it returns nil.

func (*Container) MountTargets added in v0.5.1

func (container *Container) MountTargets(ctx context.Context) ([]string, error)

func (*Container) PBDefinitions added in v0.8.8

func (container *Container) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*Container) PipelinePath added in v0.5.2

func (container *Container) PipelinePath() pipeline.Path

PipelinePath returns the container's pipeline path.

func (*Container) Publish

func (container *Container) Publish(
	ctx context.Context,
	ref string,
	platformVariants []*Container,
	forcedCompression ImageLayerCompression,
	mediaTypes ImageMediaTypes,
) (string, error)

func (*Container) RootFS added in v0.3.5

func (container *Container) RootFS(ctx context.Context) (*Directory, error)

func (*Container) Service added in v0.8.5

func (container *Container) Service(ctx context.Context) (*Service, error)

func (*Container) Terminal added in v0.9.8

func (container *Container) Terminal(svcID *call.ID, args *TerminalArgs) (*Terminal, http.Handler, error)

func (*Container) Type added in v0.9.7

func (*Container) Type() *ast.Type

func (*Container) TypeDescription added in v0.9.7

func (*Container) TypeDescription() string

func (*Container) UpdateImageConfig

func (container *Container) UpdateImageConfig(ctx context.Context, updateFn func(specs.ImageConfig) specs.ImageConfig) (*Container, error)

func (*Container) WithDirectory added in v0.3.7

func (container *Container) WithDirectory(ctx context.Context, subdir string, src *Directory, filter CopyFilter, owner string) (*Container, error)

func (*Container) WithExec added in v0.3.13

func (container *Container) WithExec(ctx context.Context, opts ContainerExecOpts) (*Container, error)

func (*Container) WithExposedPort added in v0.3.13

func (container *Container) WithExposedPort(port Port) (*Container, error)

func (*Container) WithFile added in v0.3.7

func (container *Container) WithFile(ctx context.Context, destPath string, src *File, permissions *int, owner string) (*Container, error)

func (*Container) WithFiles added in v0.9.10

func (container *Container) WithFiles(ctx context.Context, destDir string, src []*File, permissions *int, owner string) (*Container, error)

func (*Container) WithGPU added in v0.9.2

func (container *Container) WithGPU(ctx context.Context, gpuOpts ContainerGPUOpts) (*Container, error)

func (*Container) WithMountedCache

func (container *Container) WithMountedCache(ctx context.Context, target string, cache *CacheVolume, source *Directory, sharingMode CacheSharingMode, owner string) (*Container, error)

func (*Container) WithMountedDirectory

func (container *Container) WithMountedDirectory(ctx context.Context, target string, dir *Directory, owner string, readonly bool) (*Container, error)

func (*Container) WithMountedFile

func (container *Container) WithMountedFile(ctx context.Context, target string, file *File, owner string, readonly bool) (*Container, error)

func (*Container) WithMountedSecret

func (container *Container) WithMountedSecret(ctx context.Context, target string, source *Secret, owner string, mode fs.FileMode) (*Container, error)

func (*Container) WithMountedTemp

func (container *Container) WithMountedTemp(ctx context.Context, target string) (*Container, error)

func (*Container) WithNewFile added in v0.3.7

func (container *Container) WithNewFile(ctx context.Context, dest string, content []byte, permissions fs.FileMode, owner string) (*Container, error)

func (*Container) WithPipeline added in v0.5.1

func (container *Container) WithPipeline(ctx context.Context, name, description string) (*Container, error)

func (*Container) WithRootFS added in v0.3.5

func (container *Container) WithRootFS(ctx context.Context, dir *Directory) (*Container, error)

func (*Container) WithSecretVariable

func (container *Container) WithSecretVariable(ctx context.Context, name string, secret *Secret) (*Container, error)

func (*Container) WithServiceBinding added in v0.5.0

func (container *Container) WithServiceBinding(ctx context.Context, id *call.ID, svc *Service, alias string) (*Container, error)

func (*Container) WithUnixSocket added in v0.3.7

func (container *Container) WithUnixSocket(ctx context.Context, target string, source *Socket, owner string) (*Container, error)

func (*Container) WithoutExposedPort added in v0.3.13

func (container *Container) WithoutExposedPort(port int, protocol NetworkProtocol) (*Container, error)

func (*Container) WithoutMount

func (container *Container) WithoutMount(ctx context.Context, target string) (*Container, error)

func (*Container) WithoutUnixSocket added in v0.3.7

func (container *Container) WithoutUnixSocket(ctx context.Context, target string) (*Container, error)

type ContainerExecOpts

type ContainerExecOpts struct {
	// Command to run instead of the container's default command
	Args []string

	// If the container has an entrypoint, ignore it for this exec rather than
	// calling it with args.
	SkipEntrypoint bool `default:"false"`

	// Content to write to the command's standard input before closing
	Stdin string `default:""`

	// Redirect the command's standard output to a file in the container
	RedirectStdout string `default:""`

	// Redirect the command's standard error to a file in the container
	RedirectStderr string `default:""`

	// Provide dagger access to the executed command
	// Do not use this option unless you trust the command being executed.
	// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM
	ExperimentalPrivilegedNesting bool `default:"false"`

	// Grant the process all root capabilities
	InsecureRootCapabilities bool `default:"false"`

	// (Internal-only) If this exec is for a module function, this digest will be set in the
	// grpc context metadata for any api requests back to the engine. It's used by the API
	// server to determine which schema to serve and other module context metadata.
	ModuleCallerDigest digest.Digest `name:"-"`

	// (Internal-only) Used for module function execs to trigger the nested api client to
	// be connected back to the same session.
	NestedInSameSession bool `name:"-"`
}

type ContainerGPUOpts added in v0.9.2

type ContainerGPUOpts struct {
	Devices []string
}

type ContainerID

type ContainerID = dagql.ID[*Container]

type ContainerMount

type ContainerMount struct {
	// The source of the mount.
	Source *pb.Definition `json:"source,omitempty"`

	// A path beneath the source to scope the mount to.
	SourcePath string `json:"source_path,omitempty"`

	// The path of the mount within the container.
	Target string `json:"target"`

	// Persist changes to the mount under this cache ID.
	CacheVolumeID string `json:"cache_volume_id,omitempty"`

	// How to share the cache across concurrent runs.
	CacheSharingMode CacheSharingMode `json:"cache_sharing,omitempty"`

	// Configure the mount as a tmpfs.
	Tmpfs bool `json:"tmpfs,omitempty"`

	// Configure the mount as read-only.
	Readonly bool `json:"readonly,omitempty"`
}

ContainerMount is a mount point configured in a container.

func (ContainerMount) SourceState

func (mnt ContainerMount) SourceState() (llb.State, error)

SourceState returns the state of the source of the mount.

type ContainerMounts added in v0.3.3

type ContainerMounts []ContainerMount

func (ContainerMounts) With added in v0.3.3

type ContainerSecret

type ContainerSecret struct {
	Secret    *Secret     `json:"secret"`
	EnvName   string      `json:"env,omitempty"`
	MountPath string      `json:"path,omitempty"`
	Owner     *Ownership  `json:"owner,omitempty"`
	Mode      fs.FileMode `json:"mode,omitempty"`
}

ContainerSecret configures a secret to expose, either as an environment variable or mounted to a file path.

type ContainerSocket added in v0.3.7

type ContainerSocket struct {
	Source        *Socket    `json:"socket"`
	ContainerPath string     `json:"container_path,omitempty"`
	Owner         *Ownership `json:"owner,omitempty"`
}

ContainerSocket configures a socket to expose, currently as a Unix socket, but potentially as a TCP or UDP address in the future.

type CopyFilter added in v0.3.3

type CopyFilter struct {
	Exclude []string `default:"[]"`
	Include []string `default:"[]"`
}

type CurrentModule added in v0.9.8

type CurrentModule struct {
	Module *Module
}

func (CurrentModule) Clone added in v0.9.8

func (mod CurrentModule) Clone() *CurrentModule

func (*CurrentModule) Type added in v0.9.8

func (*CurrentModule) Type() *ast.Type

func (*CurrentModule) TypeDescription added in v0.9.8

func (*CurrentModule) TypeDescription() string

type DefaultTerminalCmdOpts added in v0.10.1

type DefaultTerminalCmdOpts struct {
	Args []string

	// Provide dagger access to the executed command
	// Do not use this option unless you trust the command being executed.
	// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM
	ExperimentalPrivilegedNesting bool `default:"false"`

	// Grant the process all root capabilities
	InsecureRootCapabilities bool `default:"false"`
}

type Directory

type Directory struct {
	Query *Query

	LLB      *pb.Definition
	Dir      string
	Platform Platform

	// Services necessary to provision the directory.
	Services ServiceBindings
}

Directory is a content-addressed directory.

func NewDirectory

func NewDirectory(query *Query, def *pb.Definition, dir string, platform Platform, services ServiceBindings) *Directory

func NewDirectorySt added in v0.5.2

func NewDirectorySt(ctx context.Context, query *Query, st llb.State, dir string, platform Platform, services ServiceBindings) (*Directory, error)

func NewScratchDirectory added in v0.6.3

func NewScratchDirectory(query *Query, platform Platform) *Directory

func (*Directory) AsBlob added in v0.9.8

func (dir *Directory) AsBlob(
	ctx context.Context,
	srv *dagql.Server,
) (inst dagql.Instance[*Directory], rerr error)

AsBlob converts this directory into a stable content addressed blob, valid for the duration of the current session. Currently only used internally to support local module sources.

func (*Directory) Clone added in v0.5.1

func (dir *Directory) Clone() *Directory

Clone returns a deep copy of the container suitable for modifying in a WithXXX method.

func (*Directory) Diff

func (dir *Directory) Diff(ctx context.Context, other *Directory) (*Directory, error)

func (*Directory) Directory

func (dir *Directory) Directory(ctx context.Context, subdir string) (*Directory, error)

func (*Directory) Entries

func (dir *Directory) Entries(ctx context.Context, src string) ([]string, error)

func (*Directory) Evaluate added in v0.6.4

func (dir *Directory) Evaluate(ctx context.Context) (*buildkit.Result, error)

func (*Directory) Export added in v0.3.3

func (dir *Directory) Export(ctx context.Context, destPath string, merge bool) (rerr error)

func (*Directory) File

func (dir *Directory) File(ctx context.Context, file string) (*File, error)

func (*Directory) Glob added in v0.9.1

func (dir *Directory) Glob(ctx context.Context, src string, pattern string) ([]string, error)

Glob returns a list of files that matches the given pattern.

Note(TomChv): Instead of handling the recursive manually, we could update cacheutil.ReadDir so it will only mount and unmount the filesystem one time. However, this requires to maintain buildkit code and is not mandatory for now until we hit performances issues.

func (*Directory) PBDefinitions added in v0.8.8

func (dir *Directory) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*Directory) PipelinePath added in v0.5.2

func (dir *Directory) PipelinePath() pipeline.Path

func (*Directory) Root added in v0.5.1

func (dir *Directory) Root() (*Directory, error)

Root removes any relative path from the directory.

func (*Directory) SetState added in v0.5.1

func (dir *Directory) SetState(ctx context.Context, st llb.State) error

func (*Directory) Stat

func (dir *Directory) Stat(ctx context.Context, bk *buildkit.Client, svcs *Services, src string) (*fstypes.Stat, error)

func (*Directory) State added in v0.5.1

func (dir *Directory) State() (llb.State, error)

func (*Directory) StateWithSourcePath added in v0.5.1

func (dir *Directory) StateWithSourcePath() (llb.State, error)

func (*Directory) Type added in v0.9.7

func (*Directory) Type() *ast.Type

func (*Directory) TypeDescription added in v0.9.7

func (*Directory) TypeDescription() string

func (*Directory) WithDirectory

func (dir *Directory) WithDirectory(ctx context.Context, destDir string, src *Directory, filter CopyFilter, owner *Ownership) (*Directory, error)

func (*Directory) WithFile added in v0.3.3

func (dir *Directory) WithFile(
	ctx context.Context,
	destPath string,
	src *File,
	permissions *int,
	owner *Ownership,
) (*Directory, error)

func (*Directory) WithFiles added in v0.9.10

func (dir *Directory) WithFiles(
	ctx context.Context,
	destDir string,
	src []*File,
	permissions *int,
	owner *Ownership,
) (*Directory, error)

TODO: address https://github.com/dagger/dagger/pull/6556/files#r1482830091

func (*Directory) WithNewDirectory added in v0.3.3

func (dir *Directory) WithNewDirectory(ctx context.Context, dest string, permissions fs.FileMode) (*Directory, error)

func (*Directory) WithNewFile

func (dir *Directory) WithNewFile(ctx context.Context, dest string, content []byte, permissions fs.FileMode, ownership *Ownership) (*Directory, error)

func (*Directory) WithPipeline added in v0.5.1

func (dir *Directory) WithPipeline(ctx context.Context, name, description string) (*Directory, error)

func (*Directory) WithTimestamps added in v0.3.8

func (dir *Directory) WithTimestamps(ctx context.Context, unix int) (*Directory, error)

func (*Directory) Without

func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error)

type DirectoryID

type DirectoryID = dagql.ID[*Directory]

type DynamicID added in v0.9.7

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

func (DynamicID) DecodeInput added in v0.9.7

func (d DynamicID) DecodeInput(val any) (dagql.Input, error)

func (DynamicID) Decoder added in v0.9.7

func (d DynamicID) Decoder() dagql.InputDecoder

func (DynamicID) ID added in v0.9.7

func (d DynamicID) ID() *call.ID

ID returns the ID of the value.

func (DynamicID) MarshalJSON added in v0.9.7

func (d DynamicID) MarshalJSON() ([]byte, error)

func (DynamicID) ToLiteral added in v0.9.7

func (d DynamicID) ToLiteral() call.Literal

func (DynamicID) Type added in v0.9.7

func (d DynamicID) Type() *ast.Type

func (DynamicID) TypeName added in v0.9.7

func (d DynamicID) TypeName() string

type FieldTypeDef added in v0.8.8

type FieldTypeDef struct {
	Name        string   `field:"true" doc:"The name of the field in lowerCamelCase format."`
	Description string   `field:"true" doc:"A doc string for the field, if any."`
	TypeDef     *TypeDef `field:"true" doc:"The type of the field."`

	// The original name of the object as provided by the SDK that defined it, used
	// when invoking the SDK so it doesn't need to think as hard about case conversions
	OriginalName string
}

func (FieldTypeDef) Clone added in v0.8.8

func (typeDef FieldTypeDef) Clone() *FieldTypeDef

func (*FieldTypeDef) Type added in v0.9.7

func (*FieldTypeDef) Type() *ast.Type

func (*FieldTypeDef) TypeDescription added in v0.9.7

func (*FieldTypeDef) TypeDescription() string

type File

type File struct {
	Query *Query

	LLB      *pb.Definition `json:"llb"`
	File     string         `json:"file"`
	Platform Platform       `json:"platform"`

	// Services necessary to provision the file.
	Services ServiceBindings `json:"services,omitempty"`
}

File is a content-addressed file.

func NewFile

func NewFile(query *Query, def *pb.Definition, file string, platform Platform, services ServiceBindings) *File

func NewFileSt added in v0.5.2

func NewFileSt(ctx context.Context, query *Query, st llb.State, dir string, platform Platform, services ServiceBindings) (*File, error)

func NewFileWithContents added in v0.9.2

func NewFileWithContents(
	ctx context.Context,
	query *Query,
	name string,
	content []byte,
	permissions fs.FileMode,
	ownership *Ownership,
	platform Platform,
) (*File, error)

func (*File) Clone added in v0.5.1

func (file *File) Clone() *File

Clone returns a deep copy of the container suitable for modifying in a WithXXX method.

func (*File) Contents

func (file *File) Contents(ctx context.Context) ([]byte, error)

Contents handles file content retrieval

func (*File) Evaluate added in v0.6.4

func (file *File) Evaluate(ctx context.Context) (*buildkit.Result, error)

func (*File) Export added in v0.3.3

func (file *File) Export(ctx context.Context, dest string, allowParentDirPath bool) (rerr error)

func (*File) Open added in v0.5.0

func (file *File) Open(ctx context.Context) (io.ReadCloser, error)

func (*File) PBDefinitions added in v0.8.8

func (file *File) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*File) PipelinePath added in v0.5.2

func (file *File) PipelinePath() pipeline.Path

func (*File) Stat

func (file *File) Stat(ctx context.Context) (*fstypes.Stat, error)

func (*File) State added in v0.5.1

func (file *File) State() (llb.State, error)

func (*File) Type added in v0.9.7

func (*File) Type() *ast.Type

func (*File) TypeDescription added in v0.9.7

func (*File) TypeDescription() string

func (*File) WithTimestamps added in v0.3.8

func (file *File) WithTimestamps(ctx context.Context, unix int) (*File, error)

type FileID

type FileID = dagql.ID[*File]

type Function added in v0.8.8

type Function struct {
	// Name is the standardized name of the function (lowerCamelCase), as used for the resolver in the graphql schema
	Name        string         `field:"true" doc:"The name of the function."`
	Description string         `field:"true" doc:"A doc string for the function, if any."`
	Args        []*FunctionArg `field:"true" doc:"Arguments accepted by the function, if any."`
	ReturnType  *TypeDef       `field:"true" doc:"The type returned by the function."`

	// OriginalName of the parent object
	ParentOriginalName string

	// The original name of the function as provided by the SDK that defined it, used
	// when invoking the SDK so it doesn't need to think as hard about case conversions
	OriginalName string
}

func NewFunction added in v0.8.8

func NewFunction(name string, returnType *TypeDef) *Function

func (Function) Clone added in v0.8.8

func (fn Function) Clone() *Function

func (*Function) FieldSpec added in v0.9.7

func (fn *Function) FieldSpec() (dagql.FieldSpec, error)

func (*Function) IsSubtypeOf added in v0.9.6

func (fn *Function) IsSubtypeOf(otherFn *Function) bool

func (*Function) LookupArg added in v0.9.7

func (fn *Function) LookupArg(name string) (*FunctionArg, bool)

func (*Function) Type added in v0.9.7

func (*Function) Type() *ast.Type

func (*Function) TypeDescription added in v0.9.7

func (*Function) TypeDescription() string

func (*Function) WithArg added in v0.8.8

func (fn *Function) WithArg(name string, typeDef *TypeDef, desc string, defaultValue JSON) *Function

func (*Function) WithDescription added in v0.8.8

func (fn *Function) WithDescription(desc string) *Function

type FunctionArg added in v0.8.8

type FunctionArg struct {
	// Name is the standardized name of the argument (lowerCamelCase), as used for the resolver in the graphql schema
	Name         string   `field:"true" doc:"The name of the argument in lowerCamelCase format."`
	Description  string   `field:"true" doc:"A doc string for the argument, if any."`
	TypeDef      *TypeDef `field:"true" doc:"The type of the argument."`
	DefaultValue JSON     `field:"true" doc:"A default value to use for this argument when not explicitly set by the caller, if any."`

	// The original name of the argument as provided by the SDK that defined it.
	OriginalName string
}

func (FunctionArg) Clone added in v0.8.8

func (arg FunctionArg) Clone() *FunctionArg

func (*FunctionArg) Type added in v0.9.7

func (*FunctionArg) Type() *ast.Type

Type returns the GraphQL FunctionArg! type.

func (*FunctionArg) TypeDescription added in v0.9.7

func (*FunctionArg) TypeDescription() string

type FunctionArgID added in v0.9.4

type FunctionArgID = dagql.ID[*FunctionArg]

type FunctionCall added in v0.8.8

type FunctionCall struct {
	Query *Query

	Name       string                  `field:"true" doc:"The name of the function being called."`
	ParentName string                  `` /* 154-byte string literal not displayed */
	Parent     JSON                    `` /* 155-byte string literal not displayed */
	InputArgs  []*FunctionCallArgValue `field:"true" doc:"The argument values the function is being invoked with."`
}

func (*FunctionCall) ReturnValue added in v0.9.7

func (fnCall *FunctionCall) ReturnValue(ctx context.Context, val JSON) error

func (*FunctionCall) Type added in v0.9.7

func (*FunctionCall) Type() *ast.Type

func (*FunctionCall) TypeDescription added in v0.9.7

func (*FunctionCall) TypeDescription() string

type FunctionCallArgValue added in v0.9.7

type FunctionCallArgValue struct {
	Name  string `field:"true" doc:"The name of the argument."`
	Value JSON   `field:"true" doc:"The value of the argument represented as a JSON serialized string."`
}

func (*FunctionCallArgValue) Type added in v0.9.7

func (*FunctionCallArgValue) Type() *ast.Type

func (*FunctionCallArgValue) TypeDescription added in v0.9.7

func (*FunctionCallArgValue) TypeDescription() string

type FunctionID added in v0.8.8

type FunctionID = dagql.ID[*Function]

type GeneratedCode added in v0.8.8

type GeneratedCode struct {
	Code              dagql.Instance[*Directory] `field:"true" doc:"The directory containing the generated code."`
	VCSGeneratedPaths []string                   `field:"true" name:"vcsGeneratedPaths" doc:"List of paths to mark generated in version control (i.e. .gitattributes)."`
	VCSIgnoredPaths   []string                   `field:"true" name:"vcsIgnoredPaths" doc:"List of paths to ignore in version control (i.e. .gitignore)."`
}

func NewGeneratedCode added in v0.9.0

func NewGeneratedCode(code dagql.Instance[*Directory]) *GeneratedCode

func (GeneratedCode) Clone added in v0.8.8

func (code GeneratedCode) Clone() *GeneratedCode

func (*GeneratedCode) PBDefinitions added in v0.9.7

func (code *GeneratedCode) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*GeneratedCode) Type added in v0.9.7

func (*GeneratedCode) Type() *ast.Type

func (*GeneratedCode) TypeDescription added in v0.9.7

func (*GeneratedCode) TypeDescription() string

func (*GeneratedCode) WithVCSGeneratedPaths added in v0.8.8

func (code *GeneratedCode) WithVCSGeneratedPaths(paths []string) *GeneratedCode

func (*GeneratedCode) WithVCSIgnoredPaths added in v0.8.8

func (code *GeneratedCode) WithVCSIgnoredPaths(paths []string) *GeneratedCode

type GeneratedCodeID added in v0.8.8

type GeneratedCodeID = dagql.ID[*GeneratedCode]

type GitModuleSource added in v0.9.8

type GitModuleSource struct {
	Version string `field:"true" doc:"The specified version of the git repo this source points to."`

	Commit string `field:"true" doc:"The resolved commit of the git repo this source points to."`

	URLParent string

	RootSubpath string `` /* 200-byte string literal not displayed */

	ContextDirectory dagql.Instance[*Directory] `field:"true" doc:"The directory containing everything needed to load load and use the module."`
}

func (GitModuleSource) Clone added in v0.9.8

func (src GitModuleSource) Clone() *GitModuleSource

func (*GitModuleSource) CloneURL added in v0.9.8

func (src *GitModuleSource) CloneURL() string

func (*GitModuleSource) HTMLURL added in v0.9.8

func (src *GitModuleSource) HTMLURL() string

func (*GitModuleSource) PBDefinitions added in v0.9.9

func (src *GitModuleSource) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*GitModuleSource) RefString added in v0.9.9

func (src *GitModuleSource) RefString() string

func (*GitModuleSource) Symbolic added in v0.9.8

func (src *GitModuleSource) Symbolic() string

func (*GitModuleSource) Type added in v0.9.8

func (src *GitModuleSource) Type() *ast.Type

func (*GitModuleSource) TypeDescription added in v0.9.8

func (src *GitModuleSource) TypeDescription() string

type GitModuleSourceID added in v0.9.8

type GitModuleSourceID = dagql.ID[*GitModuleSource]

type GitRef added in v0.9.1

type GitRef struct {
	Query *Query

	Ref  string         `json:"ref"`
	Repo *GitRepository `json:"repository"`
}

func (*GitRef) Commit added in v0.9.1

func (ref *GitRef) Commit(ctx context.Context) (string, error)

func (*GitRef) Tree added in v0.9.1

func (ref *GitRef) Tree(ctx context.Context) (*Directory, error)

func (*GitRef) Type added in v0.9.7

func (*GitRef) Type() *ast.Type

func (*GitRef) TypeDescription added in v0.9.7

func (*GitRef) TypeDescription() string

type GitRefID added in v0.9.4

type GitRefID = dagql.ID[*GitRef]

type GitRepository added in v0.9.4

type GitRepository struct {
	Query *Query

	URL string `json:"url"`

	KeepGitDir bool `json:"keepGitDir"`

	SSHKnownHosts string  `json:"sshKnownHosts"`
	SSHAuthSocket *Socket `json:"sshAuthSocket"`

	Services ServiceBindings `json:"services"`
	Platform Platform        `json:"platform,omitempty"`

	AuthToken  *Secret `json:"authToken"`
	AuthHeader *Secret `json:"authHeader"`
}

func (*GitRepository) Type added in v0.9.7

func (*GitRepository) Type() *ast.Type

func (*GitRepository) TypeDescription added in v0.9.7

func (*GitRepository) TypeDescription() string

type GitRepositoryID added in v0.9.4

type GitRepositoryID = dagql.ID[*GitRepository]

type HasPBDefinitions added in v0.8.8

type HasPBDefinitions interface {
	PBDefinitions(context.Context) ([]*pb.Definition, error)
}

type Host added in v0.3.3

type Host struct {
	Query *Query
}

func (*Host) Directory added in v0.3.3

func (host *Host) Directory(
	ctx context.Context,
	srv *dagql.Server,
	dirPath string,
	pipelineNamePrefix string,
	filter CopyFilter,
) (dagql.Instance[*Directory], error)

func (*Host) File added in v0.6.2

func (host *Host) File(ctx context.Context, srv *dagql.Server, filePath string) (dagql.Instance[*File], error)

func (*Host) SetSecretFile added in v0.9.7

func (host *Host) SetSecretFile(ctx context.Context, srv *dagql.Server, secretName string, path string) (i dagql.Instance[*Secret], err error)

func (*Host) Socket added in v0.3.7

func (host *Host) Socket(sockPath string) *Socket

func (*Host) Type added in v0.9.7

func (*Host) Type() *ast.Type

func (*Host) TypeDescription added in v0.9.7

func (*Host) TypeDescription() string

type ImageLayerCompression added in v0.5.3

type ImageLayerCompression string

func (ImageLayerCompression) Decoder added in v0.9.7

func (proto ImageLayerCompression) Decoder() dagql.InputDecoder

func (ImageLayerCompression) ToLiteral added in v0.9.7

func (proto ImageLayerCompression) ToLiteral() call.Literal

func (ImageLayerCompression) Type added in v0.9.7

func (proto ImageLayerCompression) Type() *ast.Type

func (ImageLayerCompression) TypeDescription added in v0.9.7

func (proto ImageLayerCompression) TypeDescription() string

type ImageMediaTypes added in v0.6.4

type ImageMediaTypes string

func (ImageMediaTypes) Decoder added in v0.9.7

func (proto ImageMediaTypes) Decoder() dagql.InputDecoder

func (ImageMediaTypes) ToLiteral added in v0.9.7

func (proto ImageMediaTypes) ToLiteral() call.Literal

func (ImageMediaTypes) Type added in v0.9.7

func (proto ImageMediaTypes) Type() *ast.Type

func (ImageMediaTypes) TypeDescription added in v0.9.7

func (proto ImageMediaTypes) TypeDescription() string

type InputTypeDef added in v0.9.8

type InputTypeDef struct {
	Name   string          `field:"true" doc:"The name of the input object."`
	Fields []*FieldTypeDef `field:"true" doc:"Static fields defined on this input object, if any."`
}

func (InputTypeDef) Clone added in v0.9.8

func (typeDef InputTypeDef) Clone() *InputTypeDef

func (*InputTypeDef) ToInputObjectSpec added in v0.9.8

func (typeDef *InputTypeDef) ToInputObjectSpec() dagql.InputObjectSpec

func (*InputTypeDef) Type added in v0.9.8

func (*InputTypeDef) Type() *ast.Type

func (*InputTypeDef) TypeDescription added in v0.9.8

func (*InputTypeDef) TypeDescription() string

type InterfaceAnnotatedValue added in v0.9.7

type InterfaceAnnotatedValue struct {
	TypeDef        *InterfaceTypeDef
	IfaceType      *InterfaceType
	Fields         map[string]any
	UnderlyingType ModType
}

func (*InterfaceAnnotatedValue) PBDefinitions added in v0.9.7

func (iface *InterfaceAnnotatedValue) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*InterfaceAnnotatedValue) Type added in v0.9.7

func (iface *InterfaceAnnotatedValue) Type() *ast.Type

func (*InterfaceAnnotatedValue) TypeDescription added in v0.9.7

func (iface *InterfaceAnnotatedValue) TypeDescription() string

type InterfaceType added in v0.9.7

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

func (*InterfaceType) ConvertFromSDKResult added in v0.9.7

func (iface *InterfaceType) ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

func (*InterfaceType) ConvertToSDKInput added in v0.9.7

func (iface *InterfaceType) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

func (*InterfaceType) Install added in v0.9.7

func (iface *InterfaceType) Install(ctx context.Context, dag *dagql.Server) error

func (*InterfaceType) SourceMod added in v0.9.7

func (iface *InterfaceType) SourceMod() Mod

func (*InterfaceType) TypeDef added in v0.9.7

func (iface *InterfaceType) TypeDef() *TypeDef

type InterfaceTypeDef added in v0.9.6

type InterfaceTypeDef struct {
	// Name is the standardized name of the interface (CamelCase), as used for the interface in the graphql schema
	Name        string      `field:"true" doc:"The name of the interface."`
	Description string      `field:"true" doc:"The doc string for the interface, if any."`
	Functions   []*Function `field:"true" doc:"Functions defined on this interface, if any."`
	// SourceModuleName is currently only set when returning the TypeDef from the Objects field on Module
	SourceModuleName string `field:"true" doc:"If this InterfaceTypeDef is associated with a Module, the name of the module. Unset otherwise."`

	// The original name of the interface as provided by the SDK that defined it, used
	// when invoking the SDK so it doesn't need to think as hard about case conversions
	OriginalName string
}

func NewInterfaceTypeDef added in v0.9.6

func NewInterfaceTypeDef(name, description string) *InterfaceTypeDef

func (InterfaceTypeDef) Clone added in v0.9.6

func (iface InterfaceTypeDef) Clone() *InterfaceTypeDef

func (*InterfaceTypeDef) IsSubtypeOf added in v0.9.6

func (iface *InterfaceTypeDef) IsSubtypeOf(otherIface *InterfaceTypeDef) bool

func (*InterfaceTypeDef) Type added in v0.9.7

func (*InterfaceTypeDef) Type() *ast.Type

func (*InterfaceTypeDef) TypeDescription added in v0.9.7

func (*InterfaceTypeDef) TypeDescription() string

type JSON added in v0.9.7

type JSON json.RawMessage

func (JSON) Bytes added in v0.9.7

func (p JSON) Bytes() []byte

func (JSON) DecodeInput added in v0.9.7

func (JSON) DecodeInput(val any) (res dagql.Input, err error)

func (JSON) Decoder added in v0.9.7

func (p JSON) Decoder() dagql.InputDecoder

func (JSON) MarshalJSON added in v0.9.7

func (p JSON) MarshalJSON() ([]byte, error)

func (JSON) ToLiteral added in v0.9.7

func (p JSON) ToLiteral() call.Literal

func (JSON) Type added in v0.9.7

func (p JSON) Type() *ast.Type

func (JSON) TypeDescription added in v0.9.7

func (p JSON) TypeDescription() string

func (JSON) TypeName added in v0.9.7

func (p JSON) TypeName() string

type ListType added in v0.9.7

type ListType struct {
	Elem       *TypeDef
	Underlying ModType
}

func (*ListType) ConvertFromSDKResult added in v0.9.7

func (t *ListType) ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

func (*ListType) ConvertToSDKInput added in v0.9.7

func (t *ListType) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

func (*ListType) SourceMod added in v0.9.7

func (t *ListType) SourceMod() Mod

func (*ListType) TypeDef added in v0.9.7

func (t *ListType) TypeDef() *TypeDef

type ListTypeDef added in v0.8.8

type ListTypeDef struct {
	ElementTypeDef *TypeDef `field:"true" doc:"The type of the elements in the list."`
}

func (ListTypeDef) Clone added in v0.8.8

func (typeDef ListTypeDef) Clone() *ListTypeDef

func (*ListTypeDef) Type added in v0.9.7

func (*ListTypeDef) Type() *ast.Type

func (*ListTypeDef) TypeDescription added in v0.9.7

func (*ListTypeDef) TypeDescription() string

type LocalModuleSource added in v0.9.8

type LocalModuleSource struct {
	RootSubpath string `` /* 200-byte string literal not displayed */

	ContextDirectory dagql.Nullable[dagql.Instance[*Directory]] `field:"true" doc:"The directory containing everything needed to load load and use the module."`
}

func (LocalModuleSource) Clone added in v0.9.8

func (src LocalModuleSource) Clone() *LocalModuleSource

func (*LocalModuleSource) PBDefinitions added in v0.9.9

func (src *LocalModuleSource) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*LocalModuleSource) RefString added in v0.9.9

func (src *LocalModuleSource) RefString() string

func (*LocalModuleSource) Symbolic added in v0.9.8

func (src *LocalModuleSource) Symbolic() string

func (*LocalModuleSource) Type added in v0.9.8

func (src *LocalModuleSource) Type() *ast.Type

func (*LocalModuleSource) TypeDescription added in v0.9.8

func (src *LocalModuleSource) TypeDescription() string

type LocalModuleSourceID added in v0.9.8

type LocalModuleSourceID = dagql.ID[*LocalModuleSource]

type Mod added in v0.9.7

type Mod interface {
	// The name of the module
	Name() string

	// The direct dependencies of this module
	Dependencies() []Mod

	// TODO describe
	Install(context.Context, *dagql.Server) error

	// ModTypeFor returns the ModType for the given typedef based on this module's schema.
	// The returned type will have any namespacing already applied.
	// If checkDirectDeps is true, then its direct dependencies will also be checked.
	ModTypeFor(ctx context.Context, typeDef *TypeDef, checkDirectDeps bool) (ModType, bool, error)

	// All the TypeDefs exposed by this module (does not include dependencies)
	TypeDefs(ctx context.Context) ([]*TypeDef, error)
}

Mod is a module in loaded into the server's DAG of modules; it's the vertex type of the DAG. It's an interface so we can abstract over user modules and core and treat them the same.

type ModDeps added in v0.9.7

type ModDeps struct {
	Mods []Mod // TODO hide
	// contains filtered or unexported fields
}

ModDeps represents a set of dependencies for a module or for a caller depending on a particular set of modules to be served.

func NewModDeps added in v0.9.7

func NewModDeps(root *Query, mods []Mod) *ModDeps

func (*ModDeps) Append added in v0.9.7

func (d *ModDeps) Append(mods ...Mod) *ModDeps

func (*ModDeps) ModTypeFor added in v0.9.7

func (d *ModDeps) ModTypeFor(ctx context.Context, typeDef *TypeDef) (ModType, bool, error)

Search the deps for the given type def, returning the ModType if found. This does not recurse to transitive dependencies; it only returns types directly exposed by the schema of the top-level deps.

func (*ModDeps) Prepend added in v0.9.7

func (d *ModDeps) Prepend(mods ...Mod) *ModDeps

func (*ModDeps) Schema added in v0.9.7

func (d *ModDeps) Schema(ctx context.Context) (*dagql.Server, error)

The combined schema exposed by each mod in this set of dependencies

func (*ModDeps) SchemaIntrospectionJSON added in v0.9.7

func (d *ModDeps) SchemaIntrospectionJSON(ctx context.Context, forModule bool) (string, error)

The introspection json for combined schema exposed by each mod in this set of dependencies

func (*ModDeps) TypeDefs added in v0.9.7

func (d *ModDeps) TypeDefs(ctx context.Context) ([]*TypeDef, error)

All the TypeDefs exposed by this set of dependencies

type ModType added in v0.9.7

type ModType interface {
	// ConvertFromSDKResult converts a value returned from an SDK into values
	// expected by the server, including conversion of IDs to their "unpacked"
	// objects
	ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

	// ConvertToSDKInput converts a value from the server into a value expected
	// by the SDK, which may include converting objects to their IDs
	ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

	// SourceMod is the module in which this type was originally defined
	SourceMod() Mod

	// The core API TypeDef representation of this type
	TypeDef() *TypeDef
}

ModType wraps the core TypeDef type with schema specific concerns like ID conversion and tracking of the module in which the type was originally defined.

type Module added in v0.8.8

type Module struct {
	Query *Query

	// The source of the module
	Source dagql.Instance[*ModuleSource] `field:"true" name:"source" doc:"The source for the module."`

	// The name of the module
	NameField string `field:"true" name:"name" doc:"The name of the module"`

	// The original name of the module set in its configuration file (or first configured via withName).
	// Different than NameField when a different name was specified for the module via a dependency.
	OriginalName string

	// The origin sdk of the module set in its configuration file (or first configured via withSDK).
	OriginalSDK string

	// The doc string of the module, if any
	Description string `field:"true" doc:"The doc string of the module, if any"`

	// The module's SDKConfig, as set in the module config file
	SDKConfig string `` /* 157-byte string literal not displayed */

	GeneratedContextDirectory dagql.Instance[*Directory] `` /* 139-byte string literal not displayed */

	// Dependencies as configured by the module
	DependencyConfig []*ModuleDependency `field:"true" doc:"The dependencies as configured by the module."`

	// The module's loaded dependencies, not yet initialized
	DependenciesField []dagql.Instance[*Module] `field:"true" name:"dependencies" doc:"Modules used by this module."`

	// Deps contains the module's dependency DAG.
	Deps *ModDeps

	// Runtime is the container that runs the module's entrypoint. It will fail to execute if the module doesn't compile.
	Runtime *Container `` /* 137-byte string literal not displayed */

	// The module's objects
	ObjectDefs []*TypeDef `field:"true" name:"objects" doc:"Objects served by this module."`

	// The module's interfaces
	InterfaceDefs []*TypeDef `field:"true" name:"interfaces" doc:"Interfaces served by this module."`

	// InstanceID is the ID of the initialized module.
	InstanceID *call.ID
}

func (Module) Clone added in v0.8.8

func (mod Module) Clone() *Module

func (*Module) Dependencies added in v0.8.8

func (mod *Module) Dependencies() []Mod

func (*Module) DependencySchemaIntrospectionJSON added in v0.9.7

func (mod *Module) DependencySchemaIntrospectionJSON(ctx context.Context, forModule bool) (string, error)

func (*Module) IDModule added in v0.9.9

func (mod *Module) IDModule() *call.Module

func (*Module) Initialize added in v0.9.7

func (mod *Module) Initialize(ctx context.Context, oldSelf dagql.Instance[*Module], newID *call.ID) (*Module, error)

func (*Module) Install added in v0.9.7

func (mod *Module) Install(ctx context.Context, dag *dagql.Server) error

func (*Module) ModTypeFor added in v0.9.7

func (mod *Module) ModTypeFor(ctx context.Context, typeDef *TypeDef, checkDirectDeps bool) (ModType, bool, error)

func (*Module) Name added in v0.8.8

func (mod *Module) Name() string

func (*Module) PBDefinitions added in v0.8.8

func (mod *Module) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*Module) Type added in v0.9.7

func (*Module) Type() *ast.Type

func (*Module) TypeDefs added in v0.9.7

func (mod *Module) TypeDefs(ctx context.Context) ([]*TypeDef, error)

func (*Module) TypeDescription added in v0.9.7

func (*Module) TypeDescription() string

func (*Module) WithDescription added in v0.9.8

func (mod *Module) WithDescription(desc string) *Module

func (*Module) WithInterface added in v0.9.6

func (mod *Module) WithInterface(ctx context.Context, def *TypeDef) (*Module, error)

func (*Module) WithObject added in v0.8.8

func (mod *Module) WithObject(ctx context.Context, def *TypeDef) (*Module, error)

type ModuleDependency added in v0.9.8

type ModuleDependency struct {
	Source dagql.Instance[*ModuleSource] `field:"true" name:"source" doc:"The source for the dependency module."`
	Name   string                        `field:"true" name:"name" doc:"The name of the dependency module."`
}

func (ModuleDependency) Clone added in v0.9.8

func (dep ModuleDependency) Clone() *ModuleDependency

func (*ModuleDependency) Type added in v0.9.8

func (*ModuleDependency) Type() *ast.Type

func (*ModuleDependency) TypeDescription added in v0.9.8

func (*ModuleDependency) TypeDescription() string

type ModuleDependencyID added in v0.9.8

type ModuleDependencyID = dagql.ID[*ModuleDependency]

type ModuleFunction added in v0.9.7

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

func (*ModuleFunction) ArgType added in v0.9.7

func (fn *ModuleFunction) ArgType(argName string) (ModType, error)

func (*ModuleFunction) Call added in v0.9.7

func (fn *ModuleFunction) Call(ctx context.Context, caller *call.ID, opts *CallOpts) (t dagql.Typed, rerr error)

func (*ModuleFunction) ReturnType added in v0.9.7

func (fn *ModuleFunction) ReturnType() (ModType, error)

type ModuleID added in v0.8.8

type ModuleID = dagql.ID[*Module]

type ModuleObject added in v0.9.7

type ModuleObject struct {
	Module  *Module
	TypeDef *ObjectTypeDef
	Fields  map[string]any
}

func (*ModuleObject) Install added in v0.9.7

func (obj *ModuleObject) Install(ctx context.Context, dag *dagql.Server) error

func (*ModuleObject) PBDefinitions added in v0.9.7

func (obj *ModuleObject) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*ModuleObject) Type added in v0.9.7

func (obj *ModuleObject) Type() *ast.Type

func (*ModuleObject) TypeDescription added in v0.9.7

func (obj *ModuleObject) TypeDescription() string

type ModuleObjectType added in v0.9.7

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

func (*ModuleObjectType) ConvertFromSDKResult added in v0.9.7

func (t *ModuleObjectType) ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

func (*ModuleObjectType) ConvertToSDKInput added in v0.9.7

func (t *ModuleObjectType) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

func (*ModuleObjectType) GetCallable added in v0.9.7

func (t *ModuleObjectType) GetCallable(ctx context.Context, name string) (Callable, error)

func (*ModuleObjectType) SourceMod added in v0.9.7

func (t *ModuleObjectType) SourceMod() Mod

func (*ModuleObjectType) TypeDef added in v0.9.7

func (t *ModuleObjectType) TypeDef() *TypeDef

type ModuleSource added in v0.9.8

type ModuleSource struct {
	Query *Query

	Kind ModuleSourceKind `field:"true" name:"kind" doc:"The kind of source (e.g. local, git, etc.)"`

	AsLocalSource dagql.Nullable[*LocalModuleSource] `field:"true" doc:"If the source is of kind local, the local source representation of it."`

	AsGitSource dagql.Nullable[*GitModuleSource] `field:"true" doc:"If the source is a of kind git, the git source representation of it."`

	// Settings that can be used to initialize or override the source's configuration
	WithName          string
	WithDependencies  []dagql.Instance[*ModuleDependency]
	WithSDK           string
	WithSourceSubpath string
	WithViews         []*ModuleSourceView
}

func (*ModuleSource) AutomaticGitignore added in v0.10.3

func (src *ModuleSource) AutomaticGitignore(ctx context.Context) (*bool, error)

func (ModuleSource) Clone added in v0.9.8

func (src ModuleSource) Clone() *ModuleSource

func (*ModuleSource) ContextDirectory added in v0.9.9

func (src *ModuleSource) ContextDirectory() (inst dagql.Instance[*Directory], err error)

func (*ModuleSource) ModuleConfig added in v0.9.9

func (src *ModuleSource) ModuleConfig(ctx context.Context) (*modules.ModuleConfig, bool, error)

func (*ModuleSource) ModuleName added in v0.9.8

func (src *ModuleSource) ModuleName(ctx context.Context) (string, error)

func (*ModuleSource) ModuleOriginalName added in v0.9.9

func (src *ModuleSource) ModuleOriginalName(ctx context.Context) (string, error)

func (*ModuleSource) PBDefinitions added in v0.9.8

func (src *ModuleSource) PBDefinitions(ctx context.Context) ([]*pb.Definition, error)

func (*ModuleSource) RefString added in v0.9.8

func (src *ModuleSource) RefString() (string, error)

func (*ModuleSource) SDK added in v0.9.9

func (src *ModuleSource) SDK(ctx context.Context) (string, error)

func (*ModuleSource) SourceRootSubpath added in v0.9.9

func (src *ModuleSource) SourceRootSubpath() (string, error)

func (*ModuleSource) SourceSubpath added in v0.9.9

func (src *ModuleSource) SourceSubpath(ctx context.Context) (string, error)

func (*ModuleSource) SourceSubpathWithDefault added in v0.9.9

func (src *ModuleSource) SourceSubpathWithDefault(ctx context.Context) (string, error)

SourceSubpathWithDefault is the same as SourceSubpath, but it will default to the root subpath if the module has no configuration.

func (*ModuleSource) Symbolic added in v0.9.8

func (src *ModuleSource) Symbolic() (string, error)

func (*ModuleSource) Type added in v0.9.8

func (src *ModuleSource) Type() *ast.Type

func (*ModuleSource) TypeDescription added in v0.9.8

func (src *ModuleSource) TypeDescription() string

func (*ModuleSource) ViewByName added in v0.10.3

func (src *ModuleSource) ViewByName(ctx context.Context, viewName string) (*ModuleSourceView, error)

func (*ModuleSource) Views added in v0.10.3

func (src *ModuleSource) Views(ctx context.Context) ([]*ModuleSourceView, error)

type ModuleSourceID added in v0.9.8

type ModuleSourceID = dagql.ID[*ModuleSource]

type ModuleSourceKind added in v0.9.8

type ModuleSourceKind string

func (ModuleSourceKind) Decoder added in v0.9.8

func (proto ModuleSourceKind) Decoder() dagql.InputDecoder

func (ModuleSourceKind) ToLiteral added in v0.9.8

func (proto ModuleSourceKind) ToLiteral() call.Literal

func (ModuleSourceKind) Type added in v0.9.8

func (proto ModuleSourceKind) Type() *ast.Type

func (ModuleSourceKind) TypeDescription added in v0.9.8

func (proto ModuleSourceKind) TypeDescription() string

type ModuleSourceView added in v0.10.3

type ModuleSourceView struct {
	*modules.ModuleConfigView
}

func (*ModuleSourceView) Type added in v0.10.3

func (v *ModuleSourceView) Type() *ast.Type

func (*ModuleSourceView) TypeDescription added in v0.10.3

func (v *ModuleSourceView) TypeDescription() string

type NetworkProtocol added in v0.3.13

type NetworkProtocol string

NetworkProtocol is a GraphQL enum type.

func (NetworkProtocol) Decoder added in v0.9.7

func (proto NetworkProtocol) Decoder() dagql.InputDecoder

func (NetworkProtocol) Network added in v0.3.13

func (proto NetworkProtocol) Network() string

Network returns the value appropriate for the "network" argument to Go net.Dial, and for appending to the port number to form the key for the ExposedPorts object in the OCI image config.

func (NetworkProtocol) ToLiteral added in v0.9.7

func (proto NetworkProtocol) ToLiteral() call.Literal

func (NetworkProtocol) Type added in v0.9.7

func (proto NetworkProtocol) Type() *ast.Type

func (NetworkProtocol) TypeDescription added in v0.9.7

func (proto NetworkProtocol) TypeDescription() string

type NullableType added in v0.9.7

type NullableType struct {
	InnerDef *TypeDef
	Inner    ModType
}

func (*NullableType) ConvertFromSDKResult added in v0.9.7

func (t *NullableType) ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

func (*NullableType) ConvertToSDKInput added in v0.9.7

func (t *NullableType) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

func (*NullableType) SourceMod added in v0.9.7

func (t *NullableType) SourceMod() Mod

func (*NullableType) TypeDef added in v0.9.7

func (t *NullableType) TypeDef() *TypeDef

type ObjectTypeDef added in v0.8.8

type ObjectTypeDef struct {
	// Name is the standardized name of the object (CamelCase), as used for the object in the graphql schema
	Name        string                    `field:"true" doc:"The name of the object."`
	Description string                    `field:"true" doc:"The doc string for the object, if any."`
	Fields      []*FieldTypeDef           `field:"true" doc:"Static fields defined on this object, if any."`
	Functions   []*Function               `field:"true" doc:"Functions defined on this object, if any."`
	Constructor dagql.Nullable[*Function] `field:"true" doc:"The function used to construct new instances of this object, if any"`

	// SourceModuleName is currently only set when returning the TypeDef from the Objects field on Module
	SourceModuleName string `field:"true" doc:"If this ObjectTypeDef is associated with a Module, the name of the module. Unset otherwise."`

	// The original name of the object as provided by the SDK that defined it, used
	// when invoking the SDK so it doesn't need to think as hard about case conversions
	OriginalName string
}

func NewObjectTypeDef added in v0.9.1

func NewObjectTypeDef(name, description string) *ObjectTypeDef

func (ObjectTypeDef) Clone added in v0.8.8

func (obj ObjectTypeDef) Clone() *ObjectTypeDef

func (*ObjectTypeDef) FieldByName added in v0.8.8

func (obj *ObjectTypeDef) FieldByName(name string) (*FieldTypeDef, bool)

func (*ObjectTypeDef) FieldByOriginalName added in v0.9.7

func (obj *ObjectTypeDef) FieldByOriginalName(name string) (*FieldTypeDef, bool)

func (*ObjectTypeDef) FunctionByName added in v0.8.8

func (obj *ObjectTypeDef) FunctionByName(name string) (*Function, bool)

func (*ObjectTypeDef) IsSubtypeOf added in v0.9.6

func (obj *ObjectTypeDef) IsSubtypeOf(iface *InterfaceTypeDef) bool

func (*ObjectTypeDef) Type added in v0.9.7

func (*ObjectTypeDef) Type() *ast.Type

func (*ObjectTypeDef) TypeDescription added in v0.9.7

func (*ObjectTypeDef) TypeDescription() string

type Ownership added in v0.5.1

type Ownership struct {
	UID int `json:"uid"`
	GID int `json:"gid"`
}

Ownership contains a UID/GID pair resolved from a user/group name or ID pair provided via the API. It primarily exists to distinguish an unspecified ownership from UID/GID 0 (root) ownership.

func (Ownership) Opt added in v0.5.1

func (owner Ownership) Opt() llb.ChownOption

type Platform added in v0.9.7

type Platform specs.Platform

func (Platform) DecodeInput added in v0.9.7

func (Platform) DecodeInput(val any) (dagql.Input, error)

func (Platform) Decoder added in v0.9.7

func (p Platform) Decoder() dagql.InputDecoder

func (Platform) Format added in v0.9.7

func (p Platform) Format() string

func (Platform) MarshalJSON added in v0.9.7

func (p Platform) MarshalJSON() ([]byte, error)

func (Platform) Spec added in v0.9.7

func (p Platform) Spec() specs.Platform

func (Platform) ToLiteral added in v0.9.7

func (p Platform) ToLiteral() call.Literal

func (Platform) Type added in v0.9.7

func (p Platform) Type() *ast.Type

func (Platform) TypeDescription added in v0.9.7

func (p Platform) TypeDescription() string

func (Platform) TypeName added in v0.9.7

func (p Platform) TypeName() string

type Port added in v0.8.5

type Port struct {
	Port                        int             `field:"true" doc:"The port number."`
	Protocol                    NetworkProtocol `field:"true" doc:"The transport layer protocol."`
	Description                 *string         `field:"true" doc:"The port description."`
	ExperimentalSkipHealthcheck bool            `field:"true" doc:"Skip the health check when run as a service."`
}

Port configures a port to exposed from a container or service.

func (Port) Type added in v0.9.7

func (Port) Type() *ast.Type

func (Port) TypeDescription added in v0.9.7

func (Port) TypeDescription() string

type PortForward added in v0.9.0

type PortForward struct {
	Frontend *int            `doc:"Port to expose to clients. If unspecified, a default will be chosen."`
	Backend  int             `doc:"Destination port for traffic."`
	Protocol NetworkProtocol `doc:"Transport layer protocol to use for traffic." default:"TCP"`
}

func (PortForward) FrontendOrBackendPort added in v0.9.0

func (pf PortForward) FrontendOrBackendPort() int

func (PortForward) TypeDescription added in v0.9.7

func (pf PortForward) TypeDescription() string

func (PortForward) TypeName added in v0.9.7

func (pf PortForward) TypeName() string

type PrimitiveType added in v0.9.7

type PrimitiveType struct {
	Def *TypeDef
}

PrimitiveType are the basic types like string, int, bool, void, etc.

func (*PrimitiveType) ConvertFromSDKResult added in v0.9.7

func (t *PrimitiveType) ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

func (*PrimitiveType) ConvertToSDKInput added in v0.9.7

func (t *PrimitiveType) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

func (*PrimitiveType) SourceMod added in v0.9.7

func (t *PrimitiveType) SourceMod() Mod

func (*PrimitiveType) TypeDef added in v0.9.7

func (t *PrimitiveType) TypeDef() *TypeDef

type Query added in v0.3.10

type Query struct {
	QueryOpts
	Buildkit *buildkit.Client

	// The current pipeline.
	Pipeline pipeline.Path
}

Query forms the root of the DAG and houses all necessary state and dependencies for evaluating queries.

func NewRoot added in v0.9.7

func NewRoot(ctx context.Context, opts QueryOpts) (*Query, error)

func (Query) Clone added in v0.9.7

func (q Query) Clone() *Query

func (*Query) CurrentFunctionCall added in v0.9.7

func (q *Query) CurrentFunctionCall(ctx context.Context) (*FunctionCall, error)

func (*Query) CurrentModule added in v0.9.7

func (q *Query) CurrentModule(ctx context.Context) (*Module, error)

func (*Query) CurrentServedDeps added in v0.9.7

func (q *Query) CurrentServedDeps(ctx context.Context) (*ModDeps, error)

func (*Query) IDDeps added in v0.9.7

func (q *Query) IDDeps(ctx context.Context, id *call.ID) (*ModDeps, error)

IDDeps loads the module dependencies of a given ID.

The returned ModDeps extends the inner DefaultDeps with all modules found in the ID, loaded by using the DefaultDeps schema.

func (*Query) MuxEndpoint added in v0.9.7

func (q *Query) MuxEndpoint(ctx context.Context, path string, handler http.Handler) error

func (*Query) NewContainer added in v0.9.7

func (q *Query) NewContainer(platform Platform) *Container

func (*Query) NewContainerService added in v0.9.7

func (q *Query) NewContainerService(ctr *Container) *Service

func (*Query) NewHost added in v0.9.7

func (q *Query) NewHost() *Host

func (*Query) NewHostService added in v0.9.7

func (q *Query) NewHostService(upstream string, ports []PortForward) *Service

func (*Query) NewModule added in v0.9.7

func (q *Query) NewModule() *Module

func (*Query) NewSecret added in v0.9.7

func (q *Query) NewSecret(name string, accessor string) *Secret

func (*Query) NewTunnelService added in v0.9.7

func (q *Query) NewTunnelService(upstream dagql.Instance[*Service], ports []PortForward) *Service

func (*Query) RegisterFunctionCall added in v0.9.7

func (q *Query) RegisterFunctionCall(
	ctx context.Context,
	dgst digest.Digest,
	deps *ModDeps,
	mod *Module,
	call *FunctionCall,
) error

func (*Query) ServeModuleToMainClient added in v0.9.7

func (q *Query) ServeModuleToMainClient(ctx context.Context, modMeta dagql.Instance[*Module]) error

func (*Query) Type added in v0.9.7

func (*Query) Type() *ast.Type

func (*Query) TypeDescription added in v0.9.7

func (*Query) TypeDescription() string

func (*Query) WithPipeline added in v0.9.7

func (q *Query) WithPipeline(name, desc string) *Query

type QueryOpts added in v0.10.2

type QueryOpts struct {
	Services *Services

	Secrets *SecretStore

	Auth *auth.RegistryAuthProvider

	OCIStore     content.Store
	LeaseManager *leaseutil.Manager

	// The default platform.
	Platform Platform

	// The default deps of every user module (currently just core)
	DefaultDeps *ModDeps

	// The DagQL query cache.
	Cache dagql.Cache

	BuildkitOpts *buildkit.Opts

	// The metadata of client calls.
	// For the special case of the main client caller, the key is just empty string.
	// This is never explicitly deleted from; instead it will just be garbage collected
	// when this server for the session shuts down
	ClientCallContext map[digest.Digest]*ClientCallContext
	ClientCallMu      *sync.RWMutex

	// the http endpoints being served (as a map since APIs like shellEndpoint can add more)
	Endpoints  map[string]http.Handler
	EndpointMu *sync.RWMutex
}

Settings for Query that are shared across all instances for a given DaggerServer

type RunningService added in v0.8.5

type RunningService struct {
	// Service is the service that has been started.
	Service *Service

	// Key is the unique identifier for the service.
	Key ServiceKey

	// Host is the hostname used to reach the service.
	Host string

	// Ports lists the ports bound by the service.
	//
	// For a Container service, this is simply the list of exposed ports.
	//
	// For a TunnelService, this lists the configured port forwards with any
	// empty or 0 frontend ports resolved to their randomly selected host port.
	//
	// For a HostService, this lists the configured port forwards with any empty
	// or 0 frontend ports set to the same as the backend port.
	Ports []Port

	// Stop forcibly stops the service. It is normally called after all clients
	// have detached, but may also be called manually by the user.
	Stop func(ctx context.Context, force bool) error

	// Block until the service has exited or the provided context is canceled.
	Wait func(ctx context.Context) error
}

RunningService represents a service that is actively running.

type SDK added in v0.9.7

type SDK interface {
	/* Codegen generates code for the module at the given source directory and subpath.

	The Code field of the returned GeneratedCode object should be the generated contents of the module sourceDirSubpath,
	in the case where that's different than the root of the sourceDir.

	The provided Module is not fully initialized; the Runtime field will not be set yet.
	*/
	Codegen(context.Context, *ModDeps, dagql.Instance[*ModuleSource]) (*GeneratedCode, error)

	/* Runtime returns a container that is used to execute module code at runtime in the Dagger engine.

	The provided Module is not fully initialized; the Runtime field will not be set yet.
	*/
	Runtime(context.Context, *ModDeps, dagql.Instance[*ModuleSource]) (*Container, error)

	// Paths that should always be loaded from module sources using this SDK. Ensures that e.g. main.go
	// in the Go SDK is always loaded even if dagger.json has include settings that don't include it.
	RequiredPaths(context.Context) ([]string, error)
}

An SDK is an implementation of the functionality needed to generate code for and execute a module.

There is one special SDK, the Go SDK, which is implemented in `goSDK` below. It's used as the "seed" for all other SDK implementations.

All other SDKs are themselves implemented as Modules, with Functions matching the two defined in this SDK interface.

An SDK Module needs to choose its own SDK for its implementation. This can be "well-known" built-in SDKs like "go", "python", etc. Or it can be any external module as specified with a module source ref string.

You can thus think of SDK Modules as a DAG of dependencies, with each SDK using a different SDK to implement its Module, with the Go SDK as the root of the DAG and the only one without any dependencies.

Built-in SDKs are also a bit special in that they come bundled w/ the engine container image, which allows them to be used without hard dependencies on the internet. They are loaded w/ the `loadBuiltinSDK` function below, which loads them as modules from the engine container.

type Secret

type Secret struct {
	Query *Query

	// Name specifies the name of the secret.
	Name string `json:"name,omitempty"`

	// Accessor specifies the accessor key for the secret.
	Accessor string `json:"accessor,omitempty"`
}

Secret is a content-addressed secret.

func (*Secret) Clone added in v0.5.1

func (secret *Secret) Clone() *Secret

func (*Secret) Type added in v0.9.7

func (*Secret) Type() *ast.Type

func (*Secret) TypeDescription added in v0.9.7

func (*Secret) TypeDescription() string

type SecretID

type SecretID = dagql.ID[*Secret]

type SecretStore added in v0.8.0

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

func NewSecretStore added in v0.8.0

func NewSecretStore() *SecretStore

func (*SecretStore) AddSecret added in v0.8.0

func (store *SecretStore) AddSecret(ctx context.Context, name string, plaintext []byte) error

AddSecret adds the secret identified by user defined name with its plaintext value to the secret store.

func (*SecretStore) GetSecret added in v0.8.0

func (store *SecretStore) GetSecret(ctx context.Context, name string) ([]byte, error)

GetSecret returns the plaintext secret value for a user defined secret name.

type SecretToScrubInfo added in v0.3.13

type SecretToScrubInfo struct {
	// Envs stores environment variable names that we need to scrub.
	Envs []string `json:"envs,omitempty"`

	// Files stores secret file paths that we need to scrub.
	Files []string `json:"files,omitempty"`
}

SecretToScrubInfo stores the info to access secrets and scrub them from outputs.

type Service added in v0.3.13

type Service struct {
	Query *Query

	// Container is the container to run as a service.
	Container *Container `json:"container"`

	// TunnelUpstream is the service that this service is tunnelling to.
	TunnelUpstream *dagql.Instance[*Service] `json:"upstream,omitempty"`
	// TunnelPorts configures the port forwarding rules for the tunnel.
	TunnelPorts []PortForward `json:"tunnel_ports,omitempty"`

	// HostUpstream is the host address (i.e. hostname or IP) for the reverse
	// tunnel to request through the host.
	HostUpstream string `json:"reverse_tunnel_upstream_addr,omitempty"`
	// HostPorts configures the port forwarding rules for the host.
	HostPorts []PortForward `json:"host_ports,omitempty"`
}

func (*Service) Clone added in v0.8.5

func (svc *Service) Clone() *Service

Clone returns a deep copy of the container suitable for modifying in a WithXXX method.

func (*Service) Endpoint added in v0.8.5

func (svc *Service) Endpoint(ctx context.Context, id *call.ID, port int, scheme string) (string, error)

func (*Service) Hostname added in v0.8.5

func (svc *Service) Hostname(ctx context.Context, id *call.ID) (string, error)

func (*Service) PipelinePath added in v0.8.5

func (svc *Service) PipelinePath() pipeline.Path

PipelinePath returns the service's pipeline path.

func (*Service) Ports added in v0.8.5

func (svc *Service) Ports(ctx context.Context, id *call.ID) ([]Port, error)

func (*Service) Start added in v0.8.5

func (svc *Service) Start(
	ctx context.Context,
	id *call.ID,
	interactive bool,
	forwardStdin func(io.Writer, bkgw.ContainerProcess),
	forwardStdout func(io.Reader),
	forwardStderr func(io.Reader),
) (running *RunningService, err error)

func (*Service) StartAndTrack added in v0.9.7

func (svc *Service) StartAndTrack(ctx context.Context, id *call.ID) error

func (*Service) Stop added in v0.9.7

func (svc *Service) Stop(ctx context.Context, id *call.ID, kill bool) error

func (*Service) Type added in v0.9.7

func (*Service) Type() *ast.Type

func (*Service) TypeDescription added in v0.9.7

func (*Service) TypeDescription() string

type ServiceBinding added in v0.8.5

type ServiceBinding struct {
	ID       *call.ID
	Service  *Service `json:"service"`
	Hostname string   `json:"hostname"`
	Aliases  AliasSet `json:"aliases"`
}

type ServiceBindings added in v0.3.13

type ServiceBindings []ServiceBinding

func (*ServiceBindings) Merge added in v0.3.13

func (bndp *ServiceBindings) Merge(other ServiceBindings)

type ServiceID added in v0.8.5

type ServiceID = dagql.ID[*Service]

type ServiceKey added in v0.8.5

type ServiceKey struct {
	Digest   digest.Digest
	ServerID string
}

ServiceKey is a unique identifier for a service.

type Services added in v0.8.5

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

Services manages the lifecycle of services, ensuring the same service only runs once per client.

func NewServices added in v0.8.5

func NewServices() *Services

NewServices returns a new Services.

func (*Services) Detach added in v0.8.5

func (ss *Services) Detach(ctx context.Context, svc *RunningService)

Detach detaches from the given service. If the service is not running, it is a no-op. If the service is running, it is stopped if there are no other clients using it.

func (*Services) Get added in v0.8.5

func (ss *Services) Get(ctx context.Context, id *call.ID) (*RunningService, error)

Get returns the running service for the given service. If the service is starting, it waits for it and either returns the running service or an error if it failed to start. If the service is not running or starting, an error is returned.

func (*Services) Start added in v0.8.5

func (ss *Services) Start(ctx context.Context, id *call.ID, svc Startable) (*RunningService, error)

Start starts the given service, returning the running service. If the service is already running, it is returned immediately. If the service is already starting, it waits for it to finish and returns the running service. If the service failed to start, it tries again.

func (*Services) StartBindings added in v0.8.5

func (ss *Services) StartBindings(ctx context.Context, bindings ServiceBindings) (_ func(), _ []*RunningService, err error)

StartBindings starts each of the bound services in parallel and returns a function that will detach from all of them after 10 seconds.

func (*Services) Stop added in v0.8.5

func (ss *Services) Stop(ctx context.Context, id *call.ID, kill bool) error

Stop stops the given service. If the service is not running, it is a no-op.

func (*Services) StopClientServices added in v0.8.5

func (ss *Services) StopClientServices(ctx context.Context, serverID string) error

StopClientServices stops all of the services being run by the given server. It is called when a server is closing.

type Socket added in v0.3.7

type Socket struct {
	// Unix
	HostPath string `json:"host_path,omitempty"`

	// IP
	HostProtocol string `json:"host_protocol,omitempty"`
	HostAddr     string `json:"host_addr,omitempty"`
}

func NewHostIPSocket added in v0.9.7

func NewHostIPSocket(proto string, addr string) *Socket

func NewHostUnixSocket added in v0.9.7

func NewHostUnixSocket(absPath string) *Socket

func (*Socket) Addr added in v0.9.7

func (socket *Socket) Addr() string

func (*Socket) Network added in v0.9.7

func (socket *Socket) Network() string

func (*Socket) SSHID added in v0.9.7

func (socket *Socket) SSHID() string

func (*Socket) Server added in v0.3.7

func (socket *Socket) Server() (sshforward.SSHServer, error)

func (*Socket) Type added in v0.9.7

func (*Socket) Type() *ast.Type

func (*Socket) TypeDescription added in v0.9.7

func (*Socket) TypeDescription() string

type SocketID added in v0.3.7

type SocketID = dagql.ID[*Socket]

type Startable added in v0.8.5

type Startable interface {
	Start(
		ctx context.Context,
		id *call.ID,
		interactive bool,
		forwardStdin func(io.Writer, bkgw.ContainerProcess),
		forwardStdout func(io.Reader),
		forwardStderr func(io.Reader),
	) (*RunningService, error)
}

type Terminal added in v0.9.8

type Terminal struct {
	Endpoint string `json:"endpoint"`
}

func (*Terminal) Type added in v0.9.8

func (*Terminal) Type() *ast.Type

func (*Terminal) TypeDescription added in v0.9.8

func (*Terminal) TypeDescription() string

func (*Terminal) WebsocketURL added in v0.9.8

func (term *Terminal) WebsocketURL() string

type TerminalArgs added in v0.10.1

type TerminalArgs struct {
	Cmd []string `default:"[]"`

	// Provide dagger access to the executed command
	// Do not use this option unless you trust the command being executed.
	// The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM
	ExperimentalPrivilegedNesting *bool `default:"false"`

	// Grant the process all root capabilities
	InsecureRootCapabilities *bool `default:"false"`
}

type TypeDef added in v0.8.8

type TypeDef struct {
	Kind        TypeDefKind                       `field:"true" doc:"The kind of type this is (e.g. primitive, list, object)."`
	Optional    bool                              `field:"true" doc:"Whether this type can be set to null. Defaults to false."`
	AsList      dagql.Nullable[*ListTypeDef]      `field:"true" doc:"If kind is LIST, the list-specific type definition. If kind is not LIST, this will be null."`
	AsObject    dagql.Nullable[*ObjectTypeDef]    `field:"true" doc:"If kind is OBJECT, the object-specific type definition. If kind is not OBJECT, this will be null."`
	AsInterface dagql.Nullable[*InterfaceTypeDef] `field:"true" doc:"If kind is INTERFACE, the interface-specific type definition. If kind is not INTERFACE, this will be null."`
	AsInput     dagql.Nullable[*InputTypeDef]     `field:"true" doc:"If kind is INPUT, the input-specific type definition. If kind is not INPUT, this will be null."`
}

func (TypeDef) Clone added in v0.8.8

func (typeDef TypeDef) Clone() *TypeDef

func (*TypeDef) IsSubtypeOf added in v0.9.6

func (typeDef *TypeDef) IsSubtypeOf(otherDef *TypeDef) bool

func (*TypeDef) ToInput added in v0.9.7

func (typeDef *TypeDef) ToInput() dagql.Input

func (*TypeDef) ToType added in v0.9.7

func (typeDef *TypeDef) ToType() *ast.Type

func (*TypeDef) ToTyped added in v0.9.7

func (typeDef *TypeDef) ToTyped() dagql.Typed

func (*TypeDef) Type added in v0.9.7

func (*TypeDef) Type() *ast.Type

func (*TypeDef) TypeDescription added in v0.9.7

func (*TypeDef) TypeDescription() string

func (*TypeDef) Underlying added in v0.9.4

func (typeDef *TypeDef) Underlying() *TypeDef

func (*TypeDef) WithFunction added in v0.9.6

func (typeDef *TypeDef) WithFunction(fn *Function) (*TypeDef, error)

func (*TypeDef) WithInterface added in v0.9.6

func (typeDef *TypeDef) WithInterface(name, desc string) *TypeDef

func (*TypeDef) WithKind added in v0.8.8

func (typeDef *TypeDef) WithKind(kind TypeDefKind) *TypeDef

func (*TypeDef) WithListOf added in v0.8.8

func (typeDef *TypeDef) WithListOf(elem *TypeDef) *TypeDef

func (*TypeDef) WithObject added in v0.8.8

func (typeDef *TypeDef) WithObject(name, desc string) *TypeDef

func (*TypeDef) WithObjectConstructor added in v0.9.4

func (typeDef *TypeDef) WithObjectConstructor(fn *Function) (*TypeDef, error)

func (*TypeDef) WithObjectField added in v0.8.8

func (typeDef *TypeDef) WithObjectField(name string, fieldType *TypeDef, desc string) (*TypeDef, error)

func (*TypeDef) WithOptional added in v0.8.8

func (typeDef *TypeDef) WithOptional(optional bool) *TypeDef

type TypeDefID added in v0.8.8

type TypeDefID = dagql.ID[*TypeDef]

type TypeDefKind added in v0.8.8

type TypeDefKind string

func (TypeDefKind) Decoder added in v0.9.7

func (k TypeDefKind) Decoder() dagql.InputDecoder

func (TypeDefKind) String added in v0.8.8

func (k TypeDefKind) String() string

func (TypeDefKind) ToLiteral added in v0.9.7

func (k TypeDefKind) ToLiteral() call.Literal

func (TypeDefKind) Type added in v0.9.7

func (k TypeDefKind) Type() *ast.Type

func (TypeDefKind) TypeDescription added in v0.9.7

func (k TypeDefKind) TypeDescription() string

type UserModFunctionArg added in v0.9.7

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

type Void added in v0.9.7

type Void struct{}

func (Void) DecodeInput added in v0.9.7

func (Void) DecodeInput(val any) (dagql.Input, error)

func (Void) Decoder added in v0.9.7

func (p Void) Decoder() dagql.InputDecoder

func (Void) ToLiteral added in v0.9.7

func (p Void) ToLiteral() call.Literal

func (Void) Type added in v0.9.7

func (p Void) Type() *ast.Type

func (Void) TypeDescription added in v0.9.7

func (p Void) TypeDescription() string

func (Void) TypeName added in v0.9.7

func (p Void) TypeName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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