Documentation
¶
Overview ¶
Package osimpl provides production operating-system adapters for interfaces.
Index ¶
- type LinuxHostnameSetter
- type LinuxModuleLoader
- type LinuxMounter
- type LinuxSysctlApplier
- type OSFileSystem
- func (OSFileSystem) Chmod(name string, mode os.FileMode) error
- func (OSFileSystem) Chown(name string, uid, gid int) error
- func (OSFileSystem) Create(name string) (iface.File, error)
- func (OSFileSystem) CreateTemp(dir, pattern string) (iface.File, error)
- func (OSFileSystem) Hostname() (string, error)
- func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (OSFileSystem) Open(name string) (iface.File, error)
- func (OSFileSystem) ReadFile(name string) ([]byte, error)
- func (OSFileSystem) Remove(name string) error
- func (OSFileSystem) Rename(oldpath, newpath string) error
- func (OSFileSystem) Stat(name string) (os.FileInfo, error)
- func (OSFileSystem) WriteFile(name string, data []byte, perm os.FileMode) error
- type ShellRunner
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.
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.
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.
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.