Documentation ¶
Overview ¶
Package fuse implements a FUSE layer for brig. Using it, a repository may be represented as a "normal" directory. There are three different structs in the FUSE API:
- fuse.Node : A file or a directory (depending on it's type)
- fuse.FS : The filesystem. Used to find out the root node.
- fuse.Handle: An open file.
This implementation offers File (a fuse.Node and fuse.Handle), Dir (fuse.Node) and FS (fuse.FS).
Fuse will call the respective handlers if it needs information about your nodes. Each request handlers will usually get a `ctx` used to cancel operations, a request structure `req` with detailed query infos and a response structure `resp` where results are written. Usually the request handlers might return an error or a new node/handle/fs.
Every request handle that may run for a long time should be made interruptible. Especially read and write operations should check the ctx.Done() channel passed to each request handler.
Index ¶
- type Directory
- func (dir *Directory) Attr(ctx context.Context, attr *fuse.Attr) error
- func (dir *Directory) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
- func (dir *Directory) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
- func (dir *Directory) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error
- func (dir *Directory) Lookup(ctx context.Context, name string) (fs.Node, error)
- func (dir *Directory) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)
- func (dir *Directory) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)
- func (dir *Directory) Remove(ctx context.Context, req *fuse.RemoveRequest) error
- type File
- func (fi *File) Attr(ctx context.Context, attr *fuse.Attr) error
- func (fi *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error
- func (fi *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
- func (fi *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error
- func (fi *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)
- func (fi *File) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error
- func (fi *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
- type Filesystem
- type Handle
- func (hd *Handle) Flush(ctx context.Context, req *fuse.FlushRequest) error
- func (hd *Handle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error
- func (hd *Handle) Release(ctx context.Context, req *fuse.ReleaseRequest) error
- func (hd *Handle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error
- type Mount
- type MountTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory represents a directory node.
func (*Directory) Create ¶
func (dir *Directory) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
Create is called to create an opened file or directory as child of the receiver.
func (*Directory) Getxattr ¶
func (dir *Directory) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
Getxattr is called to get a single xattr (extended attribute) of a file.
func (*Directory) Listxattr ¶
func (dir *Directory) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error
Listxattr is called to list all xattrs of this file.
func (*Directory) ReadDirAll ¶
ReadDirAll is called to get a directory listing of the receiver.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a file inside a directory.
func (*File) Fsync ¶
Fsync is called when any open buffers need to be written to disk. Currently, fsync is completely ignored.
func (*File) Getxattr ¶
func (fi *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error
Getxattr is called to get a single xattr (extended attribute) of a file.
func (*File) Listxattr ¶
func (fi *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error
Listxattr is called to list all xattrs of this file.
func (*File) Open ¶
func (fi *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)
Open is called to get an opened handle of a file, suitable for reading and writing.
func (*File) Setattr ¶
func (fi *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
Setattr is called once an attribute of a file changes. Most importantly, size changes are reported here, e.g. after truncating a file, the size change is noticed here before Open() is called.
type Filesystem ¶
type Filesystem struct {
// contains filtered or unexported fields
}
Filesystem is the entry point to the fuse filesystem
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is an open Entry.
func (*Handle) Read ¶
func (hd *Handle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error
Read is called to read a block of data at a certain offset.
func (*Handle) Write ¶
func (hd *Handle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error
Write is called to write a block of data at a certain offset.
type Mount ¶
type Mount struct { Dir string // contains filtered or unexported fields }
Mount represents a fuse endpoint on the filesystem. It is used as top-level API to control a brigfs fuse mount.
type MountTable ¶
type MountTable struct {
// contains filtered or unexported fields
}
MountTable is a mapping from the mountpoint to the respective `Mount` struct. It's given as convenient way to maintain several mounts. All operations on the table are safe to call from several goroutines.
func NewMountTable ¶
func NewMountTable(fs *catfs.FS) *MountTable
NewMountTable returns an empty mount table.
func (*MountTable) AddMount ¶
func (t *MountTable) AddMount(path string) (*Mount, error)
AddMount calls NewMount and adds it to the table at `path`.
func (*MountTable) Close ¶
func (t *MountTable) Close() error
Close unmounts all leftover mounts and clears the table.
func (*MountTable) Unmount ¶
func (t *MountTable) Unmount(path string) error
Unmount closes the mount at `path` and deletes it from the table.