{"modulePath":"github.com/osapi-io/osapi","version":"v0.2.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sysctl\n\nPackage 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.\n\n## Types\n\n```go\ntype CreateResult struct {\n\tKey     string `json:\"key\"`\n\tChanged bool   `json:\"changed\"`\n\tError   string `json:\"error,omitempty\"`\n}\n```\nCreateResult represents the outcome of a sysctl create operation.\n\n```go\ntype Darwin struct{}\n```\nDarwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as sysctl.d is not available on macOS.\n\n```go\nfunc NewDarwinProvider() *Darwin\n```\nNewDarwinProvider factory to create a new Darwin instance.\n\n```go\nfunc (d *Darwin) Create(\n\t_ context.Context,\n\t_ Entry,\n) (*CreateResult, error)\n```\nCreate returns ErrUnsupported on Darwin.\n\n```go\nfunc (d *Darwin) Delete(\n\t_ context.Context,\n\t_ string,\n) (*DeleteResult, error)\n```\nDelete returns ErrUnsupported on Darwin.\n\n```go\nfunc (d *Darwin) Get(\n\t_ context.Context,\n\t_ string,\n) (*Entry, error)\n```\nGet returns ErrUnsupported on Darwin.\n\n```go\nfunc (d *Darwin) List(\n\t_ context.Context,\n) ([]Entry, error)\n```\nList returns ErrUnsupported on Darwin.\n\n```go\nfunc (d *Darwin) Update(\n\t_ context.Context,\n\t_ Entry,\n) (*UpdateResult, error)\n```\nUpdate returns ErrUnsupported on Darwin.\n\n```go\ntype Debian struct {\n\tprovider.FactsAware\n\t// contains filtered or unexported fields\n}\n```\nDebian 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.\n\n```go\nfunc NewDebianProvider(\n\tlogger *slog.Logger,\n\tfs avfs.VFS,\n\tstateKV jetstream.KeyValue,\n\texecManager exec.Manager,\n\thostname string,\n) *Debian\n```\nNewDebianProvider factory to create a new Debian instance.\n\n```go\nfunc (d *Debian) Create(\n\tctx context.Context,\n\tentry Entry,\n) (*CreateResult, error)\n```\nCreate deploys a new sysctl conf file and applies it. Idempotent on content rather than on existence: a drop-in already holding what was asked for reports Changed: false, and one that has been edited, deleted, or holds a different value is rewritten, because the operation's job is to make the setting true.\n\n```go\nfunc (d *Debian) Delete(\n\tctx context.Context,\n\tkey string,\n) (*DeleteResult, error)\n```\nDelete removes a managed sysctl conf file and reloads defaults.\n\n```go\nfunc (d *Debian) Get(\n\tctx context.Context,\n\tkey string,\n) (*Entry, error)\n```\nGet returns a single sysctl entry by key with current runtime value.\n\n```go\nfunc (d *Debian) List(\n\tctx context.Context,\n) ([]Entry, error)\n```\nList returns all osapi-managed sysctl entries with current runtime values.\n\n```go\nfunc (d *Debian) Update(\n\tctx context.Context,\n\tentry Entry,\n) (*UpdateResult, error)\n```\nUpdate redeploys an existing managed sysctl conf file. Fails if the key is not currently managed. Idempotent: if the content hasn't changed, Changed is false.\n\n```go\ntype DeleteResult struct {\n\tKey     string `json:\"key\"`\n\tChanged bool   `json:\"changed\"`\n\tError   string `json:\"error,omitempty\"`\n}\n```\nDeleteResult represents the outcome of a sysctl delete operation.\n\n```go\ntype Entry struct {\n\tKey   string `json:\"key\"`\n\tValue string `json:\"value\"`\n}\n```\nEntry represents a sysctl kernel parameter.\n\n```go\ntype Linux struct{}\n```\nLinux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.\n\n```go\nfunc NewLinuxProvider() *Linux\n```\nNewLinuxProvider factory to create a new Linux instance.\n\n```go\nfunc (l *Linux) Create(\n\t_ context.Context,\n\t_ Entry,\n) (*CreateResult, error)\n```\nCreate returns ErrUnsupported on generic Linux.\n\n```go\nfunc (l *Linux) Delete(\n\t_ context.Context,\n\t_ string,\n) (*DeleteResult, error)\n```\nDelete returns ErrUnsupported on generic Linux.\n\n```go\nfunc (l *Linux) Get(\n\t_ context.Context,\n\t_ string,\n) (*Entry, error)\n```\nGet returns ErrUnsupported on generic Linux.\n\n```go\nfunc (l *Linux) List(\n\t_ context.Context,\n) ([]Entry, error)\n```\nList returns ErrUnsupported on generic Linux.\n\n```go\nfunc (l *Linux) Update(\n\t_ context.Context,\n\t_ Entry,\n) (*UpdateResult, error)\n```\nUpdate returns ErrUnsupported on generic Linux.\n\n```go\ntype Provider interface {\n\t// List returns all osapi-managed sysctl entries with current runtime values.\n\tList(ctx context.Context) ([]Entry, error)\n\t// Get returns a single sysctl entry by key with current runtime value.\n\tGet(ctx context.Context, key string) (*Entry, error)\n\t// Create deploys a new sysctl conf file and applies it. Idempotent: returns Changed: false if already managed.\n\tCreate(ctx context.Context, entry Entry) (*CreateResult, error)\n\t// Update redeploys an existing sysctl conf file. Fails if not managed.\n\tUpdate(ctx context.Context, entry Entry) (*UpdateResult, error)\n\t// Delete removes a managed sysctl conf file and reloads defaults.\n\tDelete(ctx context.Context, key string) (*DeleteResult, error)\n}\n```\nProvider implements the methods to manage sysctl entries.\n\n```go\ntype UpdateResult struct {\n\tKey     string `json:\"key\"`\n\tChanged bool   `json:\"changed\"`\n\tError   string `json:\"error,omitempty\"`\n}\n```\nUpdateResult represents the outcome of a sysctl update operation.\n\n","path":"github.com/osapi-io/osapi/internal/provider/node/sysctl","name":"sysctl","synopsis":"Package sysctl provides kernel parameter management via /etc/sysctl.d/.","isRedistributable":true}
