connector

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 26 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        SettingsDefinition
	Validate        func(context.Context) error
	SelfTest        func(context.Context) error
	MaxConcurrency  int
	Input           io.Reader
	Output          io.Writer
	ErrorOutput     io.Writer
}

Config declares a hosted connector child. Runtime transport and persistent installation state are supplied by airlock-host during initialization.

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 DirectorySetting

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

DirectorySetting is an explicit binding to a string setting declared with connector kind directory.

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 BoundLocalDirectory

func BoundLocalDirectory(setting DirectorySetting, options ...LocalDirectoryOptions) *LocalDirectoryProvider

BoundLocalDirectory opens a confined local filesystem root whose path is supplied by an explicitly selected directory setting at runtime.

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

func (r *Runtime) OnStart(name string, run func(context.Context) error)

OnStart registers process-local initialization for the run command. Hooks execute in registration order after settings and directory roots are bound.

func (*Runtime) Run

func (r *Runtime) Run() error

func (*Runtime) RunContext

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

RunContext runs manifest/version/validate inspection or the hosted child protocol. The run command and an empty argument list both select child mode.

type Secret

type Secret string

Secret marks a sensitive host-supplied setting. Its value is never included in connector manifests or logs by the SDK.

type Settings

type Settings[T any] struct {
	// contains filtered or unexported fields
}

Settings is a late-bound snapshot of connector settings. Get is available only while Runtime is executing a lifecycle command.

func DefineSettings

func DefineSettings[T any]() *Settings[T]

DefineSettings declares the connector's settings schema. T must be a struct whose configurable fields use connector tags.

func (*Settings[T]) Directory

func (s *Settings[T]) Directory(selectField func(*T) *string) DirectorySetting

Directory identifies one directory setting for BoundLocalDirectory.

func (*Settings[T]) Get

func (s *Settings[T]) Get() T

Get returns the settings selected for the current lifecycle command.

type SettingsDefinition

type SettingsDefinition interface {
	// contains filtered or unexported methods
}

SettingsDefinition is a sealed connector settings declaration created by DefineSettings. The interface prevents raw mutable struct pointers from being supplied to Config.

Directories

Path Synopsis
Package connectortest provides factory-first connector integration helpers.
Package connectortest provides factory-first connector integration helpers.
Package protocol defines the JSON protocols exchanged by connector children, airlock-host, and Airlock.
Package protocol defines the JSON protocols exchanged by connector children, airlock-host, and Airlock.

Jump to

Keyboard shortcuts

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