libfuse

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 9 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) 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) 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) 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

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) 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

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