unionfs

package
v0.0.0-...-0866f20 Latest Latest
Warning

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

Go to latest
Published: May 26, 2011 License: BSD-3-Clause Imports: 13 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) GetAttr

func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status)

func (*AutoUnionFs) GetXAttr

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

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

func (*AutoUnionFs) Mount

func (me *AutoUnionFs) Mount(connector *fuse.FileSystemConnector) fuse.Status

func (*AutoUnionFs) Open

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

func (*AutoUnionFs) OpenDir

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

func (*AutoUnionFs) StatusDir

func (me *AutoUnionFs) StatusDir() (stream chan fuse.DirEntry, status fuse.Status)
func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status)

func (*AutoUnionFs) Truncate

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

func (*AutoUnionFs) VisitDir

func (me *AutoUnionFs) VisitDir(path string, f *os.FileInfo) bool

TODO - should hide these methods.

func (*AutoUnionFs) VisitFile

func (me *AutoUnionFs) VisitFile(path string, f *os.FileInfo)

type AutoUnionFsOptions

type AutoUnionFsOptions struct {
	UnionFsOptions
	fuse.FileSystemOptions

	// 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, ttlNs int64) *CachingFileSystem

func (*CachingFileSystem) DisabledOpen

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

Caching file contents easily overflows available memory.

func (*CachingFileSystem) DropCache

func (me *CachingFileSystem) DropCache()

func (*CachingFileSystem) GetAttr

func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status)

func (*CachingFileSystem) GetXAttr

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

func (*CachingFileSystem) OpenDir

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

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, ttlNs int64) *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
}

TimedIntCache caches the result of fetch() for some time. It is thread-safe.

func NewTimedCache

func NewTimedCache(fetcher func(name string) interface{}, ttlNs int64) *TimedCache

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

func (*TimedCache) DropAll

func (me *TimedCache) DropAll()

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 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(name string, fileSystems []fuse.FileSystem, options UnionFsOptions) *UnionFs

func NewUnionFsFromRoots

func NewUnionFsFromRoots(roots []string, opts *UnionFsOptions) (*UnionFs, os.Error)

func (*UnionFs) Access

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

func (*UnionFs) Chmod

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

func (*UnionFs) Chown

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

func (*UnionFs) Create

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

func (*UnionFs) DropCaches

func (me *UnionFs) DropCaches()

func (*UnionFs) Flush

func (me *UnionFs) Flush(name string) fuse.Status

func (*UnionFs) GetAttr

func (me *UnionFs) GetAttr(name string) (a *os.FileInfo, s fuse.Status)

func (*UnionFs) GetXAttr

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

func (*UnionFs) Mkdir

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

func (*UnionFs) Name

func (me *UnionFs) Name() string

func (*UnionFs) Open

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

func (*UnionFs) OpenDir

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

func (*UnionFs) Promote

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

func (*UnionFs) Rename

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

func (*UnionFs) Rmdir

func (me *UnionFs) Rmdir(path string) (code fuse.Status)
func (me *UnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status)

func (*UnionFs) Truncate

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

func (*UnionFs) Utimens

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

type UnionFsOptions

type UnionFsOptions struct {
	BranchCacheTTLSecs   float64
	DeletionCacheTTLSecs float64
	DeletionDirName      string
}

Jump to

Keyboard shortcuts

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