layout

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	VFS      VFS
	DirMode  os.FileMode
	FileMode os.FileMode
	// contains filtered or unexported fields
}

Manager manages a filesystem layout in a given path

func (*Manager) AddDir

func (m *Manager) AddDir(path string) error

AddDir adds a directory in layout, will recursively add parent directories if they don't exist

func (*Manager) AddFile

func (m *Manager) AddFile(path string, content []byte) error

AddFile adds a file in layout, will recursively add parent directories if they don't exist

func (m *Manager) AddSymlink(path string, target string) error

AddSymlink adds a symlink in layout, will recursively add parent directories if they don't exist

func (*Manager) Chmod

func (m *Manager) Chmod(path string, mode os.FileMode) error

Chmod sets permission mode for path

func (*Manager) Chown

func (m *Manager) Chown(path string, uid, gid int) error

Chown sets ownership for path

func (*Manager) Create

func (m *Manager) Create() error

Create creates the filesystem layout

func (*Manager) GetOverridePath

func (m *Manager) GetOverridePath(path string) (string, error)

GetOverridePath returns the real path for the session path

func (*Manager) GetPath

func (m *Manager) GetPath(path string) (string, error)

GetPath returns the full path of layout path

func (*Manager) SetRootPath

func (m *Manager) SetRootPath(path string) error

SetRootPath sets layout root path

func (*Manager) Update

func (m *Manager) Update() error

Update updates the filesystem layout

type Session

type Session struct {
	*Manager
	Layer layer
}

Session directory layout manager

func NewSession

func NewSession(path string, fstype string, size int, system *mount.System, layer layer) (*Session, error)

NewSession creates and returns a session directory layout manager

func (*Session) FinalPath

func (s *Session) FinalPath() string

FinalPath returns the full path to session final directory

func (*Session) OverrideDir

func (s *Session) OverrideDir(path string, realpath string)

OverrideDir overrides a path in the session directory, it simulates a bind mount.

func (*Session) Path

func (s *Session) Path() string

Path returns the full path of session directory

func (*Session) RootFsPath

func (s *Session) RootFsPath() string

RootFsPath returns the full path to session rootfs directory

type VFS

type VFS interface {
	Chown(string, int, int) error
	EvalRelative(string, string) string
	Lchown(string, int, int) error
	Mkdir(string, os.FileMode) error
	Readlink(string) (string, error)
	ReadDir(string) ([]os.FileInfo, error)
	Stat(string) (os.FileInfo, error)
	Symlink(string, string) error
	Umask(int) int
	WriteFile(string, []byte, os.FileMode) error
}
var DefaultVFS VFS = &defaultVFS{}

DefaultVFS is the default VFS.

Directories

Path Synopsis
layer

Jump to

Keyboard shortcuts

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