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 ¶
- func ExecShim(args []string) int
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) DoctorLine() string
- func (p *Provider) Estimate(ctx context.Context, j *provider.JobSpec) (config.Micros, error)
- func (p *Provider) Fetch(ctx context.Context, h provider.Handle, a provider.ArtifactSpec, w io.Writer) error
- func (p *Provider) Info() provider.Info
- func (p *Provider) Launch(ctx context.Context, j *provider.JobSpec) (provider.Handle, error)
- func (p *Provider) List(ctx context.Context, prefixes []string) ([]provider.Resource, error)
- func (p *Provider) Output(ctx context.Context, h provider.Handle, st provider.Stream, off int64, ...) error
- func (p *Provider) Owner(ctx context.Context, id string) (string, error)
- func (p *Provider) Preflight(ctx context.Context, j *provider.JobSpec) error
- func (p *Provider) Spend(ctx context.Context) (config.Micros, error)
- func (p *Provider) Start(_ context.Context, rt provider.Runtime) error
- func (p *Provider) Teardown(ctx context.Context, id string) error
- func (p *Provider) Watch(ctx context.Context, h provider.Handle, out provider.Sink) (provider.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecShim ¶
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 (*Provider) DoctorLine ¶
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) Launch ¶
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) Start ¶
Start spawns the plugin and runs hello and configure (A.4). It is idempotent; a config-class failure is *provider.ErrConfig (78).
func (*Provider) Watch ¶
func (p *Provider) Watch(ctx context.Context, h provider.Handle, out provider.Sink) (provider.Result, error)
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.
Source Files
¶
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). |