gitfs

package
v0.0.0-...-b142f4f Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(ctx context.Context, mntDir string, debug bool, metaDataUrl string, dataOption *data.Option) (*fuse.Server, error)

Types

type File

type File interface {
	NewFileHandler() FileHandler
	UnRef(release func()) error
	Ref() int
	Release(ctx context.Context) error
}

type FileHandler

type FileHandler interface {
	fs.FileHandle
}

type GitFs

type GitFs struct {
	*Node

	DefaultDataSource *datasource.DataSource
	// contains filtered or unexported fields
}

func NewGitFs

func NewGitFs(ctx context.Context, metaDataUrl string, dataOption *data.Option) (*GitFs, error)

func (*GitFs) OpenFile

func (gitFs *GitFs) OpenFile(ctx context.Context, inode metadata.Ino) (FileHandler, error)

func (*GitFs) OpenRefFile

func (gitFs *GitFs) OpenRefFile(ctx context.Context, inode metadata.Ino) (FileHandler, error)

func (*GitFs) OpenSymRefFile

func (gitFs *GitFs) OpenSymRefFile(ctx context.Context, inode metadata.Ino) (FileHandler, error)

func (*GitFs) ReleaseFile

func (gitFs *GitFs) ReleaseFile(ctx context.Context, inode metadata.Ino) error

type GitRefNode

type GitRefNode struct {
	Node
}

func (*GitRefNode) Getattr

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

Getattr If a file handle is passed, the Getattr() function of the file handle is called, otherwise the metadata is loaded directly from meta driver

func (*GitRefNode) Open

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

Open a file for read/write...

func (*GitRefNode) Setattr

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

Setattr If a file handle is passed, the Setattr() function of the file handle is called, otherwise the metadata is written directly to the metadata on disk.

type GitRefsNode

type GitRefsNode struct {
	Node
}

func (*GitRefsNode) Create

func (node *GitRefsNode) 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 a file, and create a fuse node for it

func (node *GitRefsNode) Link(ctx context.Context, target fs.InodeEmbedder, name string, out *fuse.EntryOut) (newNode *fs.Inode, errno syscall.Errno)

Link hard link a file to another inode

func (*GitRefsNode) Lookup

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

Lookup check file info, and create a fuse node for it

func (*GitRefsNode) Mkdir

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

Mkdir create a directory, and create a fuse node for it

func (*GitRefsNode) Mknod

func (node *GitRefsNode) Mknod(ctx context.Context, name string, mode uint32, dev uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Mknod create a node, and create a fuse node for it

func (*GitRefsNode) NewFile

func (node *GitRefsNode) NewFile(ctx context.Context, ino metadata.Ino, name string, _type uint8) (fs.FileHandle, syscall.Errno)

func (*GitRefsNode) NewNode

func (node *GitRefsNode) NewNode(ino metadata.Ino, name string, _type uint8) fs.InodeEmbedder

type GitRepoNode

type GitRepoNode struct {
	Node
}

func (*GitRepoNode) Create

func (node *GitRepoNode) 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 a file, and create a fuse node for it

func (node *GitRepoNode) Link(ctx context.Context, target fs.InodeEmbedder, name string, out *fuse.EntryOut) (newNode *fs.Inode, errno syscall.Errno)

Link hard link a file to another inode

func (*GitRepoNode) Lookup

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

Lookup check file info, and create a fuse node for it

func (*GitRepoNode) Mkdir

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

Mkdir create a directory, and create a fuse node for it

func (*GitRepoNode) Mknod

func (node *GitRepoNode) Mknod(ctx context.Context, name string, mode uint32, dev uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

Mknod create a node, and create a fuse node for it

func (*GitRepoNode) NewFile

func (node *GitRepoNode) NewFile(ctx context.Context, ino metadata.Ino, name string, _type uint8) (fs.FileHandle, syscall.Errno)

func (*GitRepoNode) NewNode

func (node *GitRepoNode) NewNode(ino metadata.Ino, name string, _type uint8) fs.InodeEmbedder

type GitSymRefNode

type GitSymRefNode struct {
	Node
}

func (*GitSymRefNode) Getattr

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

Getattr If a file handle is passed, the Getattr() function of the file handle is called, otherwise the metadata is loaded directly from meta driver

func (*GitSymRefNode) Open

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

Open a file for read/write...

func (*GitSymRefNode) Setattr

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

Setattr If a file handle is passed, the Setattr() function of the file handle is called, otherwise the metadata is written directly to the metadata on disk.

type Node

type Node struct {
	fs.Inode
	// contains filtered or unexported fields
}

func (*Node) Access

func (node *Node) Access(ctx context.Context, mask uint32) syscall.Errno

Access check if node can access a file or directory TODO should we use memattr?

func (*Node) Create

func (node *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 a file, and create a fuse node for it

func (*Node) Getattr

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

Getattr If a file handle is passed, the Getattr() function of the file handle is called, otherwise the metadata is loaded directly from meta driver

func (node *Node) Link(ctx context.Context, target fs.InodeEmbedder, name string, out *fuse.EntryOut) (newNode *fs.Inode, errno syscall.Errno)

Link hard link a file to another inode

func (*Node) Lookup

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

Lookup check file info, and create a fuse node for it

func (*Node) Mkdir

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

Mkdir create a directory, and create a fuse node for it

func (*Node) Mknod

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

Mknod create a node, and create a fuse node for it

func (*Node) NewNode

func (node *Node) NewNode(ino metadata.Ino, name string, _type uint8) fs.InodeEmbedder

func (*Node) Open

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

Open a file for read/write...

func (*Node) Opendir

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

Opendir open a directory (here we only do a check for directory entry) TODO maybe we should maintenance a open directories in memory?

func (*Node) Readdir

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

Readdir return dirstream which hold a iterator over directory entries

func (*Node) Rename

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

Rename a file with name to newParent/newName TODO should we use memattr

func (*Node) Rmdir

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

Rmdir delete a directory

func (*Node) Setattr

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

Setattr If a file handle is passed, the Setattr() function of the file handle is called, otherwise the metadata is written directly to the metadata on disk.

func (*Node) Statfs

func (node *Node) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno

Statfs get file system stat e.g. inode count, storage size... TODO align? Move to Gitfs?

func (node *Node) Unlink(ctx context.Context, name string) syscall.Errno

Unlink a file

type RefFile

type RefFile struct {
	*datasource.DataSource
	// contains filtered or unexported fields
}

func NewRefFile

func NewRefFile(ctx context.Context, inode metadata.Ino, dataSource *datasource.DataSource, gitFs *GitFs) (*RefFile, error)

func (*RefFile) NewFileHandler

func (file *RefFile) NewFileHandler() FileHandler

func (*RefFile) Ref

func (file *RefFile) Ref() int

func (*RefFile) Release

func (file *RefFile) Release(ctx context.Context) error

func (*RefFile) UnRef

func (file *RefFile) UnRef(release func()) error

type RefFileHandler

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

func (*RefFileHandler) Flush

func (fh *RefFileHandler) Flush(ctx context.Context) syscall.Errno

Flush will be called when file closed. (maybe called many times) We just do fsync here...

func (*RefFileHandler) Fsync

func (fh *RefFileHandler) Fsync(ctx context.Context, flags uint32) syscall.Errno

Fsync sync all file page pool data to file.

func (*RefFileHandler) Getattr

func (fh *RefFileHandler) Getattr(ctx context.Context, out *fuse.AttrOut) syscall.Errno

Getattr get the attr from meta attr & memattr

func (*RefFileHandler) Read

func (fh *RefFileHandler) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

Read will read the file data begin at offset to dest, read size no large then dest length

func (*RefFileHandler) Setattr

func (fh *RefFileHandler) Setattr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr set the attr to memattr

func (*RefFileHandler) Write

func (fh *RefFileHandler) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno)

Write will write the dest data to file begin at offset

type RegularFile

type RegularFile struct {
	*datasource.DataSource
	// contains filtered or unexported fields
}

func NewRegularFile

func NewRegularFile(ctx context.Context, inode metadata.Ino, dataSource *datasource.DataSource, gitFs *GitFs) (*RegularFile, error)

func (*RegularFile) NewFileHandler

func (file *RegularFile) NewFileHandler() FileHandler

func (*RegularFile) Ref

func (file *RegularFile) Ref() int

func (*RegularFile) Release

func (file *RegularFile) Release(ctx context.Context) error

func (*RegularFile) Setattr

func (file *RegularFile) Setattr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

func (*RegularFile) UnRef

func (file *RegularFile) UnRef(release func()) error

type RegularFileHandler

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

func (*RegularFileHandler) Flush

Flush will be called when file closed. (maybe called many times) We just do fsync here...

func (*RegularFileHandler) Fsync

func (fh *RegularFileHandler) Fsync(ctx context.Context, flags uint32) syscall.Errno

Fsync sync all file page pool data to file.

func (*RegularFileHandler) Getattr

func (fh *RegularFileHandler) Getattr(ctx context.Context, out *fuse.AttrOut) syscall.Errno

Getattr get the attr from meta attr & memattr

func (*RegularFileHandler) Read

func (fh *RegularFileHandler) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

Read will read the file data begin at offset to dest, read size no large then dest length

func (*RegularFileHandler) Release

func (fh *RegularFileHandler) Release(ctx context.Context) syscall.Errno

Release file handler release

func (*RegularFileHandler) Setattr

Setattr set the attr to memattr

func (*RegularFileHandler) Write

func (fh *RegularFileHandler) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno)

Write will write the dest data to file begin at offset

type SymRefFile

type SymRefFile struct {
	*datasource.DataSource
	// contains filtered or unexported fields
}

func NewSymRefFile

func NewSymRefFile(ctx context.Context, inode metadata.Ino, dataSource *datasource.DataSource, gitFs *GitFs) (*SymRefFile, error)

func (*SymRefFile) NewFileHandler

func (file *SymRefFile) NewFileHandler() FileHandler

func (*SymRefFile) Ref

func (file *SymRefFile) Ref() int

func (*SymRefFile) Release

func (file *SymRefFile) Release(ctx context.Context) error

func (*SymRefFile) UnRef

func (file *SymRefFile) UnRef(release func()) error

type SymRefFileHandler

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

func (*SymRefFileHandler) Flush

Flush will be called when file closed. (maybe called many times) We just do fsync here...

func (*SymRefFileHandler) Fsync

func (fh *SymRefFileHandler) Fsync(ctx context.Context, flags uint32) syscall.Errno

Fsync sync all file page pool data to file.

func (*SymRefFileHandler) Getattr

func (fh *SymRefFileHandler) Getattr(ctx context.Context, out *fuse.AttrOut) syscall.Errno

Getattr get the attr from meta attr & memattr

func (*SymRefFileHandler) Read

func (fh *SymRefFileHandler) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

Read will read the file data begin at offset to dest, read size no large then dest length

func (*SymRefFileHandler) Setattr

func (fh *SymRefFileHandler) Setattr(ctx context.Context, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

Setattr set the attr to memattr

func (*SymRefFileHandler) Write

func (fh *SymRefFileHandler) Write(ctx context.Context, data []byte, off int64) (written uint32, errno syscall.Errno)

Write will write the dest data to file begin at offset

Jump to

Keyboard shortcuts

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