oslayer

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package oslayer defines the interface between the GCS and operating system functionality such as filesystem access.

Index

Constants

View Source
const (
	SIGKILL = Signal(syscall.SIGKILL)
	SIGTERM = Signal(syscall.SIGTERM)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	SetDir(dir string)
	SetEnv(env []string)
	StdinPipe() (io.WriteCloser, error)
	StdoutPipe() (io.ReadCloser, error)
	StderrPipe() (io.ReadCloser, error)
	SetStdin(stdin io.Reader)
	SetStdout(stdout io.Writer)
	SetStderr(stderr io.Writer)
	ExitState() ProcessExitState
	Process() Process
	Start() error
	Wait() error
	Run() error
	Output() ([]byte, error)
	CombinedOutput() ([]byte, error)
}

Cmd is an interface describing a command which can be run on the system.

type File

type File interface {
	io.ReadWriteCloser
}

File is an interface describing the methods exposed by a file on the system.

type OS

type OS interface {
	// Filesystem
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
	Command(name string, arg ...string) Cmd
	MkdirAll(path string, perm os.FileMode) error
	RemoveAll(path string) error
	Create(name string) (File, error)
	ReadDir(dirname string) ([]os.FileInfo, error)
	Mount(source string, target string, fstype string, flags uintptr, data string) (err error)
	Unmount(target string, flags int) (err error)
	PathExists(name string) (bool, error)
	PathIsMounted(name string) (bool, error)
	Link(oldname, newname string) error

	// Processes
	Kill(pid int, sig syscall.Signal) error
}

OS is the interface describing operations that can be performed on and by the operating system, such as filesystem access and networking.

type Process

type Process interface {
	Pid() int
}

Process is an interface describing the methods exposed by a process on the system.

type ProcessExitState

type ProcessExitState interface {
	ExitCode() int
}

ProcessExitState is an interface describing the state of a process after it exits. Since os.ProcessState structs can only be obtained by an actual exited process, this interface can be mocked out for testing purposes to provide fake exit states.

type Signal

type Signal int

Signal represents signals which may be sent to processes, such as SIGKILl or SIGTERM.

Directories

Path Synopsis
Package mockos defines a mock interface into operating system functionality.
Package mockos defines a mock interface into operating system functionality.
Package realos defines the actual interface into operating system functionality.
Package realos defines the actual interface into operating system functionality.

Jump to

Keyboard shortcuts

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