plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Native Go plugin host

This package binds lib/plugin through its described library interface. C owns session admission, lifecycle, reverse-call routing and registry behavior. Go supplies application policies and optional engine.Backend transports. It does not fall back to the reference Go host.

Use Default() for the configured engine, or open a shared library with cengine/library.Open and pass it to Bind. Library.Open accepts the shared engine.Options model and a Go transport; Library.OpenProcess lets C launch the guest. Close sessions and registries when finished. Installed packages use cengine/plugin/host. Library.Objects() exposes the described C library interface, including package-store and trust operations.

The default loader checks EXT_PLUGIN_LIBRARY, an embedded library provider, and ext-lib beside the executable. A no-cgo Go build still needs the native shared library at runtime.

Run the native host and standalone command acceptance gate from the repository:

bash scripts/package-acceptance.sh

The tests require a built lib/plugin library; the gate supplies it and fails if required host checks are skipped.

Documentation

Overview

Package plugin adapts Go transports and policies to the canonical C host.

Index

Constants

This section is empty.

Variables

View Source
var ErrRegistryExists = errors.New("plugin registry entry already exists")

Functions

This section is empty.

Types

type Launch

type Launch struct {
	Executable  string
	Arguments   []string
	Environment []string
	Directory   string
	StderrBytes int
}

Launch is a child process the engine starts.

type Library

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

func Bind

func Bind(native *library.Library) (*Library, error)

func Default

func Default() (*Library, error)

Default opens an explicitly configured, embedded, or executable-bundled C engine. Missing libraries are errors; there is no legacy Go host fallback.

func (*Library) NewRegistry

func (l *Library) NewRegistry() (*Registry, error)

func (*Library) Objects

func (lib *Library) Objects() *library.Described

Objects exposes the canonical C library interface for operations beyond sessions.

func (*Library) Open

func (lib *Library) Open(ctx context.Context, d engine.Descriptor, o engine.Options) (*Session, error)

func (*Library) OpenProcess

func (lib *Library) OpenProcess(ctx context.Context, d engine.Descriptor, launch Launch, options engine.Options) (*Session, error)

type Registry

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

Registry owns native reverse-call routes. C performs admission and cycle detection across every attached host, including concurrent call chains.

func (*Registry) Close

func (r *Registry) Close() error

func (*Registry) OpenProcess

func (r *Registry) OpenProcess(ctx context.Context, d engine.Descriptor, launch Launch, options engine.Options) (*Session, error)

func (*Registry) Register

func (r *Registry) Register(ref engine.ContractRef, s *Session) error

func (*Registry) Route

func (r *Registry) Route(from engine.ContractRef, operation string, to engine.ContractRef, targetOperation string) error

func (*Registry) Unregister

func (r *Registry) Unregister(ref engine.ContractRef) error

type Session

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

func (*Session) Abort

func (s *Session) Abort() error

func (*Session) AdmitReverse

func (s *Session) AdmitReverse(frame engine.ReverseRequestFrame) (func() engine.ReverseResult, *engine.ReverseResult, error)

func (*Session) Call

func (s *Session) Call(ctx context.Context, contract engine.ContractRef, operation string, payload json.RawMessage) (json.RawMessage, error)

func (*Session) CallProgress

func (s *Session) CallProgress(ctx context.Context, contract engine.ContractRef, operation string, payload json.RawMessage, onProgress func(engine.Progress), options ...engine.CallOptions) (json.RawMessage, error)

func (*Session) Close

func (s *Session) Close(ctx context.Context) error

func (*Session) Descriptor

func (s *Session) Descriptor() engine.Descriptor

func (*Session) Done

func (s *Session) Done() <-chan struct{}

func (*Session) State

func (s *Session) State() engine.State

func (*Session) Stderr

func (s *Session) Stderr() string

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.

Jump to

Keyboard shortcuts

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