osimpl

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package osimpl provides production operating-system adapters for interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinuxHostnameSetter

type LinuxHostnameSetter struct{}

LinuxHostnameSetter implements iface.HostnameSetter using the syscall.

func (LinuxHostnameSetter) SetHostname

func (LinuxHostnameSetter) SetHostname(name string) error

SetHostname sets the system hostname through the Linux syscall.

type LinuxModuleLoader

type LinuxModuleLoader struct{}

LinuxModuleLoader implements iface.ModuleLoader using /proc/modules and modprobe.

func (LinuxModuleLoader) LoadModule

func (LinuxModuleLoader) LoadModule(name string, params string) error

LoadModule loads a Linux kernel module with optional parameters.

func (LinuxModuleLoader) LoadedModules

func (LinuxModuleLoader) LoadedModules() (map[string]bool, error)

LoadedModules returns the set of currently loaded Linux kernel modules.

type LinuxMounter

type LinuxMounter struct{}

LinuxMounter implements iface.Mounter using real Linux mount syscalls.

func (LinuxMounter) ForceMount

func (LinuxMounter) ForceMount(device, target, mType, options string) error

ForceMount forcefully mounts a device at a target path.

func (LinuxMounter) Mount

func (LinuxMounter) Mount(device, target, mType, options string) error

Mount mounts a device at a target path.

func (LinuxMounter) Mounted

func (LinuxMounter) Mounted(target string) (bool, error)

Mounted reports whether the target path is currently mounted.

type LinuxSysctlApplier

type LinuxSysctlApplier struct {
	Root string
}

LinuxSysctlApplier implements iface.SysctlApplier by writing to /proc/sys/. Root overrides the base directory (default: /proc/sys) and is intended for testing only.

func (LinuxSysctlApplier) Set

func (a LinuxSysctlApplier) Set(key string, value string) error

Set writes a sysctl value under /proc/sys (or Root if set).

type OSFileSystem

type OSFileSystem struct{}

OSFileSystem implements iface.FileSystem using real OS calls.

func (OSFileSystem) Chmod

func (OSFileSystem) Chmod(name string, mode os.FileMode) error

Chmod changes file permissions using os.Chmod.

func (OSFileSystem) Chown

func (OSFileSystem) Chown(name string, uid, gid int) error

Chown changes file ownership using os.Chown.

func (OSFileSystem) Create

func (OSFileSystem) Create(name string) (iface.File, error)

Create creates a file using os.Create.

func (OSFileSystem) CreateTemp

func (OSFileSystem) CreateTemp(dir, pattern string) (iface.File, error)

CreateTemp creates a temporary file using os.CreateTemp.

func (OSFileSystem) Hostname

func (OSFileSystem) Hostname() (string, error)

Hostname returns the current hostname using os.Hostname.

func (OSFileSystem) MkdirAll

func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory tree using os.MkdirAll.

func (OSFileSystem) Open

func (OSFileSystem) Open(name string) (iface.File, error)

Open opens a file using os.Open.

func (OSFileSystem) ReadFile

func (OSFileSystem) ReadFile(name string) ([]byte, error)

ReadFile reads a file using os.ReadFile.

func (OSFileSystem) Remove

func (OSFileSystem) Remove(name string) error

Remove removes a path using os.Remove.

func (OSFileSystem) Rename

func (OSFileSystem) Rename(oldpath, newpath string) error

Rename renames a path using os.Rename.

func (OSFileSystem) Stat

func (OSFileSystem) Stat(name string) (os.FileInfo, error)

Stat returns file information using os.Stat.

func (OSFileSystem) WriteFile

func (OSFileSystem) WriteFile(name string, data []byte, perm os.FileMode) error

WriteFile writes data to a file using os.WriteFile.

type ShellRunner

type ShellRunner struct{}

ShellRunner implements iface.CommandRunner using real exec.Command calls.

func (ShellRunner) Run

func (ShellRunner) Run(name string, args ...string) error

Run executes a command with inherited stdout and stderr.

func (ShellRunner) RunShell

func (ShellRunner) RunShell(command string) error

RunShell executes a command string through sh.

func (ShellRunner) RunWithEnv

func (ShellRunner) RunWithEnv(env []string, name string, args ...string) error

RunWithEnv executes a command with additional environment variables.

func (ShellRunner) RunWithStdin

func (ShellRunner) RunWithStdin(stdin string, name string, args ...string) error

RunWithStdin executes a command with the provided stdin content.

Jump to

Keyboard shortcuts

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