os

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmount added in v1.0.0

func Unmount(target string, flags int) error

Unmount will call unix.Unmount to unmount the file. The function doesn't return error if target is not mounted.

Types

type OS

type OS interface {
	MkdirAll(path string, perm os.FileMode) error
	RemoveAll(path string) error
	OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error)
	Stat(name string) (os.FileInfo, error)
	ResolveSymbolicLink(name string) (string, error)
	FollowSymlinkInScope(path, scope string) (string, error)
	CopyFile(src, dest string, perm os.FileMode) error
	WriteFile(filename string, data []byte, perm os.FileMode) error
	Mount(source string, target string, fstype string, flags uintptr, data string) error
	Unmount(target string, flags int) error
	LookupMount(path string) (containerdmount.Info, error)
}

OS collects system level operations that need to be mocked out during tests.

type RealOS

type RealOS struct{}

RealOS is used to dispatch the real system level operations.

func (RealOS) CopyFile

func (RealOS) CopyFile(src, dest string, perm os.FileMode) error

CopyFile will copy src file to dest file

func (RealOS) FollowSymlinkInScope added in v1.0.0

func (RealOS) FollowSymlinkInScope(path, scope string) (string, error)

FollowSymlinkInScope will call symlink.FollowSymlinkInScope.

func (RealOS) LookupMount added in v1.0.0

func (RealOS) LookupMount(path string) (containerdmount.Info, error)

LookupMount gets mount info of a given path.

func (RealOS) MkdirAll

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

MkdirAll will call os.MkdirAll to create a directory.

func (RealOS) Mount

func (RealOS) Mount(source string, target string, fstype string, flags uintptr, data string) error

Mount will call unix.Mount to mount the file.

func (RealOS) OpenFifo

func (RealOS) OpenFifo(ctx context.Context, fn string, flag int, perm os.FileMode) (io.ReadWriteCloser, error)

OpenFifo will call fifo.OpenFifo to open a fifo.

func (RealOS) RemoveAll

func (RealOS) RemoveAll(path string) error

RemoveAll will call os.RemoveAll to remove the path and its children.

func (RealOS) ResolveSymbolicLink(path string) (string, error)

ResolveSymbolicLink will follow any symbolic links

func (RealOS) Stat

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

Stat will call os.Stat to get the status of the given file.

func (RealOS) Unmount

func (RealOS) Unmount(target string, flags int) error

Unmount will call Unmount to unmount the file.

func (RealOS) WriteFile

func (RealOS) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile will call ioutil.WriteFile to write data into a file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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