process

package
v3.0.35 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxArguments           = 256
	MaxArgumentBytes       = 64 << 10
	MaxEnvironmentEntries  = 128
	MaxEnvironmentBytes    = 64 << 10
	MaxOutputBufferBytes   = 16 << 20
	MaxRuntimeMilliseconds = 24 * 60 * 60 * 1000
	MaxClientKeyBytes      = 256
	MaxOwnerFieldBytes     = 256
	MaxStdinBytes          = 16 << 20
)

Variables

View Source
var (
	ErrInvalidRequest    = errors.New("PROCESS_INVALID_REQUEST")
	ErrPermissionDenied  = errors.New("PROCESS_PERMISSION_DENIED")
	ErrNotFound          = errors.New("PROCESS_NOT_FOUND")
	ErrLaunchConflict    = errors.New("PROCESS_LAUNCH_CONFLICT")
	ErrSecretUnavailable = errors.New("PROCESS_SECRET_UNAVAILABLE")
	ErrRevoked           = errors.New("PROCESS_OWNER_REVOKED")
	ErrClosed            = errors.New("PROCESS_SUPERVISOR_CLOSED")
)

Functions

This section is empty.

Types

type ExitResult

type ExitResult struct {
	ExitCode          *int   `json:"exit_code,omitempty"`
	TerminationReason string `json:"termination_reason,omitempty"`
}

type Options

type Options struct {
	GracePeriod     time.Duration
	Secrets         SecretResolver
	BaseEnvironment []string
	Permission      func(context.Context, Owner) error
}

type Owner

type Owner struct {
	PluginInstanceID string
	UserScope        string
	EnvironmentScope string
	SessionScope     string
	ChannelScope     string
}

func (Owner) ValidForHost

func (o Owner) ValidForHost() bool

type ReadRequest

type ReadRequest struct {
	Cursor   uint64 `json:"cursor,omitempty"`
	MaxBytes int    `json:"max_bytes"`
}

type ReadResult

type ReadResult struct {
	Data         []byte `json:"data"`
	Cursor       uint64 `json:"cursor"`
	EOF          bool   `json:"eof"`
	ProcessExit  bool   `json:"process_exit"`
	StreamGap    bool   `json:"stream_gap"`
	DroppedBytes uint64 `json:"dropped_bytes,omitempty"`
}

type ResourceLimits

type ResourceLimits struct {
	OutputBufferBytes int `json:"output_buffer_bytes,omitempty"`
	MaxRuntimeMS      int `json:"max_runtime_ms,omitempty"`
}

type SecretResolver

type SecretResolver func(context.Context, Owner, string) (string, error)

type StartRequest

type StartRequest struct {
	Program             string            `json:"program"`
	Argv                []string          `json:"argv,omitempty"`
	Cwd                 string            `json:"cwd,omitempty"`
	Environment         map[string]string `json:"environment,omitempty"`
	EnvironmentRemovals []string          `json:"environment_removals,omitempty"`
	SecretReferences    map[string]string `json:"secret_references,omitempty"`
	ClientKey           string            `json:"client_key"`
	Limits              ResourceLimits    `json:"resource_limits,omitempty"`
}

type Status

type Status struct {
	Handle            string `json:"handle"`
	ClientKey         string `json:"client_key"`
	State             string `json:"state"`
	ExitCode          *int   `json:"exit_code,omitempty"`
	TerminationReason string `json:"termination_reason,omitempty"`
}

type Stream

type Stream string
const (
	Stdout Stream = "stdout"
	Stderr Stream = "stderr"
)

type Supervisor

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

func NewSupervisor

func NewSupervisor(options Options) (*Supervisor, error)

func (*Supervisor) Attach

func (s *Supervisor) Attach(owner Owner, clientKey string) (Status, error)

func (*Supervisor) Close

func (s *Supervisor) Close(ctx context.Context, owner Owner, handle string) error

func (*Supervisor) CloseStdin

func (s *Supervisor) CloseStdin(owner Owner, handle string) error

func (*Supervisor) GetStatus

func (s *Supervisor) GetStatus(owner Owner, handle string) (Status, error)

func (*Supervisor) Kill

func (s *Supervisor) Kill(owner Owner, handle string) error

func (*Supervisor) List added in v3.0.35

func (s *Supervisor) List(owner Owner) ([]Status, error)

List returns the current process sessions owned by the exact plugin, user, environment, and optional session/channel scope.

func (*Supervisor) Read

func (s *Supervisor) Read(ctx context.Context, owner Owner, handle string, stream Stream, request ReadRequest) (ReadResult, error)

func (*Supervisor) ReadStderr added in v3.0.35

func (s *Supervisor) ReadStderr(ctx context.Context, owner Owner, handle string, request ReadRequest) (ReadResult, error)

func (*Supervisor) ReadStdout added in v3.0.35

func (s *Supervisor) ReadStdout(ctx context.Context, owner Owner, handle string, request ReadRequest) (ReadResult, error)

func (*Supervisor) RestorePlugin

func (s *Supervisor) RestorePlugin(pluginInstanceID, environmentScope string) error

func (*Supervisor) Revoke

func (s *Supervisor) Revoke(ctx context.Context, owner Owner) error

func (*Supervisor) RevokePlugin

func (s *Supervisor) RevokePlugin(ctx context.Context, pluginInstanceID, environmentScope string) error

func (*Supervisor) Shutdown

func (s *Supervisor) Shutdown(ctx context.Context) error

func (*Supervisor) Start

func (s *Supervisor) Start(ctx context.Context, owner Owner, request StartRequest) (Status, error)

func (*Supervisor) Terminate

func (s *Supervisor) Terminate(ctx context.Context, owner Owner, handle string) error

func (*Supervisor) Wait

func (s *Supervisor) Wait(ctx context.Context, owner Owner, handle string) (ExitResult, error)

func (*Supervisor) WriteStdin

func (s *Supervisor) WriteStdin(ctx context.Context, owner Owner, handle string, data []byte) (int, error)

Jump to

Keyboard shortcuts

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