package oslayer
import "github.com/Microsoft/opengcs/service/gcs/oslayer"
Package oslayer defines the interface between the GCS and operating system functionality such as filesystem access.
Index ¶
Constants ¶
const ( // SIGKILL defines the Signal for a non-ignorable exit. SIGKILL = Signal(syscall.SIGKILL) // SIGTERM defines the Signal for an exit request. SIGTERM = Signal(syscall.SIGTERM) )
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) UnplugSCSIDisk(scsiID string) (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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
service/gcs/oslayer/mockos | Package mockos defines a mock interface into operating system functionality. |
service/gcs/oslayer/realos | Package realos defines the actual interface into operating system functionality. |
- Version
- v0.3.7
- Published
- Apr 11, 2018
- Platform
- js/wasm
- Imports
- 3 packages
- Last checked
- 4 hours ago –
Tools for package owners.