lower

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lower is a lazy read-only file system over one commit of the version control store: the lower layer of a kernel overlay, with the dirty set read from the upper directory. The FUSE server builds on Linux only.

Package vfs is the node-local lazy workspace: a git tree served over FUSE as the read-only lower layer of a kernel overlay.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoUpper = errors.New("vfs: a mount of a tree has no upper directory")

ErrNoUpper is the answer of a dirty set or change token of a mount of a tree, which has no upper directory.

View Source
var ParsePublication = volattr.ParsePublication

Functions

func DirtyFromUpper

func DirtyFromUpper(es []upperdir.Entry) []ctl.DirtyEntry

DirtyFromUpper converts the entries of upperdir.Scan to the entries of the dirty op.

func UpperBase

func UpperBase(c *store.Cache, root gitpack.SHA) upperdir.BaseTree

UpperBase returns the base tree of a mount for upperdir.Scan. A submodule is a directory with no entries.

Types

type BaseFile added in v0.40.0

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

BaseFile is the open blob of a base file.

func (*BaseFile) Close added in v0.40.0

func (b *BaseFile) Close() error

func (*BaseFile) ReadAt added in v0.40.0

func (b *BaseFile) ReadAt(p []byte, off int64) (int, error)

func (*BaseFile) Size added in v0.40.0

func (b *BaseFile) Size() int64

type BaseNode added in v0.40.0

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

BaseNode is an entry of the base tree that a lookup found. A directory holds its decoded tree, so a later read goes through the node and never resolves its path again.

func (BaseNode) Dir added in v0.40.0

func (n BaseNode) Dir() bool

func (BaseNode) Exec added in v0.40.0

func (n BaseNode) Exec() bool

func (BaseNode) Path added in v0.40.0

func (n BaseNode) Path() string

Path is the base path of the node: the origin of an upper node that stands for it.

func (BaseNode) Size added in v0.40.0

func (n BaseNode) Size() int64
func (n BaseNode) Symlink() bool

type Config

type Config struct {
	Store    store.Store
	CacheDir string
	// UpperDir is the upper directory of the kernel overlay over the mount. The daemon reads the dirty set there.
	UpperDir string
	Base     gitpack.SHA // commit
	Tree     gitpack.SHA
	TreeTime time.Time
	UID, GID uint32
	Cache    *store.Cache
	NoOpen   bool
	// Clock paces the stats record and the settle test of the upper directory walk. Nil is the real clock.
	Clock     clock.Clock
	Telemetry tel.Telemetry
	// UpperFS reads the upper directory. Nil reads UpperDir from the file system.
	UpperFS upperdir.FS
}

Config is what the daemon needs to serve one commit.

type MountOpts

type MountOpts struct {
	TTL               time.Duration
	Debug             bool
	DefaultPermission bool
	DirectMount       bool
}

type Node

type Node struct {
	fs.Inode
	// contains filtered or unexported fields
}

func (*Node) Allocate

func (n *Node) Allocate(ctx context.Context, f fs.FileHandle, off uint64, size uint64, mode uint32) syscall.Errno

func (*Node) Create

func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (*fs.Inode, fs.FileHandle, uint32, syscall.Errno)

func (*Node) Fsync

func (n *Node) Fsync(ctx context.Context, f fs.FileHandle, flags uint32) syscall.Errno

Fsync succeeds: the lower layer holds nothing dirty.

func (*Node) Getattr

func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) (rerr syscall.Errno)

func (*Node) Lookup

func (n *Node) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (_ *fs.Inode, rerr syscall.Errno)

func (*Node) Mkdir

func (n *Node) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*Node) Open

func (n *Node) Open(ctx context.Context, flags uint32) (_ fs.FileHandle, _ uint32, rerr syscall.Errno)

func (*Node) Read

func (n *Node) Read(ctx context.Context, f fs.FileHandle, dest []byte, off int64) (res fuse.ReadResult, rerr syscall.Errno)

Read serves handle-less reads when the kernel runs without OPEN (no_open).

func (*Node) Readdir

func (n *Node) Readdir(ctx context.Context) (_ fs.DirStream, rerr syscall.Errno)
func (n *Node) Readlink(ctx context.Context) (_ []byte, rerr syscall.Errno)

func (*Node) Rename

func (n *Node) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno

func (*Node) Rmdir

func (n *Node) Rmdir(ctx context.Context, name string) syscall.Errno

func (*Node) Setattr

func (n *Node) Setattr(ctx context.Context, f fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

func (*Node) Statfs

func (n *Node) Statfs(ctx context.Context, out *fuse.StatfsOut) (rerr syscall.Errno)
func (n *Node) Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)
func (n *Node) Unlink(ctx context.Context, name string) syscall.Errno

func (*Node) Write

func (n *Node) Write(ctx context.Context, f fs.FileHandle, data []byte, off int64) (uint32, syscall.Errno)

type Publication

type Publication = volattr.Publication

Publication and ParsePublication are the volume attributes of a workspace, shared with the sandbox driver.

type VFS

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

func New

func New(ctx context.Context, cfg Config) (*VFS, error)

New opens the workspace of cfg.Base: it reads the commit and its root tree. It runs under the span vfs.open.

func (*VFS) BaseChild added in v0.40.0

func (v *VFS) BaseChild(ctx context.Context, dir BaseNode, name string) (BaseNode, error)

BaseChild finds the entry name of a base directory without loading the tree of a child directory. A missing name answers fs.ErrNotExist.

func (*VFS) BaseChildren added in v0.40.0

func (v *VFS) BaseChildren(ctx context.Context, dir BaseNode) ([]BaseNode, error)

BaseChildren lists the entries of a base directory in tree order. A listed directory loads its own tree only when it is looked up or listed.

func (*VFS) BaseOpen added in v0.40.0

func (v *VFS) BaseOpen(ctx context.Context, n BaseNode) (*BaseFile, error)

BaseOpen opens the blob of a file or symlink. The cache fetches it with the size and hash check of its name.

func (v *VFS) BaseReadLink(ctx context.Context, n BaseNode) ([]byte, error)

BaseReadLink returns the target of a base symlink.

func (*VFS) BaseResolve added in v0.40.0

func (v *VFS) BaseResolve(ctx context.Context, p string) (BaseNode, error)

BaseResolve finds the node at a base path without loading the tree of a directory at the path. A record of the upper store names its origin this way, and the base tree never changes, so the path always names the same node.

func (*VFS) BaseRoot added in v0.40.0

func (v *VFS) BaseRoot() BaseNode

BaseRoot is the root directory of the base tree.

func (*VFS) BaseTree

func (v *VFS) BaseTree() string

BaseTree is the root tree of the mount commit.

func (*VFS) Cache

func (v *VFS) Cache() *store.Cache

Cache is the node cache of the mount.

func (*VFS) CallStats added in v0.17.0

func (v *VFS) CallStats() *tel.CallStats

CallStats is the recorder of the control calls and of the store calls that they make.

func (*VFS) Changes

func (v *VFS) Changes(ctx context.Context) ([]ctl.ChangeEntry, ctl.Token, error)

Changes lists the files of the upper directory that differ from the base tree.

func (*VFS) ChangesOf added in v0.40.0

func (v *VFS) ChangesOf(ctx context.Context, es []upperdir.Entry, fsys upperdir.FS) ([]ctl.ChangeEntry, error)

ChangesOf lists the files of the dirty entries es that differ from the base tree, with the blob that the upper directory fsys holds for each.

func (*VFS) Close

func (v *VFS) Close()

Close writes the last vfs.stats record. The upper directory stays on disk.

func (*VFS) Dirty

func (v *VFS) Dirty(ctx context.Context) ([]ctl.DirtyEntry, ctl.Token, error)

Dirty is the dirty set of the upper directory against the base tree.

func (*VFS) MountFUSE

func (v *VFS) MountFUSE(ctx context.Context, mnt string, o MountOpts) (*fuse.Server, error)

MountFUSE mounts v at mnt through the host kernel FUSE.

func (*VFS) ReadFile added in v0.40.0

func (v *VFS) ReadFile(ctx context.Context, name string) ([]byte, error)

ReadFile reads a regular file of the base tree, or answers fs.ErrNotExist.

func (*VFS) Root

func (v *VFS) Root() *Node

func (*VFS) Stats

func (v *VFS) Stats() ctl.Stats

Stats returns the counters of the node cache.

func (*VFS) Time added in v0.40.0

func (v *VFS) Time() time.Time

Time is the time that every entry of the mount shows.

func (*VFS) Token

func (v *VFS) Token() (ctl.Token, error)

Token is the change token of the upper directory.

func (*VFS) UpperBase added in v0.40.0

func (v *VFS) UpperBase() upperdir.BaseTree

UpperBase is the base tree of the mount for upperdir.Scan.

Jump to

Keyboard shortcuts

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