fakesystem

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package fakesystem provides an in-memory implementation of the interfaces in the system package.

Index

Constants

View Source
const (
	DefaultUID system.UID = 1000
	DefaultGID system.GID = 2000
)

Default IDs for created filesystem entries.

Variables

This section is empty.

Functions

This section is empty.

Types

type Program

type Program func(ctx context.Context, pc *ProgramContext) int

Program is a function to call when an executable file is run.

type ProgramContext

type ProgramContext struct {
	Args   []string
	Env    []string
	Dir    string
	Input  io.Reader
	Output io.Writer
}

type System

type System struct {
	// contains filtered or unexported fields
}

System is an in-memory implementation of FS and Runner. It uses path/filepath for path manipulation. It is safe to use from multiple goroutines. The zero value is an empty filesystem.

func (*System) Chmod added in v0.2.0

func (sys *System) Chmod(ctx context.Context, path string, mode os.FileMode) error

func (*System) Chown added in v0.2.0

func (sys *System) Chown(ctx context.Context, path string, uid system.UID, gid system.GID) error

func (*System) CreateFile

func (sys *System) CreateFile(ctx context.Context, path string, mode os.FileMode) (system.FileWriter, error)

func (*System) LookupGroup added in v0.2.0

func (sys *System) LookupGroup(name string) (system.GID, error)

LookupGroup returns a group ID for either "root" or "group".

func (*System) LookupUser added in v0.2.0

func (sys *System) LookupUser(name string) (system.UID, error)

LookupUser returns a user ID for either "root" or "user".

func (*System) Lstat

func (sys *System) Lstat(ctx context.Context, path string) (os.FileInfo, error)

func (*System) Mkdir

func (sys *System) Mkdir(ctx context.Context, path string, mode os.FileMode) error

func (*System) Mkprogram

func (sys *System) Mkprogram(path string, prog Program) error

Mkprogram creates a filesystem entry that calls a program when run.

func (*System) OpenFile

func (sys *System) OpenFile(ctx context.Context, path string) (system.File, error)

func (*System) OwnerInfo added in v0.2.0

func (sys *System) OwnerInfo(info os.FileInfo) (system.UID, system.GID, error)
func (sys *System) Readlink(ctx context.Context, path string) (string, error)

func (*System) Remove

func (sys *System) Remove(ctx context.Context, path string) error

func (*System) Run

func (sys *System) Run(ctx context.Context, cmd *system.Cmd) (output []byte, err error)
func (sys *System) Symlink(ctx context.Context, oldname, newname string) error

Jump to

Keyboard shortcuts

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