connector

package
v0.6.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

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 (c Command[In, Out]) ContractID() string

func (Command[In, Out]) Descriptor

func (c Command[In, Out]) Descriptor() protocol.CommandDescriptor

func (Command[In, Out]) Handle

func (c Command[In, Out]) Handle(runtime *Runtime, handler Handler[In, Out])

func (Command[In, Out]) Mode

func (c Command[In, Out]) Mode() protocol.CommandMode

func (Command[In, Out]) Name

func (c Command[In, Out]) Name() string

func (Command[In, Out]) Revision

func (c Command[In, Out]) Revision() int

type CommandOptions

type CommandOptions struct {
	Revision       int
	Description    string
	Mode           protocol.CommandMode
	Timeout        time.Duration
	MaxInputBytes  int64
	MaxOutputBytes int64
	Idempotent     bool
}

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

func DefineContract(id string) Contract

func (Contract) ID

func (c Contract) ID() string

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 (d Directory) ContractID() string

func (Directory) Descriptor

func (d Directory) Descriptor() protocol.DirectoryDescriptor

func (Directory) Handle

func (d Directory) Handle(runtime *Runtime, provider *LocalDirectoryProvider)

func (Directory) Name

func (d Directory) Name() string

func (Directory) Revision

func (d Directory) Revision() int

type DirectoryOptions

type DirectoryOptions struct {
	Revision    int
	Description string
	Read        bool
	Write       bool
	List        bool
}

type Handler

type Handler[In, Out any] func(context Context, input In) (Out, error)

type LocalDirectoryOptions

type LocalDirectoryOptions struct {
	MaxReadBytes  int64
	MaxWriteBytes int64
	HTTPClient    *http.Client
}

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 (*LocalDirectoryProvider) Import

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 (*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 Runtime

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

func New

func New(config Config) *Runtime

func (*Runtime) Manifest

func (r *Runtime) Manifest() protocol.Manifest

func (*Runtime) Run

func (r *Runtime) Run() error

func (*Runtime) RunContext

func (r *Runtime) RunContext(ctx context.Context, args []string) error

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

Directories

Path Synopsis
Package protocol defines the JSON protocol exchanged by connector binaries and Airlock.
Package protocol defines the JSON protocol exchanged by connector binaries and Airlock.

Jump to

Keyboard shortcuts

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