unionfs

package
v0.0.0-...-82cd6e7 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2012 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDir

func IsDir(fs fuse.FileSystem, name string) bool

Types

type AutoUnionFs

type AutoUnionFs struct {
	fuse.DefaultFileSystem
	// contains filtered or unexported fields
}

Creates unions for all files under a given directory, walking the tree and looking for directories D which have a D/READONLY symlink.

A union for A/B/C will placed under directory A-B-C.

func NewAutoUnionFs

func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs

func (*AutoUnionFs) DebugData

func (me *AutoUnionFs) DebugData() string

func (*AutoUnionFs) GetAttr

func (me *AutoUnionFs) GetAttr(path string, context *fuse.Context) (*fuse.Attr, fuse.Status)

func (*AutoUnionFs) GetXAttr

func (me *AutoUnionFs) GetXAttr(name string, attr string, context *fuse.Context) ([]byte, fuse.Status)

Must define this, because ENOSYS will suspend all GetXAttr calls.

func (*AutoUnionFs) OnMount

func (me *AutoUnionFs) OnMount(nodeFs *fuse.PathNodeFs)

func (*AutoUnionFs) Open

func (me *AutoUnionFs) Open(path string, flags uint32, context *fuse.Context) (fuse.File, fuse.Status)

func (*AutoUnionFs) OpenDir

func (me *AutoUnionFs) OpenDir(name string, context *fuse.Context) (stream chan fuse.DirEntry, status fuse.Status)
func (me *AutoUnionFs) Readlink(path string, context *fuse.Context) (out string, code fuse.Status)

func (*AutoUnionFs) SetMountState

func (me *AutoUnionFs) SetMountState(state *fuse.MountState)

SetMountState stores the MountState, which is necessary for retrieving debug data.

func (*AutoUnionFs) StatFs

func (me *AutoUnionFs) StatFs(name string) *fuse.StatfsOut

func (*AutoUnionFs) StatusDir

func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Status)

func (*AutoUnionFs) String

func (me *AutoUnionFs) String() string
func (me *AutoUnionFs) Symlink(pointedTo string, linkName string, context *fuse.Context) (code fuse.Status)

func (*AutoUnionFs) Truncate

func (me *AutoUnionFs) Truncate(name string, offset uint64, context *fuse.Context) (code fuse.Status)
func (me *AutoUnionFs) Unlink(path string, context *fuse.Context) (code fuse.Status)

type AutoUnionFsOptions

type AutoUnionFsOptions struct {
	UnionFsOptions
	fuse.FileSystemOptions
	fuse.PathNodeFsOptions

	// If set, run updateKnownFses() after mounting.
	UpdateOnMount bool
}

type CachingFileSystem

type CachingFileSystem struct {
	fuse.FileSystem
	// contains filtered or unexported fields
}

Caches filesystem metadata.

func NewCachingFileSystem

func NewCachingFileSystem(fs fuse.FileSystem, ttl time.Duration) *CachingFileSystem

func (*CachingFileSystem) DropCache

func (me *CachingFileSystem) DropCache()

func (*CachingFileSystem) GetAttr

func (me *CachingFileSystem) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status)

func (*CachingFileSystem) GetXAttr

func (me *CachingFileSystem) GetXAttr(name string, attr string, context *fuse.Context) ([]byte, fuse.Status)

func (*CachingFileSystem) Open

func (me *CachingFileSystem) Open(name string, flags uint32, context *fuse.Context) (f fuse.File, status fuse.Status)

func (*CachingFileSystem) OpenDir

func (me *CachingFileSystem) OpenDir(name string, context *fuse.Context) (stream chan fuse.DirEntry, status fuse.Status)
func (me *CachingFileSystem) Readlink(name string, context *fuse.Context) (string, fuse.Status)

func (*CachingFileSystem) String

func (me *CachingFileSystem) String() string

type DirCache

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

DirCache caches names in a directory for some time.

If called when the cache is expired, the filenames are read afresh in the background.

func NewDirCache

func NewDirCache(fs fuse.FileSystem, dir string, ttl time.Duration) *DirCache

func (*DirCache) AddEntry

func (me *DirCache) AddEntry(name string)

func (*DirCache) DropCache

func (me *DirCache) DropCache()

func (*DirCache) HasEntry

func (me *DirCache) HasEntry(name string) (mapPresent bool, found bool)

func (*DirCache) RemoveEntry

func (me *DirCache) RemoveEntry(name string)

type TimedCache

type TimedCache struct {
	PurgeTimer *time.Timer
	// contains filtered or unexported fields
}

func NewTimedCache

func NewTimedCache(fetcher TimedCacheFetcher, ttl time.Duration) *TimedCache

Creates a new cache with the given TTL. If TTL <= 0, the caching is indefinite.

func (*TimedCache) DropAll

func (me *TimedCache) DropAll(names []string)

func (*TimedCache) DropEntry

func (me *TimedCache) DropEntry(name string)

func (*TimedCache) Get

func (me *TimedCache) Get(name string) interface{}

func (*TimedCache) GetFresh

func (me *TimedCache) GetFresh(name string) interface{}

func (*TimedCache) Purge

func (me *TimedCache) Purge()

Drop all expired entries.

func (*TimedCache) RecurringPurge

func (me *TimedCache) RecurringPurge()

func (*TimedCache) Set

func (me *TimedCache) Set(name string, val interface{})

type TimedCacheFetcher

type TimedCacheFetcher func(name string) (value interface{}, cacheable bool)

TimedIntCache caches the result of fetch() for some time. It is thread-safe. Calls of fetch() do no happen inside a critical section, so when multiple concurrent Get()s happen for the same key, multiple fetch() calls may be issued for the same key.

type UnionFs

type UnionFs struct {
	fuse.DefaultFileSystem
	// contains filtered or unexported fields
}

UnionFs implements a user-space union file system, which is stateless but efficient even if the writable branch is on NFS.

Assumptions:

* It uses a list of branches, the first of which (index 0) is thought to be writable, and the rest read-only.

* It assumes that the number of deleted files is small relative to the total tree size.

Implementation notes.

  • It overlays arbitrary writable FileSystems with any number of readonly FileSystems.

* Deleting a file will put a file named /DELETIONS/HASH-OF-FULL-FILENAME into the writable overlay, containing the full filename itself.

This is optimized for NFS usage: we want to minimize the number of NFS operations, which are slow. By putting all whiteouts in one place, we can cheaply fetch the list of all deleted files. Even without caching on our side, the kernel's negative dentry cache can answer is-deleted queries quickly.

func NewUnionFs

func NewUnionFs(fileSystems []fuse.FileSystem, options UnionFsOptions) *UnionFs

func NewUnionFsFromRoots

func NewUnionFsFromRoots(roots []string, opts *UnionFsOptions, roCaching bool) (*UnionFs, error)

func (*UnionFs) Access

func (me *UnionFs) Access(name string, mode uint32, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Chmod

func (me *UnionFs) Chmod(name string, mode uint32, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Chown

func (me *UnionFs) Chown(name string, uid uint32, gid uint32, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Create

func (me *UnionFs) Create(name string, flags uint32, mode uint32, context *fuse.Context) (fuseFile fuse.File, code fuse.Status)

func (*UnionFs) DropBranchCache

func (me *UnionFs) DropBranchCache(names []string)

func (*UnionFs) DropDeletionCache

func (me *UnionFs) DropDeletionCache()

func (*UnionFs) DropSubFsCaches

func (me *UnionFs) DropSubFsCaches()

func (*UnionFs) GetAttr

func (me *UnionFs) GetAttr(name string, context *fuse.Context) (a *fuse.Attr, s fuse.Status)

func (*UnionFs) GetXAttr

func (me *UnionFs) GetXAttr(name string, attr string, context *fuse.Context) ([]byte, fuse.Status)
func (me *UnionFs) Link(orig string, newName string, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Mkdir

func (me *UnionFs) Mkdir(path string, mode uint32, context *fuse.Context) (code fuse.Status)

func (*UnionFs) OnMount

func (me *UnionFs) OnMount(nodeFs *fuse.PathNodeFs)

func (*UnionFs) Open

func (me *UnionFs) Open(name string, flags uint32, context *fuse.Context) (fuseFile fuse.File, status fuse.Status)

func (*UnionFs) OpenDir

func (me *UnionFs) OpenDir(directory string, context *fuse.Context) (stream chan fuse.DirEntry, status fuse.Status)

func (*UnionFs) Promote

func (me *UnionFs) Promote(name string, srcResult branchResult, context *fuse.Context) (code fuse.Status)
func (me *UnionFs) Readlink(name string, context *fuse.Context) (out string, code fuse.Status)

func (*UnionFs) Rename

func (me *UnionFs) Rename(src string, dst string, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Rmdir

func (me *UnionFs) Rmdir(path string, context *fuse.Context) (code fuse.Status)

func (*UnionFs) StatFs

func (me *UnionFs) StatFs(name string) *fuse.StatfsOut

func (*UnionFs) String

func (me *UnionFs) String() string
func (me *UnionFs) Symlink(pointedTo string, linkName string, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Truncate

func (me *UnionFs) Truncate(path string, size uint64, context *fuse.Context) (code fuse.Status)
func (me *UnionFs) Unlink(name string, context *fuse.Context) (code fuse.Status)

func (*UnionFs) Utimens

func (me *UnionFs) Utimens(name string, atime int64, mtime int64, context *fuse.Context) (code fuse.Status)

type UnionFsOptions

type UnionFsOptions struct {
	BranchCacheTTL   time.Duration
	DeletionCacheTTL time.Duration
	DeletionDirName  string
}

Jump to

Keyboard shortcuts

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