Documentation
¶
Index ¶
- Constants
- func Require(items ...Requirement) protocol.Requirement
- type Command
- func (c Command[In, Out]) ContractID() string
- func (c Command[In, Out]) Descriptor() protocol.CommandDescriptor
- func (c Command[In, Out]) Handle(runtime *Runtime, handler Handler[In, Out])
- func (c Command[In, Out]) Mode() protocol.CommandMode
- func (c Command[In, Out]) Name() string
- func (c Command[In, Out]) Revision() int
- type CommandOptions
- type Config
- type Context
- type Contract
- type Directory
- type DirectoryOptions
- type Handler
- type LocalDirectoryOptions
- type LocalDirectoryProvider
- func (d *LocalDirectoryProvider) Close() error
- func (d *LocalDirectoryProvider) Delete(relative string) error
- func (d *LocalDirectoryProvider) Export(ctx context.Context, request protocol.DirectoryExportRequest) (protocol.DirectoryExportResponse, error)
- func (d *LocalDirectoryProvider) Import(ctx context.Context, request protocol.DirectoryImportRequest) (protocol.DirectoryEntry, error)
- func (d *LocalDirectoryProvider) List(relative, cursor string, limit int) (protocol.DirectoryListResponse, error)
- func (d *LocalDirectoryProvider) Move(from, to string, overwrite bool) error
- func (d *LocalDirectoryProvider) Read(relative string, offset, length int64) (protocol.DirectoryReadResponse, error)
- func (d *LocalDirectoryProvider) Stat(relative string) (protocol.DirectoryEntry, error)
- func (d *LocalDirectoryProvider) Write(relative string, body []byte, overwrite bool) (protocol.DirectoryEntry, error)
- type Operations
- type Requirement
- type Runtime
- type Secret
- type ServiceMode
Constants ¶
View Source
const ( PlatformLinuxAMD64 = protocol.PlatformLinuxAMD64 PlatformLinuxARM64 = protocol.PlatformLinuxARM64 PlatformLinuxARMv7 = protocol.PlatformLinuxARMv7 PlatformDarwinAMD64 = protocol.PlatformDarwinAMD64 PlatformDarwinARM64 = protocol.PlatformDarwinARM64 PlatformWindowsAMD64 = protocol.PlatformWindowsAMD64 PlatformWindowsARM64 = protocol.PlatformWindowsARM64 )
Variables ¶
This section is empty.
Functions ¶
func Require ¶
func Require(items ...Requirement) protocol.Requirement
Types ¶
type Command ¶
type Command[In, Out any] struct { // contains filtered or unexported fields }
func DefineCommand ¶
func DefineCommand[In, Out any](contract Contract, name string, options CommandOptions) Command[In, Out]
func (Command[In, Out]) ContractID ¶
func (Command[In, Out]) Descriptor ¶
func (c Command[In, Out]) Descriptor() protocol.CommandDescriptor
func (Command[In, Out]) Mode ¶
func (c Command[In, Out]) Mode() protocol.CommandMode
type CommandOptions ¶
type Config ¶
type Config struct {
Kind string
Contract Contract
Name string
Description string
ArtifactVersion string
Targets []string
Settings any
Validate func(context.Context) error
SelfTest func(context.Context) error
StateDirectory string
InstallationID string
HTTPClient *http.Client
Operations Operations
ServiceMode ServiceMode
HeartbeatInterval time.Duration
MaxConcurrency int
AllowInsecureHTTP bool
Input io.Reader
Output io.Writer
ErrorOutput io.Writer
}
type Context ¶
type Context interface {
Deadline() (time.Time, bool)
Done() <-chan struct{}
Err() error
Value(key any) any
Progress(phase, message string, completed, total int64) error
JobID() string
IdempotencyID() string
}
Context is the command execution context. It exposes progress only for job commands and otherwise behaves as a standard context.Context.
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func DefineContract ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
func DefineDirectory ¶
func DefineDirectory(contract Contract, name string, options DirectoryOptions) Directory
func (Directory) ContractID ¶
func (Directory) Descriptor ¶
func (d Directory) Descriptor() protocol.DirectoryDescriptor
func (Directory) Handle ¶
func (d Directory) Handle(runtime *Runtime, provider *LocalDirectoryProvider)
type DirectoryOptions ¶
type LocalDirectoryOptions ¶
type LocalDirectoryProvider ¶
type LocalDirectoryProvider struct {
// contains filtered or unexported fields
}
func LocalDirectory ¶
func LocalDirectory(rootPath string, options ...LocalDirectoryOptions) *LocalDirectoryProvider
LocalDirectory opens a confined local filesystem root. The returned value must be registered with a Directory definition and is closed by Runtime.
func (*LocalDirectoryProvider) Close ¶
func (d *LocalDirectoryProvider) Close() error
func (*LocalDirectoryProvider) Delete ¶
func (d *LocalDirectoryProvider) Delete(relative string) error
func (*LocalDirectoryProvider) Export ¶
func (d *LocalDirectoryProvider) Export(ctx context.Context, request protocol.DirectoryExportRequest) (protocol.DirectoryExportResponse, error)
func (*LocalDirectoryProvider) Import ¶
func (d *LocalDirectoryProvider) Import(ctx context.Context, request protocol.DirectoryImportRequest) (protocol.DirectoryEntry, error)
func (*LocalDirectoryProvider) List ¶
func (d *LocalDirectoryProvider) List(relative, cursor string, limit int) (protocol.DirectoryListResponse, error)
func (*LocalDirectoryProvider) Move ¶
func (d *LocalDirectoryProvider) Move(from, to string, overwrite bool) error
func (*LocalDirectoryProvider) Read ¶
func (d *LocalDirectoryProvider) Read(relative string, offset, length int64) (protocol.DirectoryReadResponse, error)
func (*LocalDirectoryProvider) Stat ¶
func (d *LocalDirectoryProvider) Stat(relative string) (protocol.DirectoryEntry, error)
func (*LocalDirectoryProvider) Write ¶
func (d *LocalDirectoryProvider) Write(relative string, body []byte, overwrite bool) (protocol.DirectoryEntry, error)
type Operations ¶
type Operations interface {
Execute(context.Context, string, ...string) ([]byte, error)
Executable() (string, error)
}
Operations isolates process execution for lifecycle tests.
type Requirement ¶
type Requirement interface {
// contains filtered or unexported methods
}
type Secret ¶
type Secret string
Secret is a locally stored sensitive setting. Configure accepts it only from a file or standard input so it does not enter shell history or process lists.
type ServiceMode ¶
type ServiceMode string
const ( ServiceSystem ServiceMode = "system" ServiceUser ServiceMode = "user" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.