Documentation
¶
Overview ¶
Package cwtypes contains the shared type definitions used by both pkg/cliwrap (the public API) and internal/controller. Placing them in a leaf package avoids an import cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSpec = errors.New("cliwrap: invalid spec")
ErrInvalidSpec is the sentinel that SpecValidationError.Is maps to.
Functions ¶
This section is empty.
Types ¶
type ExceedAction ¶
type ExceedAction int
ExceedAction is the action taken when a resource limit is breached.
const ( ExceedWarn ExceedAction = iota ExceedThrottle ExceedKill )
type FileRotationOptions ¶
type FileRotationOptions = LogOptions
FileRotationOptions is an alias kept for backward compatibility.
type LogChunk ¶ added in v0.2.0
LogChunk is one chunk of streamed log data delivered to a follow-mode watcher.
Data is a SHARED byte slice — the producer copies it once and fans the same slice out to every matching subscriber. Receivers MUST NOT mutate Data (no in-place sort, no append that grows in place, no lowercase conversion, etc.), because any mutation would corrupt the slice for other concurrent subscribers. A receiver that needs to modify the bytes must make its own copy first.
This type lives in cwtypes (rather than pkg/cliwrap) so internal/mgmt can refer to it without creating an import cycle with pkg/cliwrap. pkg/cliwrap re-exports it as a type alias.
type LogOptions ¶
type LogOptions struct {
RingBufferBytes int
RotationDir string
RotationMaxSize int64
RotationMaxFiles int
PreserveWALOnShutdown bool
}
LogOptions controls per-process log storage.
type ResourceLimits ¶
type ResourceLimits struct {
MaxRSS uint64 // bytes
MaxCPUPercent float64 // 0-100
OnExceed ExceedAction
}
ResourceLimits express per-process resource caps.
type RestartPolicy ¶
type RestartPolicy int
RestartPolicy decides what happens after a child exits.
const ( RestartNever RestartPolicy = iota RestartOnFailure RestartAlways )
type SandboxSpec ¶
SandboxSpec selects a sandbox provider and its configuration.
type Spec ¶
type Spec struct {
ID string
Name string
Command string
Args []string
Env map[string]string
WorkDir string
Restart RestartPolicy
MaxRestarts int
RestartBackoff time.Duration
StopTimeout time.Duration
Stdin StdinMode
Sandbox *SandboxSpec
Resources ResourceLimits
LogOptions LogOptions
}
Spec is the immutable description of a managed process.
type SpecValidationError ¶
SpecValidationError describes a field-level validation failure.
func (*SpecValidationError) Error ¶
func (e *SpecValidationError) Error() string
func (*SpecValidationError) Is ¶
func (e *SpecValidationError) Is(target error) bool