mcbridgefs

package
v0.0.0-...-ec3862f Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileHandle

func NewFileHandle(fd int, flags uint32, path string) fs.FileHandle

Types

type FileHandle

type FileHandle struct {
	*bridgefs.BridgeFileHandle
	Flags uint32
	Path  string
}

func (*FileHandle) Flush

func (f *FileHandle) Flush(ctx context.Context) syscall.Errno

func (*FileHandle) Read

func (f *FileHandle) Read(ctx context.Context, buf []byte, off int64) (res fuse.ReadResult, errno syscall.Errno)

func (*FileHandle) Write

func (f *FileHandle) Write(ctx context.Context, data []byte, off int64) (uint32, syscall.Errno)

Write overrides the BridgeFileHandle write to incorporate updating the checksum as bytes are written to the file.

type Node

type Node struct {
	*bridgefs.BridgeNode
	// contains filtered or unexported fields
}

func CreateFS

func CreateFS(fsRoot string, dB *gorm.DB, tr mcmodel.TransferRequest) *Node

func (*Node) Create

func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (inode *fs.Inode, fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

Create will create a new file. At this point the file shouldn't exist. However, because multiple users could be uploading files, there is a chance it does exist. If that happens then a new version of the file is created instead.

func (*Node) Getattr

func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno

Getattr gets attributes about the file

func (*Node) Getxattr

func (n *Node) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno)

Getxattr returns extra attributes. This is used by lstat. There are no extra attributes to return so we always return a 0 for buffer length and success.

func (*Node) Lookup

func (n *Node) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Lookup will return information about the current entry.

func (*Node) Mkdir

func (n *Node) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Mkdir will create a new directory. If an attempt is made to create an existing directory then it will return the existing directory rather than returning an error.

func (*Node) Open

func (n *Node) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

Open will open an existing file.

func (*Node) Opendir

func (n *Node) Opendir(ctx context.Context) syscall.Errno

Opendir just returns success

func (*Node) Readdir

func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno)

Readdir reads the corresponding directory and returns its entries

func (*Node) Release

func (n *Node) Release(ctx context.Context, f fs.FileHandle) syscall.Errno

Release will close the file handle and update meta data about the file in the database

func (*Node) Rename

func (n *Node) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno

func (*Node) Rmdir

func (n *Node) Rmdir(ctx context.Context, name string) syscall.Errno

func (*Node) Setattr

func (n *Node) Setattr(ctx context.Context, f fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr will set attributes on a file. Currently the only attribute supported is setting the size. This is done by calling Ftruncate.

func (*Node) ToPath

func (n *Node) ToPath() *Path
func (n *Node) Unlink(ctx context.Context, name string) syscall.Errno

type OpenFile

type OpenFile struct {
	File     *mcmodel.File
	Checksum string
	// contains filtered or unexported fields
}

type OpenFilesTracker

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

func NewOpenFilesTracker

func NewOpenFilesTracker() *OpenFilesTracker

func (*OpenFilesTracker) Delete

func (t *OpenFilesTracker) Delete(path string)

func (*OpenFilesTracker) Get

func (t *OpenFilesTracker) Get(path string) *OpenFile

func (*OpenFilesTracker) Store

func (t *OpenFilesTracker) Store(path string, file *mcmodel.File)

type Path

type Path struct {
	Email     string
	ProjectID int
	Path      string
}

func ToPath

func ToPath(p string) *Path

func (*Path) IsEmail

func (p *Path) IsEmail() bool

func (*Path) IsProject

func (p *Path) IsProject() bool

func (*Path) IsRoot

func (p *Path) IsRoot() bool

func (*Path) ToFSPath

func (p *Path) ToFSPath(name string) string

func (*Path) ToFilePath

func (p *Path) ToFilePath(name string) string

Jump to

Keyboard shortcuts

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