core

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 90 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 (
	// FIXME: should be canonicalized as GZIP, ZSTD, ESTARGZ, UNCOMPRESSED
	CompressionGzip         = ImageLayerCompressions.Register("Gzip")
	CompressionZstd         = ImageLayerCompressions.Register("Zstd")
	CompressionEStarGZ      = ImageLayerCompressions.Register("EStarGZ")
	CompressionUncompressed = ImageLayerCompressions.Register("Uncompressed")
)
View Source
var (
	// FIXME: should be canonicalized as OCI_MEDIA_TYPES, DOCKER_MEDIA_TYPES
	OCIMediaTypes    = ImageMediaTypesEnum.Register("OCIMediaTypes")
	DockerMediaTypes = ImageMediaTypesEnum.Register("DockerMediaTypes")
)
View Source
var (
	ReturnSuccess = ReturnTypesEnum.Register("SUCCESS",
		`A successful execution (exit code 0)`,
	)
	ReturnFailure = ReturnTypesEnum.Register("FAILURE",
		`A failed execution (exit codes 1-127)`,
	)
	ReturnAny = ReturnTypesEnum.Register("ANY",
		`Any execution (exit codes 0-127)`,
	)
)
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.")
	TypeDefKindScalar = TypeDefKinds.Register("SCALAR_KIND",
		"A scalar value of any basic kind.")
	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.`,
	)
	TypeDefKindEnum = TypeDefKinds.Register("ENUM_KIND",
		"A GraphQL enum type and its values",
		"Always paired with an EnumTypeDef.",
	)
)
View Source
var CacheSharingModes = dagql.NewEnum[CacheSharingMode]()
View Source
var ErrNoCommand = errors.New("no command has been set")
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 ReturnTypesEnum = dagql.NewEnum[ReturnTypes]()
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 AroundFunc added in v0.11.7

func AroundFunc(ctx context.Context, self dagql.Object, id *call.ID) (context.Context, func(res dagql.Typed, cached bool, rerr error))

func GetClientResourceAccessor added in v0.12.1

func GetClientResourceAccessor(ctx context.Context, parent *Query, externalName string) (string, error)

func GetHostIPSocketAccessor added in v0.12.1

func GetHostIPSocketAccessor(ctx context.Context, query *Query, upstreamHost string, port PortForward) (string, error)

func LoadBlob added in v0.9.7

func LoadBlob(ctx context.Context, srv *dagql.Server, dgst digest.Digest) (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 Tracer added in v0.11.0

func Tracer(ctx context.Context) 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
	ParentTyped    dagql.Typed
	ParentFields   map[string]any
	Cache          bool
	SkipSelfSchema bool
	Server         *dagql.Server
}

type Callable added in v0.9.7

type Callable interface {
	Call(context.Context, *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, opts *CallOpts) (dagql.Typed, error)

func (*CallableField) ReturnType added in v0.9.7

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

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"`

	// OCI annotations
	Annotations []ContainerAnnotation `json:"annotations,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"`

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

	// (Internal-only for now) Environment variables from the engine container, prefixed
	// with a special value, that will be inherited by this container if set.
	SystemEnvNames []string `json:"system_envs,omitempty"`
}

Container is a content-addressed container.

func NewContainer added in v0.3.3

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

func (*Container) AsService added in v0.15.0

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

func (*Container) AsServiceLegacy added in v0.15.0

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

func (*Container) AsTarball added in v0.9.0

func (container *Container) AsTarball(
	ctx context.Context,
	srv *dagql.Server,
	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,
	secretStore *SecretStore,
) (*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) ExitCode

func (container *Container) ExitCode(ctx context.Context) (int, 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) FromCanonicalRef added in v0.13.6

func (container *Container) FromCanonicalRef(
	ctx context.Context,
	refName reference.Canonical,

	cfgBytes []byte,
) (*Container, error)

func (*Container) FromRefString added in v0.13.6

func (container *Container) FromRefString(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) 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) 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) Stderr added in v0.12.5

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

func (*Container) Stdout added in v0.12.5

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

func (*Container) Terminal added in v0.9.8

func (container *Container) Terminal(
	ctx context.Context,
	svcID *call.ID,
	args *TerminalArgs,
) 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) WithAnnotation added in v0.13.1

func (container *Container) WithAnnotation(ctx context.Context, key, value string) (*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, size int) (*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) WithoutAnnotation added in v0.13.1

func (container *Container) WithoutAnnotation(ctx context.Context, name 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) WithoutPaths added in v0.13.1

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

func (*Container) WithoutSecretVariable added in v0.11.3

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

func (*Container) WithoutUnixSocket added in v0.3.7

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

type ContainerAnnotation added in v0.13.1

type ContainerAnnotation struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type ContainerAsServiceArgs added in v0.15.0

type ContainerAsServiceArgs struct {
	// Command to run instead of the container's default command
	Args []string `default:"[]"`

	// If the container has an entrypoint, prepend it to this exec's args
	UseEntrypoint bool `default:"false"`

	// Provide the executed command access back to the Dagger API
	ExperimentalPrivilegedNesting bool `default:"false"`

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

	// Expand the environment variables in args
	Expand bool `default:"false"`

	// Skip the init process injected into containers by default so that the
	// user's process is PID 1
	NoInit bool `default:"false"`
}

type ContainerExecOpts

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

	// If the container has an entrypoint, prepend it to this exec's args
	UseEntrypoint 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:""`

	// Exit codes this exec is allowed to exit with
	Expect ReturnTypes `default:"SUCCESS"`

	// Provide the executed command access back to the Dagger API
	ExperimentalPrivilegedNesting bool `default:"false"`

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

	// (Internal-only) If this is a nested exec, exec metadata to use for it
	NestedExecMetadata *buildkit.ExecutionMetadata `name:"-"`

	// Expand the environment variables in args
	Expand bool `default:"false"`

	// Skip the init process injected into containers by default so that the
	// user's process is PID 1
	NoInit bool `default:"false"`
}

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 size of the mounted tmpfs in bytes
	Size int `json:"size,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 dagql.Optional[dagql.Boolean] `default:"false"`

	// Grant the process all root capabilities
	InsecureRootCapabilities dagql.Optional[dagql.Boolean] `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(ctx context.Context, query *Query, platform Platform) (*Directory, error)

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) Digest added in v0.5.2

func (dir *Directory) Digest(ctx context.Context) (string, 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, pattern string) ([]string, error)

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

func (*Directory) PBDefinitions added in v0.8.8

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

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) Terminal added in v0.12.0

func (dir *Directory) Terminal(
	ctx context.Context,
	svcID *call.ID,
	ctr *Container,
	args *TerminalArgs,
) 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, paths ...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 Engine added in v0.12.0

type Engine struct {
	Query *Query
}

func (*Engine) Type added in v0.12.0

func (*Engine) Type() *ast.Type

func (*Engine) TypeDescription added in v0.12.0

func (*Engine) TypeDescription() string

type EngineCache added in v0.12.0

type EngineCache struct {
	Query *Query

	KeepBytes int `` /* 156-byte string literal not displayed */

	MaxUsedSpace  int `field:"true" doc:"The maximum bytes to keep in the cache without pruning."`
	ReservedSpace int `field:"true" docs:"The minimum amount of disk space this policy is guaranteed to retain."`
	MinFreeSpace  int `field:"true" doc:"The target amount of free disk space the garbage collector will attempt to leave."`
}

func (*EngineCache) Type added in v0.12.0

func (*EngineCache) Type() *ast.Type

func (*EngineCache) TypeDescription added in v0.12.0

func (*EngineCache) TypeDescription() string

type EngineCacheEntry added in v0.12.0

type EngineCacheEntry struct {
	Description               string `field:"true" doc:"The description of the cache entry."`
	DiskSpaceBytes            int    `field:"true" doc:"The disk space used by the cache entry."`
	CreatedTimeUnixNano       int    `field:"true" doc:"The time the cache entry was created, in Unix nanoseconds."`
	MostRecentUseTimeUnixNano int    `field:"true" doc:"The most recent time the cache entry was used, in Unix nanoseconds."`
	ActivelyUsed              bool   `field:"true" doc:"Whether the cache entry is actively being used."`
}

func (*EngineCacheEntry) Type added in v0.12.0

func (*EngineCacheEntry) Type() *ast.Type

func (*EngineCacheEntry) TypeDescription added in v0.12.0

func (*EngineCacheEntry) TypeDescription() string

type EngineCacheEntrySet added in v0.12.0

type EngineCacheEntrySet struct {
	EntryCount     int `field:"true" doc:"The number of cache entries in this set."`
	DiskSpaceBytes int `field:"true" doc:"The total disk space used by the cache entries in this set."`

	EntriesList []*EngineCacheEntry
}

func (*EngineCacheEntrySet) Evaluate added in v0.12.0

func (*EngineCacheEntrySet) Type added in v0.12.0

func (*EngineCacheEntrySet) Type() *ast.Type

func (*EngineCacheEntrySet) TypeDescription added in v0.12.0

func (*EngineCacheEntrySet) TypeDescription() string

type EnumTypeDef added in v0.12.0

type EnumTypeDef struct {
	// Name is the standardized name of the enum (CamelCase), as used for the enum in the graphql schema
	Name        string              `field:"true" doc:"The name of the enum."`
	Description string              `field:"true" doc:"A doc string for the enum, if any."`
	Values      []*EnumValueTypeDef `field:"true" doc:"The values of the enum."`
	SourceMap   *SourceMap          `field:"true" doc:"The location of this enum declaration."`

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

	// The original name of the enum 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 NewEnumTypeDef added in v0.12.0

func NewEnumTypeDef(name, description string, sourceMap *SourceMap) *EnumTypeDef

func (EnumTypeDef) Clone added in v0.12.0

func (enum EnumTypeDef) Clone() *EnumTypeDef

func (*EnumTypeDef) ListValues added in v0.12.0

func (enum *EnumTypeDef) ListValues() ast.EnumValueList

Implements dagql.Enum interface

func (*EnumTypeDef) Type added in v0.12.0

func (*EnumTypeDef) Type() *ast.Type

func (*EnumTypeDef) TypeDescription added in v0.12.0

func (*EnumTypeDef) TypeDescription() string

type EnumValueTypeDef added in v0.12.0

type EnumValueTypeDef struct {
	Name        string     `field:"true" doc:"The name of the enum value."`
	Description string     `field:"true" doc:"A doc string for the enum value, if any."`
	SourceMap   *SourceMap `field:"true" doc:"The location of this enum value declaration."`
}

func NewEnumValueTypeDef added in v0.12.0

func NewEnumValueTypeDef(name, description string, sourceMap *SourceMap) *EnumValueTypeDef

func (EnumValueTypeDef) Clone added in v0.12.0

func (enumValue EnumValueTypeDef) Clone() *EnumValueTypeDef

func (*EnumValueTypeDef) Type added in v0.12.0

func (*EnumValueTypeDef) Type() *ast.Type

func (*EnumValueTypeDef) TypeDescription added in v0.12.0

func (*EnumValueTypeDef) TypeDescription() string

type Error added in v0.15.0

type Error struct {
	Query *Query `json:"-"`

	Message string `field:"true" doc:"A description of the error."`
}

func NewError added in v0.15.0

func NewError(message string) *Error

func (*Error) Type added in v0.15.0

func (e *Error) Type() *ast.Type

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."`

	SourceMap *SourceMap `field:"true" doc:"The location of this field declaration."`

	// 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) Digest added in v0.5.2

func (file *File) Digest(ctx context.Context, excludeMetadata bool) (string, error)

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) 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) WithName added in v0.11.6

func (file *File) WithName(ctx context.Context, filename string) (*File, error)

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."`

	SourceMap *SourceMap `field:"true" doc:"The location of this function declaration."`

	// 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, defaultPath string, ignore []string, sourceMap *SourceMap) *Function

func (*Function) WithDescription added in v0.8.8

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

func (*Function) WithSourceMap added in v0.13.7

func (fn *Function) WithSourceMap(sourceMap *SourceMap) *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."`
	SourceMap    *SourceMap `field:"true" doc:"The location of this arg declaration."`
	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."`
	DefaultPath  string     `` /* 152-byte string literal not displayed */
	Ignore       []string   `` /* 187-byte string literal not displayed */

	// 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 `json:"-"`

	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) ReturnError added in v0.15.0

func (fnCall *FunctionCall) ReturnError(ctx context.Context, errID dagql.ID[*Error]) error

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 {
	Root        string `field:"true" doc:"The clean module name of the root of the module"`
	RootSubpath string `` /* 200-byte string literal not displayed */

	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."`

	CloneRef string `field:"true" name:"cloneRef" doc:"The ref to clone the root of the git repo from"`

	HTMLRepoURL string `field:"true" name:"htmlRepoURL" doc:"The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket)"`

	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) 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) Pin added in v0.13.6

func (src *GitModuleSource) Pin() string

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, discardGitDir bool) (*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"`

	DiscardGitDir bool `json:"discardGitDir"`

	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) 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) TypeDefinition added in v0.13.7

func (iface *InterfaceAnnotatedValue) TypeDefinition(views ...string) *ast.Definition

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) CollectCoreIDs added in v0.12.1

func (iface *InterfaceType) CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*resource.ID) error

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."`
	SourceMap   *SourceMap  `field:"true" doc:"The location of this interface declaration."`
	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

func (*InterfaceTypeDef) WithSourceMap added in v0.13.7

func (iface *InterfaceTypeDef) WithSourceMap(sourceMap *SourceMap) *InterfaceTypeDef

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

func (*JSON) UnmarshalJSON added in v0.11.8

func (p *JSON) UnmarshalJSON(bs []byte) error

type ListType added in v0.9.7

type ListType struct {
	Elem       *TypeDef
	Underlying ModType
}

func (*ListType) CollectCoreIDs added in v0.12.1

func (t *ListType) CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*resource.ID) error

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

	RelHostPath string `field:"true" doc:"The relative path to the module root from the host directory"`

	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 {
	// Name gets the name of the module
	Name() string

	// View gets the name of the module's view of its underlying schema
	View() (string, bool)

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

	// Install modifies the provided server to install the contents of the
	// modules declared fields.
	Install(ctx context.Context, dag *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)

	// TypeDefs gets the TypeDefs exposed by this module (not including 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) Clone added in v0.12.0

func (d *ModDeps) Clone() *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) SchemaIntrospectionJSONFile added in v0.11.7

func (d *ModDeps) SchemaIntrospectionJSONFile(ctx context.Context) (inst dagql.Instance[*File], _ error)

The introspection json for combined schema exposed by each mod in this set of dependencies, as a file. It is meant for consumption from modules, which have some APIs hidden from their codegen.

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)

	// CollectCoreIDs collects all the call IDs from core objects in the given value, whether
	// it's idable itself or is a list/object containing idable values (recursively)
	CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*resource.ID) 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."`

	// The module's enumerations
	EnumDefs []*TypeDef `field:"true" name:"enums" doc:"Enumerations 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) 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, oldID *call.ID, newID *call.ID, dag *dagql.Server) (*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) View added in v0.12.0

func (mod *Module) View() (string, bool)

func (*Module) WithDescription added in v0.9.8

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

func (*Module) WithEnum added in v0.12.0

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

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 ModuleEnum added in v0.12.0

type ModuleEnum struct {
	TypeDef *EnumTypeDef
	Value   string
}

func (*ModuleEnum) DecodeInput added in v0.12.0

func (e *ModuleEnum) DecodeInput(val any) (dagql.Input, error)

func (*ModuleEnum) Decoder added in v0.12.0

func (e *ModuleEnum) Decoder() dagql.InputDecoder

func (*ModuleEnum) Install added in v0.12.0

func (e *ModuleEnum) Install(dag *dagql.Server) error

func (*ModuleEnum) Lookup added in v0.12.0

func (e *ModuleEnum) Lookup(val string) (dagql.Input, error)

func (*ModuleEnum) MarshalJSON added in v0.12.0

func (e *ModuleEnum) MarshalJSON() ([]byte, error)

func (*ModuleEnum) PossibleValues added in v0.12.0

func (e *ModuleEnum) PossibleValues() ast.EnumValueList

func (*ModuleEnum) ToLiteral added in v0.12.0

func (e *ModuleEnum) ToLiteral() call.Literal

func (*ModuleEnum) Type added in v0.12.0

func (e *ModuleEnum) Type() *ast.Type

func (*ModuleEnum) TypeDefinition added in v0.12.0

func (e *ModuleEnum) TypeDefinition(views ...string) *ast.Definition

func (*ModuleEnum) TypeDescription added in v0.12.0

func (e *ModuleEnum) TypeDescription() string

func (*ModuleEnum) TypeName added in v0.12.0

func (e *ModuleEnum) TypeName() string

type ModuleEnumType added in v0.12.0

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

func (*ModuleEnumType) CollectCoreIDs added in v0.12.1

func (m *ModuleEnumType) CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*resource.ID) error

func (*ModuleEnumType) ConvertFromSDKResult added in v0.12.0

func (m *ModuleEnumType) ConvertFromSDKResult(ctx context.Context, value any) (dagql.Typed, error)

func (*ModuleEnumType) ConvertToSDKInput added in v0.12.0

func (m *ModuleEnumType) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error)

func (*ModuleEnumType) SourceMod added in v0.12.0

func (m *ModuleEnumType) SourceMod() Mod

func (*ModuleEnumType) TypeDef added in v0.12.0

func (m *ModuleEnumType) TypeDef() *TypeDef

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, 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 ModuleInitConfig added in v0.12.5

type ModuleInitConfig struct {
	Merge bool
}

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) TypeDefinition added in v0.13.7

func (obj *ModuleObject) TypeDefinition(views ...string) *ast.Definition

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) CollectCoreIDs added in v0.12.1

func (t *ModuleObjectType) CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*resource.ID) error

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]
	WithoutDependencies []string
	WithSDK             string
	WithInitConfig      *ModuleInitConfig
	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) Digest added in v0.13.0

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

func (*ModuleSource) LoadContext added in v0.12.6

func (src *ModuleSource) LoadContext(ctx context.Context, dag *dagql.Server, path string, ignore []string) (inst dagql.Instance[*Directory], err error)

LoadContext loads a directory from the module context directory.

If the module is local, it will load the directory from the local source directly from the host. In that case, the path is first resolved based on the caller's host location. Then if the path is absolute, it will be relative to the context directory. Otherwise, it will be relative to the module root directory.

If the module is git, it will load the directory from the git repository using its context directory.

func (*ModuleSource) ModuleConfig added in v0.9.9

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

func (*ModuleSource) ModuleEngineVersion added in v0.12.0

func (src *ModuleSource) ModuleEngineVersion(ctx context.Context) (string, 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) Pin added in v0.13.6

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

func (*ModuleSource) RefString added in v0.9.8

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

func (*ModuleSource) ResolveContextPathFromCaller added in v0.12.6

func (src *ModuleSource) ResolveContextPathFromCaller(ctx context.Context) (contextRootAbsPath, sourceRootAbsPath string, _ error)

resolveContextPaths returns the context path to the .git directory if it exists. Otherwise, it returns the source root directory.

func (*ModuleSource) ResolveContextPathFromModule added in v0.12.6

func (src *ModuleSource) ResolveContextPathFromModule(ctx context.Context) (contextRootAbsPath, moduleRootAbsPath string, err error)

ResolveContextPathFromModule returns the absolute path to the module's context directory based on the caller's host location. It's necessary to use this function and not `ResolveContextPathFromCaller` because the `SourceRootSubpath` is relative to the module root source dir and not the caller after module's initialization which may leads to invalid paths.

For example, if the module is in a subdirectory (/root/ctx/mod), the `SourceRootSubpath` will be relative to the source module's root directory (./mod), but the path from the caller location would be `./ctx/mod`.

This function returns both: - the path to the context directory (location of the .git or `dagger.json“ file if it doesn't exist) - the path to the source root directory (location of the `dagger.json` file)

NOTE: this function is only valid for local module sources.

func (*ModuleSource) SDK added in v0.9.9

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

func (*ModuleSource) SourceRootRelSubPath added in v0.12.6

func (src *ModuleSource) SourceRootRelSubPath() (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) CollectCoreIDs added in v0.12.1

func (t *NullableType) CollectCoreIDs(ctx context.Context, value dagql.Typed, ids map[digest.Digest]*resource.ID) error

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."`
	SourceMap   *SourceMap                `field:"true" doc:"The location of this object declaration."`
	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

func (*ObjectTypeDef) WithSourceMap added in v0.13.7

func (obj *ObjectTypeDef) WithSourceMap(sourceMap *SourceMap) *ObjectTypeDef

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." json:"frontend,omitempty"`
	Backend  int             `doc:"Destination port for traffic." json:"backend"`
	Protocol NetworkProtocol `doc:"Transport layer protocol to use for traffic." default:"TCP" json:"protocol,omitempty"`
}

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) CollectCoreIDs added in v0.12.1

func (t *PrimitiveType) CollectCoreIDs(context.Context, dagql.Typed, map[digest.Digest]*resource.ID) error

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 {
	Server
}

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(srv Server) *Query

func (Query) Clone added in v0.9.7

func (q Query) Clone() *Query

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) 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(ctx context.Context, 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(ctx context.Context, socks []*Socket) *Service

func (*Query) NewModule added in v0.9.7

func (q *Query) NewModule() *Module

func (*Query) NewTunnelService added in v0.9.7

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

func (*Query) RequireMainClient added in v0.12.0

func (q *Query) RequireMainClient(ctx context.Context) 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 ReturnTypes added in v0.13.7

type ReturnTypes string

func (ReturnTypes) Decoder added in v0.13.7

func (expect ReturnTypes) Decoder() dagql.InputDecoder

func (ReturnTypes) ReturnCodes added in v0.13.7

func (expect ReturnTypes) ReturnCodes() []int

ReturnCodes gets the valid exit codes allowed for a specific return status

NOTE: exit status codes above 128 are likely from exiting via a signal - we shouldn't try and handle these.

func (ReturnTypes) ToLiteral added in v0.13.7

func (expect ReturnTypes) ToLiteral() call.Literal

func (ReturnTypes) Type added in v0.13.7

func (expect ReturnTypes) Type() *ast.Type

func (ReturnTypes) TypeDescription added in v0.13.7

func (expect ReturnTypes) TypeDescription() string

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 ScalarTypeDef added in v0.11.3

type ScalarTypeDef struct {
	Name        string `field:"true" doc:"The name of the scalar."`
	Description string `field:"true" doc:"A doc string for the scalar, if any."`

	OriginalName string

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

func NewScalarTypeDef added in v0.11.3

func NewScalarTypeDef(name, description string) *ScalarTypeDef

func (ScalarTypeDef) Clone added in v0.11.3

func (typeDef ScalarTypeDef) Clone() *ScalarTypeDef

func (*ScalarTypeDef) Type added in v0.11.3

func (*ScalarTypeDef) Type() *ast.Type

func (*ScalarTypeDef) TypeDescription added in v0.11.3

func (typeDef *ScalarTypeDef) TypeDescription() string

type SchemeType added in v0.12.6

type SchemeType int
const (
	NoScheme SchemeType = iota
	SchemeHTTP
	SchemeHTTPS
	SchemeSSH
	SchemeSCPLike
)

func (SchemeType) IsSSH added in v0.12.6

func (s SchemeType) IsSSH() bool

func (SchemeType) Prefix added in v0.12.6

func (s SchemeType) Prefix() string

type Secret

type Secret struct {
	Query *Query

	// The digest of the DagQL ID that accessed this secret, used as its identifier
	// in secret stores.
	IDDigest digest.Digest
}

Secret is a content-addressed secret.

func (*Secret) Clone added in v0.5.1

func (secret *Secret) Clone() *Secret

func (*Secret) LLBID added in v0.12.1

func (secret *Secret) LLBID() string

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(secret *Secret, name string, plaintext []byte) error

func (*SecretStore) AddSecretFromOtherStore added in v0.12.1

func (store *SecretStore) AddSecretFromOtherStore(secret *Secret, otherStore *SecretStore) error

func (*SecretStore) AsBuildkitSecretStore added in v0.12.1

func (store *SecretStore) AsBuildkitSecretStore() secrets.SecretStore

func (*SecretStore) GetSecretName added in v0.12.1

func (store *SecretStore) GetSecretName(idDgst digest.Digest) (string, bool)

func (*SecretStore) GetSecretPlaintext added in v0.12.1

func (store *SecretStore) GetSecretPlaintext(idDgst digest.Digest) ([]byte, bool)

func (*SecretStore) HasSecret added in v0.12.1

func (store *SecretStore) HasSecret(idDgst digest.Digest) bool

type Server added in v0.11.8

type Server interface {
	// Stitch in the given module to the list being served to the current client
	ServeModule(context.Context, *Module) error

	// If the current client is coming from a function, return the module that function is from
	CurrentModule(context.Context) (*Module, error)

	// If the current client is coming from a function, return the function call metadata
	CurrentFunctionCall(context.Context) (*FunctionCall, error)

	// Return the list of deps being served to the current client
	CurrentServedDeps(context.Context) (*ModDeps, error)

	// The ClientID of the main client caller (i.e. the one who created the session, typically the CLI
	// invoked by the user)
	MainClientCallerID(context.Context) (string, error)

	// The default deps of every user module (currently just core)
	DefaultDeps(context.Context) (*ModDeps, error)

	// The DagQL query cache for the current client's session
	Cache(context.Context) (dagql.Cache, error)

	// Mix in this http endpoint+handler to the current client's session
	MuxEndpoint(context.Context, string, http.Handler) error

	// The secret store for the current client
	Secrets(context.Context) (*SecretStore, error)

	// The socket store for the current client
	Sockets(context.Context) (*SocketStore, error)

	// Add client-isolated resources like secrets, sockets, etc. to the current client's session based
	// on anything embedded in the given ID. skipTopLevel, if true, will result in the leaf selection
	// of the ID to be skipped when walking the ID to find these resources.
	AddClientResourcesFromID(ctx context.Context, id *resource.ID, sourceClientID string, skipTopLevel bool) error

	// The auth provider for the current client
	Auth(context.Context) (*auth.RegistryAuthProvider, error)

	// The buildkit APIs for the current client
	Buildkit(context.Context) (*buildkit.Client, error)

	// The services for the current client's session
	Services(context.Context) (*Services, error)

	// The default platform for the engine as a whole
	Platform() Platform

	// The content store for the engine as a whole
	OCIStore() content.Store

	// The lease manager for the engine as a whole
	LeaseManager() *leaseutil.Manager

	// Return all the cache entries in the local cache. No support for filtering yet.
	EngineLocalCacheEntries(context.Context) (*EngineCacheEntrySet, error)

	// Prune everything that is releasable in the local cache. No support for filtering yet.
	PruneEngineLocalCacheEntries(context.Context) (*EngineCacheEntrySet, error)

	// The default local cache policy to use for automatic local cache GC.
	EngineLocalCachePolicy() bkclient.PruneInfo

	// The nearest ancestor client that is not a module (either a caller from the host like the CLI
	// or a nested exec). Useful for figuring out where local sources should be resolved from through
	// chains of dependency modules.
	NonModuleParentClientMetadata(context.Context) (*engine.ClientMetadata, error)
}

APIs from the server+session+client that are needed by core APIs

type Service added in v0.3.13

type Service struct {
	// The span that created the service, which future runs of the service will
	// link to.
	Creator trace.SpanContext

	Query *Query

	// A custom hostname set by the user.
	CustomHostname string

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

	// The sockets on the host to reverse tunnel
	HostSockets []*Socket `json:"host_sockets,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) 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

func (*Service) WithHostname added in v0.13.4

func (svc *Service) WithHostname(hostname string) *Service

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
	SessionID 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) StopSessionServices added in v0.12.0

func (ss *Services) StopSessionServices(ctx context.Context, sessionID string) error

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

type SliceSet added in v0.13.1

type SliceSet[T comparable] []T

SliceSet is a generic type that represents a set implemented as a slice. TODO: it can eventually be replaced with a more performant underlying data structure like a tree since the current implementation is O(n) but it's fine as it's used ofor small sets currently.

func (*SliceSet[T]) Append added in v0.13.1

func (s *SliceSet[T]) Append(element T)

Append adds an element to the SliceSet if it's not already present.

type Socket added in v0.3.7

type Socket struct {
	// The digest of the DagQL ID that accessed this socket, used as its identifier
	// in socket stores.
	IDDigest digest.Digest
}

func (*Socket) LLBID added in v0.12.1

func (socket *Socket) LLBID() string

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 SocketStore added in v0.12.1

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

func NewSocketStore added in v0.12.1

func NewSocketStore(bkSessionManager *bksession.Manager) *SocketStore

func (*SocketStore) AddIPSocket added in v0.12.1

func (store *SocketStore) AddIPSocket(sock *Socket, buildkitSessionID, upstreamHost string, port PortForward) error

func (*SocketStore) AddSocketFromOtherStore added in v0.12.1

func (store *SocketStore) AddSocketFromOtherStore(socket *Socket, otherStore *SocketStore) error

func (*SocketStore) AddUnixSocket added in v0.12.1

func (store *SocketStore) AddUnixSocket(sock *Socket, buildkitSessionID, hostPath string) error

func (*SocketStore) CheckAgent added in v0.12.1

func (*SocketStore) ConnectSocket added in v0.12.1

func (store *SocketStore) ConnectSocket(ctx context.Context, idDgst digest.Digest) (sshforward.SSH_ForwardAgentClient, error)

func (*SocketStore) ForwardAgent added in v0.12.1

func (store *SocketStore) ForwardAgent(stream sshforward.SSH_ForwardAgentServer) error

func (*SocketStore) GetSocketPortForward added in v0.12.1

func (store *SocketStore) GetSocketPortForward(idDgst digest.Digest) (PortForward, bool)

func (*SocketStore) GetSocketURLEncoded added in v0.12.1

func (store *SocketStore) GetSocketURLEncoded(idDgst digest.Digest) (string, bool)

func (*SocketStore) HasSocket added in v0.12.1

func (store *SocketStore) HasSocket(idDgst digest.Digest) bool

func (*SocketStore) MountSocket added in v0.12.6

func (store *SocketStore) MountSocket(ctx context.Context, idDgst digest.Digest) (string, func() error, error)

func (*SocketStore) Register added in v0.12.1

func (store *SocketStore) Register(srv *grpc.Server)

type SourceMap added in v0.13.7

type SourceMap struct {
	Module   string `field:"true" doc:"The module dependency this was declared in."`
	Filename string `field:"true" doc:"The filename from the module source."`
	Line     int    `field:"true" doc:"The line number within the filename."`
	Column   int    `field:"true" doc:"The column number within the line."`
}

func (SourceMap) Clone added in v0.13.7

func (sourceMap SourceMap) Clone() *SourceMap

func (*SourceMap) Type added in v0.13.7

func (*SourceMap) Type() *ast.Type

func (*SourceMap) TypeDescription added in v0.13.7

func (*SourceMap) TypeDescription() string

func (*SourceMap) TypeDirective added in v0.13.7

func (sourceMap *SourceMap) TypeDirective() *ast.Directive

type SourceMapID added in v0.13.7

type SourceMapID = dagql.ID[*SourceMap]

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 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 dagql.Optional[dagql.Boolean] `default:"false"`

	// Grant the process all root capabilities
	InsecureRootCapabilities dagql.Optional[dagql.Boolean] `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."`
	AsScalar    dagql.Nullable[*ScalarTypeDef]    `field:"true" doc:"If kind is SCALAR, the scalar-specific type definition. If kind is not SCALAR, this will be null."`
	AsEnum      dagql.Nullable[*EnumTypeDef]      `field:"true" doc:"If kind is ENUM, the enum-specific type definition. If kind is not ENUM, 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) WithEnum added in v0.12.0

func (typeDef *TypeDef) WithEnum(name, desc string, sourceMap *SourceMap) *TypeDef

func (*TypeDef) WithEnumValue added in v0.12.0

func (typeDef *TypeDef) WithEnumValue(name, desc string, sourceMap *SourceMap) (*TypeDef, error)

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, sourceMap *SourceMap) *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, sourceMap *SourceMap) *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, sourceMap *SourceMap) (*TypeDef, error)

func (*TypeDef) WithOptional added in v0.8.8

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

func (*TypeDef) WithScalar added in v0.11.3

func (typeDef *TypeDef) WithScalar(name string, desc string) *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