Documentation ¶
Index ¶
- func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *fuse.Context) fuse.Status
- type FileSystem
- type PathNodeFs
- func (fs *PathNodeFs) AllFiles(name string, mask uint32) []nodefs.WithFlags
- func (fs *PathNodeFs) Connector() *nodefs.FileSystemConnector
- func (fs *PathNodeFs) EntryNotify(dir string, name string) fuse.Status
- func (fs *PathNodeFs) FileNotify(path string, off int64, length int64) fuse.Status
- func (fs *PathNodeFs) ForgetClientInodes()
- func (fs *PathNodeFs) LastNode(name string) (*nodefs.Inode, []string)
- func (fs *PathNodeFs) LookupNode(name string) *nodefs.Inode
- func (fs *PathNodeFs) Mount(path string, nodeFs nodefs.FileSystem, opts *nodefs.Options) fuse.Status
- func (fs *PathNodeFs) Node(name string) *nodefs.Inode
- func (fs *PathNodeFs) Notify(path string) fuse.Status
- func (fs *PathNodeFs) OnMount(conn *nodefs.FileSystemConnector)
- func (fs *PathNodeFs) OnUnmount()
- func (fs *PathNodeFs) Path(node *nodefs.Inode) string
- func (fs *PathNodeFs) RereadClientInodes()
- func (fs *PathNodeFs) Root() nodefs.Node
- func (fs *PathNodeFs) SetDebug(dbg bool)
- func (fs *PathNodeFs) String() string
- func (fs *PathNodeFs) Unmount(path string) fuse.Status
- func (fs *PathNodeFs) UnmountNode(node *nodefs.Inode) fuse.Status
- type PathNodeFsOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileSystem ¶
type FileSystem interface { // Used for pretty printing. String() string // If called, provide debug output through the log package. SetDebug(debug bool) // Attributes. This function is the main entry point, through // which FUSE discovers which files and directories exist. // // If the filesystem wants to implement hard-links, it should // return consistent non-zero FileInfo.Ino data. Using // hardlinks incurs a performance hit. GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) // These should update the file's ctime too. Chmod(name string, mode uint32, context *fuse.Context) (code fuse.Status) Chown(name string, uid uint32, gid uint32, context *fuse.Context) (code fuse.Status) Utimens(name string, Atime *time.Time, Mtime *time.Time, context *fuse.Context) (code fuse.Status) Truncate(name string, size uint64, context *fuse.Context) (code fuse.Status) Access(name string, mode uint32, context *fuse.Context) (code fuse.Status) // Tree structure Link(oldName string, newName string, context *fuse.Context) (code fuse.Status) Mkdir(name string, mode uint32, context *fuse.Context) fuse.Status Mknod(name string, mode uint32, dev uint32, context *fuse.Context) fuse.Status Rename(oldName string, newName string, context *fuse.Context) (code fuse.Status) Rmdir(name string, context *fuse.Context) (code fuse.Status) Unlink(name string, context *fuse.Context) (code fuse.Status) // Extended attributes. GetXAttr(name string, attribute string, context *fuse.Context) (data []byte, code fuse.Status) ListXAttr(name string, context *fuse.Context) (attributes []string, code fuse.Status) RemoveXAttr(name string, attr string, context *fuse.Context) fuse.Status SetXAttr(name string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status // Called after mount. OnMount(nodeFs *PathNodeFs) OnUnmount() // File handling. If opening for writing, the file's mtime // should be updated too. Open(name string, flags uint32, context *fuse.Context) (file nodefs.File, code fuse.Status) Create(name string, flags uint32, mode uint32, context *fuse.Context) (file nodefs.File, code fuse.Status) // Directory handling OpenDir(name string, context *fuse.Context) (stream []fuse.DirEntry, code fuse.Status) // Symlinks. Symlink(value string, linkName string, context *fuse.Context) (code fuse.Status) Readlink(name string, context *fuse.Context) (string, fuse.Status) StatFs(name string) *fuse.StatfsOut }
A filesystem API that uses paths rather than inodes. A minimal file system should have at least a functional GetAttr method. Typically, each call happens in its own goroutine, so take care to make the file system thread-safe.
NewDefaultFileSystem provides a null implementation of required methods.
func NewDefaultFileSystem ¶
func NewDefaultFileSystem() FileSystem
NewDefaultFileSystem creates a filesystem that responds ENOSYS for all methods
func NewLockingFileSystem ¶
func NewLockingFileSystem(pfs FileSystem) FileSystem
NewLockingFileSystem is a wrapper that makes a FileSystem threadsafe by serializing each operation.
func NewLoopbackFileSystem ¶
func NewLoopbackFileSystem(root string) FileSystem
A FUSE filesystem that shunts all request to an underlying file system. Its main purpose is to provide test coverage without having to build a synthetic filesystem.
func NewPrefixFileSystem ¶
func NewPrefixFileSystem(fs FileSystem, prefix string) FileSystem
func NewReadonlyFileSystem ¶
func NewReadonlyFileSystem(fs FileSystem) FileSystem
NewReadonlyFileSystem returns a wrapper that only exposes read-only operations.
type PathNodeFs ¶
type PathNodeFs struct {
// contains filtered or unexported fields
}
PathNodeFs is the file system that can translate an inode back to a path. The path name is then used to call into an object that has the FileSystem interface.
Lookups (ie. FileSystem.GetAttr) may return a inode number in its return value. The inode number ("clientInode") is used to indicate linked files. The clientInode is never exported back to the kernel; it is only used to maintain a list of all names of an inode.
func NewPathNodeFs ¶
func NewPathNodeFs(fs FileSystem, opts *PathNodeFsOptions) *PathNodeFs
func (*PathNodeFs) AllFiles ¶
func (fs *PathNodeFs) AllFiles(name string, mask uint32) []nodefs.WithFlags
func (*PathNodeFs) Connector ¶
func (fs *PathNodeFs) Connector() *nodefs.FileSystemConnector
func (*PathNodeFs) EntryNotify ¶
func (fs *PathNodeFs) EntryNotify(dir string, name string) fuse.Status
func (*PathNodeFs) FileNotify ¶
func (*PathNodeFs) ForgetClientInodes ¶
func (fs *PathNodeFs) ForgetClientInodes()
Forgets all known information on client inodes.
func (*PathNodeFs) LookupNode ¶
func (fs *PathNodeFs) LookupNode(name string) *nodefs.Inode
Like Node, but use Lookup to discover inodes we may not have yet.
func (*PathNodeFs) Mount ¶
func (fs *PathNodeFs) Mount(path string, nodeFs nodefs.FileSystem, opts *nodefs.Options) fuse.Status
func (*PathNodeFs) OnMount ¶
func (fs *PathNodeFs) OnMount(conn *nodefs.FileSystemConnector)
func (*PathNodeFs) OnUnmount ¶
func (fs *PathNodeFs) OnUnmount()
func (*PathNodeFs) RereadClientInodes ¶
func (fs *PathNodeFs) RereadClientInodes()
Rereads all inode numbers for all known files.
func (*PathNodeFs) Root ¶
func (fs *PathNodeFs) Root() nodefs.Node
func (*PathNodeFs) SetDebug ¶
func (fs *PathNodeFs) SetDebug(dbg bool)
func (*PathNodeFs) String ¶
func (fs *PathNodeFs) String() string
func (*PathNodeFs) UnmountNode ¶
func (fs *PathNodeFs) UnmountNode(node *nodefs.Inode) fuse.Status
type PathNodeFsOptions ¶
type PathNodeFsOptions struct { // If ClientInodes is set, use Inode returned from GetAttr to // find hard-linked files. ClientInodes bool }