layout

package
v4.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: BSD-3-Clause Imports: 10 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 is the virtual filesystem used to create the layout. It is rooted at
	// the session directory. Note that nested bind targets are created using
	// an os.Root rooted at the parent of the bind source target.
	VFS *RootedVFS

	// DirMode and FileMode are the default permissions for directories and
	// files created by the manager.
	DirMode  os.FileMode
	FileMode os.FileMode
	// contains filtered or unexported fields
}

Manager constructs a container filesystem layout in the session directory.

func NewManager added in v4.5.0

func NewManager(path string) (*Manager, error)

NewManager returns a new layout manager with the provided path as its root.

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) GetPath

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

GetPath returns the full host path, for path in the layout.

func (*Manager) HasOverride added in v4.5.0

func (m *Manager) HasOverride(layoutPath string) bool

HasOverride returns true if the provided layout path is overridden by a bind, false otherwise.

func (*Manager) PathResolvesOutsideOverride added in v4.5.0

func (m *Manager) PathResolvesOutsideOverride(path, resolvedPath string) bool

PathResolvesOutsideOverride reports whether resolvedPath falls outside the deepest bind source that overrides path. This catches symlinked paths that look like they are below a bind in the container layout, but resolve to a different host tree that cannot be reached through that bind target.

func (*Manager) Update

func (m *Manager) Update() error

Update updates the filesystem layout

type RootedVFS added in v4.5.0

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

func NewRootedVFS added in v4.5.0

func NewRootedVFS(path string) (*RootedVFS, error)

func (*RootedVFS) Chown added in v4.5.0

func (v *RootedVFS) Chown(name string, uid, gid int) error

func (*RootedVFS) Close added in v4.5.0

func (v *RootedVFS) Close() error

func (*RootedVFS) Lchown added in v4.5.0

func (v *RootedVFS) Lchown(name string, uid, gid int) error

func (*RootedVFS) Mkdir added in v4.5.0

func (v *RootedVFS) Mkdir(name string, perm os.FileMode) error

func (*RootedVFS) ReadDir added in v4.5.0

func (v *RootedVFS) ReadDir(dir string) ([]iofs.DirEntry, error)
func (v *RootedVFS) Readlink(name string) (string, error)

func (*RootedVFS) Stat added in v4.5.0

func (v *RootedVFS) Stat(name string) (os.FileInfo, error)
func (v *RootedVFS) Symlink(oldname, newname string) error

func (*RootedVFS) WriteFile added in v4.5.0

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

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

Directories

Path Synopsis
layer

Jump to

Keyboard shortcuts

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