Documentation
¶
Overview ¶
Package plugin is the Go entry point to the ext plugin engine. Hosts use canonical C sessions: linked C with ext_cengine and cgo, or the shared library through purego otherwise. No-cgo hosts require that library at runtime. Guest authoring remains language-native in the default build.
The data model (descriptors, requests, responses, errors, backends) is defined in pkg/ext-go/engine and re-exported here so a program imports this package alone. Engine-only APIs (Host, Streams, Instances, NewProcess and the like) need the C engine build.
Index ¶
- Constants
- Variables
- func ArtifactDigest(root, path string, tree bool) (string, error)
- func CheckSchema(s schema.Schema, value json.RawMessage) error
- func DirectoryDigest(root string) (string, error)
- func NewRegistry(identity plugin.Identity) (*author.Registry, error)
- func ResolveRoute(hosts, guests []plugin.BackendProfile, bridges []interop.Bridge, ...) (interop.Route, error)
- func SHA256(input []byte) [32]byte
- func StoreDigest(root, id string) (string, error)
- func TrustRecord(path, scope, id, digest string) error
- func TrustRevoke(path, scope, id string) error
- func TrustStateOf(path, scope, id, digest string) (hosttrust.State, error)
- func ValidateSchema(s schema.Schema) error
- type AdapterInvocation
- type Backend
- type BackendProfile
- type Contract
- type ContractRef
- type Descriptor
- type Endpoint
- type Event
- type Guest
- type GuestOptions
- type GuestRegistry
- func (r *GuestRegistry) OpenProcess(ctx context.Context, d plugin.Descriptor, launch LaunchOptions, ...) (*Session, error)
- func (r *GuestRegistry) Register(ref plugin.ContractRef, s *Session) error
- func (r *GuestRegistry) Route(from plugin.ContractRef, op string, to plugin.ContractRef, target string) error
- func (r *GuestRegistry) Unregister(ref plugin.ContractRef) error
- type Handler
- type Identity
- type LaunchOptions
- type LayeredPackageStore
- func (l *LayeredPackageStore) Close()
- func (l *LayeredPackageStore) List() ([]PackageRecord, error)
- func (l *LayeredPackageStore) ListUnverified() ([]PackageRecord, []PackageCheck, error)
- func (l *LayeredPackageStore) Load(id string) (PackageRecord, error)
- func (l *LayeredPackageStore) Roots() []string
- func (l *LayeredPackageStore) Verify() ([]PackageCheck, error)
- type Observer
- type Operation
- type Options
- type PackageCheck
- type PackageEntrypoint
- type PackageRecord
- type PackageStore
- func (s *PackageStore) Close()
- func (s *PackageStore) IDs() ([]string, error)
- func (s *PackageStore) Install(source string, preserve bool) ([]byte, error)
- func (s *PackageStore) InstallArchive(archive, sum, id string, preserve bool) ([]byte, error)
- func (s *PackageStore) List() ([]PackageRecord, error)
- func (s *PackageStore) ListUnverified() ([]PackageRecord, []PackageCheck, error)
- func (s *PackageStore) Load(id string) ([]byte, error)
- func (s *PackageStore) Receipt(id string) ([]byte, error)
- func (s *PackageStore) Remove(id string) error
- func (s *PackageStore) Replace(source string, preserve bool) ([]byte, error)
- func (s *PackageStore) ResolveEntrypoint(id, contract, version, protocol, digest string) (PackageEntrypoint, error)
- func (s *PackageStore) Upgrade(source string, preserve bool) ([]byte, error)
- func (s *PackageStore) Verify() ([]PackageCheck, error)
- type PackageStoreLimits
- type ProcessOptions
- type RemoteError
- type Request
- type Requirement
- type Response
- type Session
- type State
Constants ¶
const ( APIVersion = plugin.APIVersion AdapterAPIVersion = plugin.AdapterAPIVersion AdapterContractName = plugin.AdapterContractName BoundaryInProcess = plugin.BoundaryInProcess BoundaryProcess = plugin.BoundaryProcess BoundaryConfined = plugin.BoundaryConfined BoundaryRuntime = plugin.BoundaryRuntime BoundaryContainer = plugin.BoundaryContainer BoundaryKernel = plugin.BoundaryKernel DefaultTimeout = plugin.DefaultTimeout MaxFrameBytes = plugin.MaxFrameBytes MaxRetryAfterMilliseconds = plugin.MaxRetryAfterMilliseconds StateClosed = plugin.StateClosed StateDraining = plugin.StateDraining StateFailed = plugin.StateFailed StateReady = plugin.StateReady )
const CEngine = true
CEngine reports whether this build runs on the shared C engine.
Variables ¶
var ( ErrAmbiguous = plugin.ErrAmbiguous ErrClosed = plugin.ErrClosed ErrDenied = plugin.ErrDenied ErrDraining = plugin.ErrDraining ErrInvalid = plugin.ErrInvalid ErrMismatch = plugin.ErrMismatch ErrNotFound = plugin.ErrNotFound ErrUnsupported = plugin.ErrUnsupported )
Error classes. They are the same values as the contract package's, so errors.Is works across both packages.
var ( AdapterDescriptor = plugin.AdapterDescriptor ValidBoundary = plugin.ValidBoundary CheckRequirements = plugin.CheckRequirements Decode = plugin.Decode MatchHandshake = plugin.MatchHandshake Method = plugin.Method NegotiateProtocol = plugin.NegotiateProtocol ParseAdapterInvocation = plugin.ParseAdapterInvocation PortablePath = plugin.PortablePath Select = plugin.Select TreeDigest = plugin.TreeDigest ValidateRequest = plugin.ValidateRequest )
Contract helpers, re-exported from pkg/ext-go/engine.
var ErrPackageExists = errors.New("plugin package already installed")
ErrPackageExists reports an install over an existing package.
var ErrRegistryExists = errors.New("already registered")
ErrRegistryExists is returned by a GuestRegistry for a contract that is already registered, or a reverse operation that is already routed.
Functions ¶
func ArtifactDigest ¶
ArtifactDigest returns the digest of one artifact under root, addressed by a portable relative path, never following symbolic links: the SHA-256 of a file, or for a tree the directory digest of a directory that holds at least one file.
func CheckSchema ¶
func CheckSchema(s schema.Schema, value json.RawMessage) error
func DirectoryDigest ¶
DirectoryDigest is the digest of every regular file under root.
func NewRegistry ¶
NewRegistry returns a typed authoring registry.
func ResolveRoute ¶
func ResolveRoute(hosts, guests []plugin.BackendProfile, bridges []interop.Bridge, w interop.Requirements) (interop.Route, error)
func StoreDigest ¶
func TrustRecord ¶
func TrustRevoke ¶
func ValidateSchema ¶
Types ¶
type AdapterInvocation ¶
type AdapterInvocation = plugin.AdapterInvocation
Data model, re-exported from pkg/ext-go/engine.
type BackendProfile ¶
type BackendProfile = plugin.BackendProfile
Data model, re-exported from pkg/ext-go/engine.
type ContractRef ¶
type ContractRef = plugin.ContractRef
Data model, re-exported from pkg/ext-go/engine.
type Descriptor ¶
type Descriptor = plugin.Descriptor
Data model, re-exported from pkg/ext-go/engine.
type Guest ¶
Guest serves a descriptor and handler. Destroy is a no-op in this build.
func GuestFromRegistry ¶
GuestFromRegistry builds a guest from a registry's descriptor and handlers.
func NewGuest ¶
func NewGuest(d plugin.Descriptor, options plugin.GuestOptions) (*Guest, error)
type GuestOptions ¶
type GuestOptions = plugin.GuestOptions
Data model, re-exported from pkg/ext-go/engine.
type GuestRegistry ¶
type GuestRegistry struct {
// contains filtered or unexported fields
}
GuestRegistry routes reverse calls through the canonical C registry.
func NewGuestRegistry ¶
func NewGuestRegistry() *GuestRegistry
func (*GuestRegistry) OpenProcess ¶
func (r *GuestRegistry) OpenProcess(ctx context.Context, d plugin.Descriptor, launch LaunchOptions, options plugin.Options) (*Session, error)
func (*GuestRegistry) Register ¶
func (r *GuestRegistry) Register(ref plugin.ContractRef, s *Session) error
func (*GuestRegistry) Route ¶
func (r *GuestRegistry) Route(from plugin.ContractRef, op string, to plugin.ContractRef, target string) error
func (*GuestRegistry) Unregister ¶
func (r *GuestRegistry) Unregister(ref plugin.ContractRef) error
type LaunchOptions ¶
type LaunchOptions struct {
ProcessOptions
// Directory is the child's working directory; empty inherits the host's.
// It must be absolute. The C engine needs a platform with a spawn working
// directory (macOS, glibc 2.29 or later, Windows).
Directory string
// StderrBytes bounds the retained stderr; zero retains 4096 bytes.
StderrBytes int
}
LaunchOptions starts a reviewed executable the way an installed package is run: like ProcessOptions, but with a working directory, bounded capture of the child's stderr and a scrubbed base environment of PATH. The environment entries are added to it (an entry named PATH replaces it). Executable must be the absolute path of a regular file.
type LayeredPackageStore ¶
type LayeredPackageStore struct {
// contains filtered or unexported fields
}
LayeredPackageStore is the C engine's read-only view of ordered package roots.
func OpenLayeredPackageStore ¶
func OpenLayeredPackageStore(roots []string, limits PackageStoreLimits) (*LayeredPackageStore, error)
func OpenLayeredPackageStoreWithLayout ¶
func OpenLayeredPackageStoreWithLayout(roots []string, limits PackageStoreLimits, layout storelayout.Layout) (*LayeredPackageStore, error)
OpenLayeredPackageStoreWithLayout opens a layered view using the supplied layout.
func (*LayeredPackageStore) Close ¶
func (l *LayeredPackageStore) Close()
func (*LayeredPackageStore) List ¶
func (l *LayeredPackageStore) List() ([]PackageRecord, error)
func (*LayeredPackageStore) ListUnverified ¶
func (l *LayeredPackageStore) ListUnverified() ([]PackageRecord, []PackageCheck, error)
func (*LayeredPackageStore) Load ¶
func (l *LayeredPackageStore) Load(id string) (PackageRecord, error)
func (*LayeredPackageStore) Roots ¶
func (l *LayeredPackageStore) Roots() []string
func (*LayeredPackageStore) Verify ¶
func (l *LayeredPackageStore) Verify() ([]PackageCheck, error)
type PackageCheck ¶
PackageCheck reports whether an entry below a package root verifies.
type PackageEntrypoint ¶
type PackageEntrypoint struct {
Name string `json:"name"`
Artifact string `json:"artifact"`
Path string `json:"path"`
Digest string `json:"digest"`
}
PackageEntrypoint is the verified executable selected by contract and protocol.
type PackageRecord ¶
PackageRecord identifies a verified package, its layer and its manifest bytes.
type PackageStore ¶
type PackageStore struct {
// contains filtered or unexported fields
}
PackageStore delegates storage, verification and lifecycle to the shared C engine.
func OpenPackageStore ¶
func OpenPackageStore(root string, limits PackageStoreLimits) (*PackageStore, error)
func OpenPackageStoreWithLayout ¶
func OpenPackageStoreWithLayout(root string, limits PackageStoreLimits, layout storelayout.Layout) (*PackageStore, error)
OpenPackageStoreWithLayout opens the native store with a caller-selected layout.
func (*PackageStore) Close ¶
func (s *PackageStore) Close()
func (*PackageStore) IDs ¶
func (s *PackageStore) IDs() ([]string, error)
func (*PackageStore) Install ¶
func (s *PackageStore) Install(source string, preserve bool) ([]byte, error)
func (*PackageStore) InstallArchive ¶
func (s *PackageStore) InstallArchive(archive, sum, id string, preserve bool) ([]byte, error)
func (*PackageStore) List ¶
func (s *PackageStore) List() ([]PackageRecord, error)
func (*PackageStore) ListUnverified ¶
func (s *PackageStore) ListUnverified() ([]PackageRecord, []PackageCheck, error)
func (*PackageStore) Remove ¶
func (s *PackageStore) Remove(id string) error
func (*PackageStore) Replace ¶
func (s *PackageStore) Replace(source string, preserve bool) ([]byte, error)
func (*PackageStore) ResolveEntrypoint ¶
func (s *PackageStore) ResolveEntrypoint(id, contract, version, protocol, digest string) (PackageEntrypoint, error)
func (*PackageStore) Upgrade ¶
func (s *PackageStore) Upgrade(source string, preserve bool) ([]byte, error)
func (*PackageStore) Verify ¶
func (s *PackageStore) Verify() ([]PackageCheck, error)
type PackageStoreLimits ¶
type PackageStoreLimits struct {
MaxArtifactBytes int64
MaxTreeFiles int
MaxTreeBytes int64
MaxArchiveBytes int64
}
PackageStoreLimits bounds artifacts, trees and archives; zero selects C defaults.
type ProcessOptions ¶
ProcessOptions launches a reviewed executable directly, without a shell. Environment is explicit and never inherits the embedding process environment.
type RemoteError ¶
type RemoteError = plugin.RemoteError
Data model, re-exported from pkg/ext-go/engine.
type Requirement ¶
type Requirement = plugin.Requirement
Data model, re-exported from pkg/ext-go/engine.
type Session ¶
Session is the canonical C host reached through the shared-library driver.
func OpenProcess ¶
func OpenProcess(ctx context.Context, d plugin.Descriptor, launch LaunchOptions, options plugin.Options) (*Session, error)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package host opens an installed package as a running plugin and calls it by dotted method name.
|
Package host opens an installed package as a running plugin and calls it by dotted method name. |
|
commandscope
Package commandscope binds C-owned dependency snapshots to a local shell-call broker.
|
Package commandscope binds C-owned dependency snapshots to a local shell-call broker. |
|
store
Package store installs, upgrades, lists and removes reviewed packages under a caller-supplied root.
|
Package store installs, upgrades, lists and removes reviewed packages under a caller-supplied root. |
|
Package packages validates, resolves and verifies ext.io/v1 manifests (packagekit) with the plugin engine: on the shared C engine when built with the ext_cengine tag and cgo, otherwise in pure Go.
|
Package packages validates, resolves and verifies ext.io/v1 manifests (packagekit) with the plugin engine: on the shared C engine when built with the ext_cengine tag and cgo, otherwise in pure Go. |