native

package
v1.234.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package native runs native plugins over mutually authenticated go-plugin gRPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDescription

func CheckDescription(expected, actual *pluginv1.DescribeResponse) error

CheckDescription rejects binaries that disagree with their installed manifest.

Types

type Handle

type Handle struct {
	Info     pluginv1.InfoClient
	Provider pluginv1.AuthProviderClient
	Identity pluginv1.AuthIdentityClient
	Commands pluginv1.CommandsClient
	// contains filtered or unexported fields
}

Handle owns a native process and its versioned service clients.

func Start

func Start(ctx context.Context, executable string, opts ...Option) (*Handle, error)

Start launches a plugin with gRPC-only transport and ephemeral mutual TLS.

func (*Handle) Close

func (h *Handle) Close()

Close terminates the process, its process group, the broker, and active callback streams.

func (*Handle) Command

func (h *Handle) Command(ctx context.Context, request *pluginv1.CommandRequest, stdout, stderr io.Writer) error

Command runs an export and validates its terminal event before accepting its exit status. Writers must come from Atmos's masked I/O layer when attached to a terminal.

func (*Handle) Invoke

func (h *Handle) Invoke(ctx context.Context, scope bridge.Invocation, run func(context.Context, *pluginv1.Invocation) error) error

Invoke grants API access for one operation and drains callbacks before returning. The operation is cancelled by its caller, by SIGINT or SIGTERM, or by the call timeout; in every case the plugin process is stopped rather than left running.

type Option

type Option func(*options)

Option configures the native process without inheriting the CLI's secrets.

func WithAPI

func WithAPI(server *bridge.Server) Option

WithAPI provides the invocation-scoped Atmos API server.

func WithCallTimeout

func WithCallTimeout(timeout time.Duration) Option

WithCallTimeout bounds every invocation made through the handle. The deadline is sent to the plugin, and the plugin process is stopped when it passes. Zero or negative disables it.

func WithDescription

func WithDescription(expected *pluginv1.DescribeResponse) Option

WithDescription binds the process handshake to statically verified metadata.

func WithDirectory

func WithDirectory(directory string) Option

WithDirectory sets the plugin process working directory.

func WithEnvironment

func WithEnvironment(environment []string) Option

WithEnvironment supplies explicitly approved process environment entries.

Jump to

Keyboard shortcuts

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