Documentation
¶
Overview ¶
Package sysctl provides kernel parameter management via /etc/sysctl.d/. It writes conf files directly and tracks state in the file-state KV for SHA-based idempotency and drift detection.
Index ¶
- type CreateResult
- type Darwin
- func (d *Darwin) Create(_ context.Context, _ Entry) (*CreateResult, error)
- func (d *Darwin) Delete(_ context.Context, _ string) (*DeleteResult, error)
- func (d *Darwin) Get(_ context.Context, _ string) (*Entry, error)
- func (d *Darwin) List(_ context.Context) ([]Entry, error)
- func (d *Darwin) Update(_ context.Context, _ Entry) (*UpdateResult, error)
- type Debian
- func (d *Debian) Create(ctx context.Context, entry Entry) (*CreateResult, error)
- func (d *Debian) Delete(ctx context.Context, key string) (*DeleteResult, error)
- func (d *Debian) Get(ctx context.Context, key string) (*Entry, error)
- func (d *Debian) List(ctx context.Context) ([]Entry, error)
- func (d *Debian) Update(ctx context.Context, entry Entry) (*UpdateResult, error)
- type DeleteResult
- type Entry
- type Linux
- func (l *Linux) Create(_ context.Context, _ Entry) (*CreateResult, error)
- func (l *Linux) Delete(_ context.Context, _ string) (*DeleteResult, error)
- func (l *Linux) Get(_ context.Context, _ string) (*Entry, error)
- func (l *Linux) List(_ context.Context) ([]Entry, error)
- func (l *Linux) Update(_ context.Context, _ Entry) (*UpdateResult, error)
- type Provider
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateResult ¶
type CreateResult struct {
Key string `json:"key"`
Changed bool `json:"changed"`
Error string `json:"error,omitempty"`
}
CreateResult represents the outcome of a sysctl create operation.
type Darwin ¶
type Darwin struct{}
Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as sysctl.d is not available on macOS.
func NewDarwinProvider ¶
func NewDarwinProvider() *Darwin
NewDarwinProvider factory to create a new Darwin instance.
type Debian ¶
type Debian struct {
provider.FactsAware
// contains filtered or unexported fields
}
Debian implements the Provider interface for Debian-family systems. It writes sysctl conf files directly to /etc/sysctl.d/ and tracks state in the file-state KV for idempotency. Unlike the cron meta-provider, sysctl generates trivial content inline rather than fetching from the NATS Object Store.
func NewDebianProvider ¶
func NewDebianProvider( logger *slog.Logger, fs avfs.VFS, stateKV jetstream.KeyValue, execManager exec.Manager, hostname string, ) *Debian
NewDebianProvider factory to create a new Debian instance.
func (*Debian) Create ¶
Create deploys a new sysctl conf file and applies it. Idempotent: returns Changed: false if the key is already managed.
type DeleteResult ¶
type DeleteResult struct {
Key string `json:"key"`
Changed bool `json:"changed"`
Error string `json:"error,omitempty"`
}
DeleteResult represents the outcome of a sysctl delete operation.
type Linux ¶
type Linux struct{}
Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.
func NewLinuxProvider ¶
func NewLinuxProvider() *Linux
NewLinuxProvider factory to create a new Linux instance.
type Provider ¶
type Provider interface {
// List returns all osapi-managed sysctl entries with current runtime values.
List(ctx context.Context) ([]Entry, error)
// Get returns a single sysctl entry by key with current runtime value.
Get(ctx context.Context, key string) (*Entry, error)
// Create deploys a new sysctl conf file and applies it. Idempotent: returns Changed: false if already managed.
Create(ctx context.Context, entry Entry) (*CreateResult, error)
// Update redeploys an existing sysctl conf file. Fails if not managed.
Update(ctx context.Context, entry Entry) (*UpdateResult, error)
// Delete removes a managed sysctl conf file and reloads defaults.
Delete(ctx context.Context, key string) (*DeleteResult, error)
}
Provider implements the methods to manage sysctl entries.
type UpdateResult ¶
type UpdateResult struct {
Key string `json:"key"`
Changed bool `json:"changed"`
Error string `json:"error,omitempty"`
}
UpdateResult represents the outcome of a sysctl update operation.