plugin

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 31 Imported by: 0 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.

Documentation

Overview

Package plugin is the adapter that runs an external provider executable (spec 8.5, providers delta A) behind the Provider interface: one pinned process per bitc process and type, NDJSON on its stdin and stdout, secrets on fd 3. Every rail stays in core; a plugin is an API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecShim

func ExecShim(args []string) int

ExecShim is the body of `bitc __plugin-exec <path>` (providers delta A.2.4): Go's SysProcAttr has no PR_SET_NO_NEW_PRIVS and no execveat, so the adapter starts bitc's own binary here with the open, hashed plugin file as fd 4. The shim sets no-new-privs on this thread (inherited across the exec), marks fd 4 close-on-exec, and execs that same descriptor with execveat(AT_EMPTY_PATH): the bytes that were hashed are the bytes that run. It returns only on failure; the environment it was started with is the plugin's environment.

Types

type Provider

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

Provider adapts one plugin type to provider.Provider. Every rail stays in core (A.7): the adapter only speaks the protocol, validates what the plugin says, and prices from the host's config.

func New

func New(core *config.Provider, eff *config.Effective) (*Provider, error)

New builds the adapter; it spawns nothing until the first call (A.3.1).

func (*Provider) Close

func (p *Provider) Close() error

Close stops the plugin: stdin closed, then SIGTERM, then SIGKILL (A.3.5).

func (*Provider) DoctorLine

func (p *Provider) DoctorLine() string

DoctorLine is the detail of `ok plugin-<type>:` in doctor (A.8): the protocol, the plugin's own version and the first 12 characters of the pinned sha256.

func (*Provider) Estimate

func (p *Provider) Estimate(ctx context.Context, j *provider.JobSpec) (config.Micros, error)

Estimate is max(host price x (E - now), the plugin's figure) (A.7.1).

func (*Provider) Fetch

func (*Provider) Info

func (p *Provider) Info() provider.Info

func (*Provider) Launch

func (p *Provider) Launch(ctx context.Context, j *provider.JobSpec) (provider.Handle, error)

Launch sends the launch request and classifies the outcome (A.5.4, A.5.5, A.6). Once the frame is written, only a well-formed result or a definite classified error is a definite outcome; everything else is an ambiguous launch, read as attached, reaped by name and 75.

func (*Provider) List

func (p *Provider) List(ctx context.Context, prefixes []string) ([]provider.Resource, error)

func (*Provider) Output

func (p *Provider) Output(ctx context.Context, h provider.Handle, st provider.Stream, off int64, w io.Writer) error

func (*Provider) Owner

func (p *Provider) Owner(ctx context.Context, id string) (string, error)

func (*Provider) Preflight

func (p *Provider) Preflight(ctx context.Context, j *provider.JobSpec) error

func (*Provider) Spend

func (p *Provider) Spend(ctx context.Context) (config.Micros, error)

func (*Provider) Start

func (p *Provider) Start(_ context.Context, rt provider.Runtime) error

Start spawns the plugin and runs hello and configure (A.4). It is idempotent; a config-class failure is *provider.ErrConfig (78).

func (*Provider) Teardown

func (p *Provider) Teardown(ctx context.Context, id string) error

func (*Provider) Watch

Watch follows the plugin's log events, turning the markers that carry the job's nonce into phases and setup lines exactly as a built-in does (A.5.2). A plugin's own phase event can only report booting or lost.

Directories

Path Synopsis
Package pin checks and opens a pinned provider plugin (providers delta A.2): an absolute path and a sha256, a regular ELF file owned by the user or root, no group or world write on it or any parent, no setuid or setgid bit, no file capabilities.
Package pin checks and opens a pinned provider plugin (providers delta A.2): an absolute path and a sha256, a regular ELF file owned by the user or root, no group or world write on it or any parent, no setuid or setgid bit, no file capabilities.
Command stubplugin is a minimal provider plugin for bitc's own tests (providers delta P.1): a protocol-1 peer with fault modes, driven by the `fault` key of its [providers.<t>] section (or STUB_HELLO_FAULT for faults before configure).
Command stubplugin is a minimal provider plugin for bitc's own tests (providers delta P.1): a protocol-1 peer with fault modes, driven by the `fault` key of its [providers.<t>] section (or STUB_HELLO_FAULT for faults before configure).

Jump to

Keyboard shortcuts

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