libfuse

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VFS

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

VFS represent Virtual System

func NewVFileSystem

func NewVFileSystem(ctx context.Context, fsOps spacefs.FSOps) *VFS

NewVFileSystem creates a new Virtual FileSystem object

func (*VFS) IsMounted

func (vfs *VFS) IsMounted() bool

IsMounted returns true if the vfs still has a valid connection to the mounted path

func (*VFS) Mount

func (vfs *VFS) Mount(mountPath, fsName string) error

Mount mounts the file system, if it is not already mounted

func (*VFS) Root

func (vfs *VFS) Root() (fs.Node, error)

Root complies with the Fuse Interface that returns the Root Node of our file system

func (*VFS) Serve

func (vfs *VFS) Serve() error

Serve start the FUSE server that handles requests from the mounted connection This is a blocking operation

func (*VFS) Statfs added in v0.1.3

func (vfs *VFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error

Statfs implements the fs.FSStatfser interface and reports block and storage information stats about VFS

func (*VFS) Unmount

func (vfs *VFS) Unmount() error

UnMount closes connection

type VFSDir

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

VFSDir represents a directory in the Virtual file system

func NewVFSDir

func NewVFSDir(vfs *VFS, dirOps spacefs.DirOps) *VFSDir

func (*VFSDir) Access added in v0.1.3

func (dir *VFSDir) Access(ctx context.Context, req *fuse.AccessRequest) error

func (*VFSDir) Attr

func (dir *VFSDir) Attr(ctx context.Context, attr *fuse.Attr) error

Attr returns fuse.Attr for the directory

func (*VFSDir) Create

func (dir *VFSDir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)

Create is invoked when a new directory is to be created It implements the fs.NodeCreator interface

func (*VFSDir) Lookup

func (dir *VFSDir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)

Lookup finds entry Node within a directory Seems to be called when not enough information is gotten from the ReadDirAll

func (*VFSDir) Mkdir added in v0.1.3

func (dir *VFSDir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)

Mkdir implements the fs.NodeMkdirer interface

func (*VFSDir) ReadDirAll

func (dir *VFSDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

ReadDirAll reads all the content of a directory In this mirror drive case, we just return items in the mirror path

func (*VFSDir) Remove added in v0.1.3

func (dir *VFSDir) Remove(ctx context.Context, req *fuse.RemoveRequest) error

Remove implements the fs.NodeRemover

func (*VFSDir) Rename added in v0.1.3

func (dir *VFSDir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error

Rename implements the fs.NodeRenamer Rename is only implemented for VFSDir and not VFSFile, because we currently don't support renaming files and rename on fsOps should only work empty folders.

type VFSFile

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

VFSFile represents a file in the Virtual file system

func NewVFSFile

func NewVFSFile(vfs *VFS, fileOps spacefs.FileOps) *VFSFile

func (*VFSFile) Access added in v0.0.19

func (vfile *VFSFile) Access(ctx context.Context, r *fuse.AccessRequest) (err error)

Access implements the fs.NodeAccesser interface for File. This is necessary for macOS to correctly identify plaintext files as plaintext. If not implemented, bazil-fuse returns a nil error for every call, so when macOS checks for executable bit using Access (instead of Attr!), it gets a success, which makes it think the file is executable, yielding a "Unix executable" UTI.

func (*VFSFile) Attr

func (vfile *VFSFile) Attr(ctx context.Context, attr *fuse.Attr) error

Attr returns fuse.Attr for the directory or file

func (*VFSFile) Open

func (vfile *VFSFile) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)

Open create a handle responsible for reading the file and also closing the file after reading

func (*VFSFile) Setattr added in v0.1.3

func (vfile *VFSFile) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error

Setattr implements the set attribute of fs.NodeSetattrer

type VFSFileHandler

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

VFSFileHandler manages readings and closing access to a VFSFile

func NewVFSFileHandler

func NewVFSFileHandler(ctx context.Context, vfile *VFSFile) (*VFSFileHandler, error)

func (*VFSFileHandler) Read

func (vfh *VFSFileHandler) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error

Read reads the content of the reader Ideally, decryption of the content of the file should be happening here

func (*VFSFileHandler) Release

func (vfh *VFSFileHandler) Release(ctx context.Context, req *fuse.ReleaseRequest) error

Release closes the reader on this file handler

func (*VFSFileHandler) Write

func (vfh *VFSFileHandler) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error

Write writes content from request into the underlying file. Keeping track of offset and all Ideally, encryption of the content of the file should be happening here

Jump to

Keyboard shortcuts

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