fuse

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PrimaryFilename = ".primary"

PrimaryFilename is the name of the file that holds the current primary.

View Source
const RootInode = 1

Variables

This section is empty.

Functions

func FileTypeFilename

func FileTypeFilename(t litefs.FileType) string

FileTypeFilename returns the base name for the internal data file.

func ParseFilename

func ParseFilename(name string) (dbName string, fileType litefs.FileType)

ParseFilename parses a base name into database name & file type parts.

func ToError added in v0.1.1

func ToError(err error) error

ToError converts an error to a wrapped error with a FUSE status code.

Types

type DatabaseHandle added in v0.1.1

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

DatabaseHandle represents a file handle to a SQLite database file.

func (*DatabaseHandle) Flush added in v0.1.1

func (h *DatabaseHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error

func (*DatabaseHandle) Lock added in v0.1.1

func (h *DatabaseHandle) Lock(ctx context.Context, req *fuse.LockRequest) error

Lock tries to acquire a lock on a byte range of the node. If a conflicting lock is already held, returns syscall.EAGAIN.

func (*DatabaseHandle) LockWait added in v0.1.1

func (h *DatabaseHandle) LockWait(ctx context.Context, req *fuse.LockWaitRequest) error

LockWait is not implemented as SQLite does not use setlkw.

func (*DatabaseHandle) QueryLock added in v0.1.1

QueryLock returns the current state of locks held for the byte range of the node.

func (*DatabaseHandle) Read added in v0.1.1

func (*DatabaseHandle) Release added in v0.1.1

func (h *DatabaseHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error

func (*DatabaseHandle) Unlock added in v0.1.1

func (h *DatabaseHandle) Unlock(ctx context.Context, req *fuse.UnlockRequest) error

Unlock releases the lock on a byte range of the node. Locks can be released also implicitly, see HandleFlockLocker and HandlePOSIXLocker.

func (*DatabaseHandle) Write added in v0.1.1

type DatabaseNode added in v0.1.1

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

DatabaseNode represents a SQLite database file.

func (*DatabaseNode) Attr added in v0.1.1

func (n *DatabaseNode) Attr(ctx context.Context, attr *fuse.Attr) error

func (*DatabaseNode) Forget added in v0.1.1

func (n *DatabaseNode) Forget()

func (*DatabaseNode) Fsync added in v0.1.1

func (n *DatabaseNode) Fsync(ctx context.Context, req *fuse.FsyncRequest) error

func (*DatabaseNode) Open added in v0.1.1

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

type Error added in v0.1.1

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

Error wraps an error to return a "No Entry" FUSE error.

func (*Error) Errno added in v0.1.1

func (e *Error) Errno() fuse.Errno

func (*Error) Error added in v0.1.1

func (e *Error) Error() string

type FileSystem

type FileSystem struct {

	// User & Group ID for all files in the filesystem.
	Uid int
	Gid int

	// If true, logs debug information about every FUSE call.
	Debug bool
	// contains filtered or unexported fields
}

FileSystem represents a raw interface to the FUSE file system.

func NewFileSystem

func NewFileSystem(path string, store *litefs.Store) *FileSystem

NewFileSystem returns a new instance of FileSystem.

func (*FileSystem) InvalidateDB added in v0.1.1

func (fsys *FileSystem) InvalidateDB(db *litefs.DB, offset, size int64) error

InvalidateDB invalidates a database in the kernel page cache.

func (*FileSystem) Mount

func (fsys *FileSystem) Mount() (err error)

Mount mounts the file system to the mount point.

func (*FileSystem) Path

func (fsys *FileSystem) Path() string

Path returns the path to the mount point.

func (*FileSystem) Root added in v0.1.1

func (fsys *FileSystem) Root() (fs.Node, error)

Root returns the root directory in the file system.

func (*FileSystem) Store

func (fsys *FileSystem) Store() *litefs.Store

Store returns the underlying store.

func (*FileSystem) Unmount

func (fsys *FileSystem) Unmount() (err error)

Unmount unmounts the file system.

type JournalHandle added in v0.1.1

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

JournalHandle represents a file handle to a SQLite journal file.

func (*JournalHandle) Flush added in v0.1.1

func (h *JournalHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error

func (*JournalHandle) Read added in v0.1.1

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

func (*JournalHandle) Release added in v0.1.1

func (h *JournalHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error

func (*JournalHandle) Write added in v0.1.1

type JournalNode added in v0.1.1

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

JournalNode represents a SQLite rollback journal file.

func (*JournalNode) Attr added in v0.1.1

func (n *JournalNode) Attr(ctx context.Context, attr *fuse.Attr) error

func (*JournalNode) Forget added in v0.1.1

func (n *JournalNode) Forget()

func (*JournalNode) Fsync added in v0.1.1

func (n *JournalNode) Fsync(ctx context.Context, req *fuse.FsyncRequest) error

Fsync performs an fsync() on the underlying file.

func (*JournalNode) Open added in v0.1.1

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

func (*JournalNode) Setattr added in v0.1.1

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

type PrimaryNode added in v0.1.1

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

PrimaryNode represents a file for returning the current primary node.

func (*PrimaryNode) Attr added in v0.1.1

func (n *PrimaryNode) Attr(ctx context.Context, attr *fuse.Attr) error

func (*PrimaryNode) Forget added in v0.1.1

func (n *PrimaryNode) Forget()

func (*PrimaryNode) ReadAll added in v0.1.1

func (n *PrimaryNode) ReadAll(ctx context.Context) ([]byte, error)

type RootHandle added in v0.1.1

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

RootHandle represents a directory handle for the root directory.

func NewRootHandle added in v0.1.1

func NewRootHandle(node *RootNode) *RootHandle

NewRootHandle returns a new instance of RootHandle.

func (*RootHandle) ReadDirAll added in v0.1.1

func (h *RootHandle) ReadDirAll(ctx context.Context) (ents []fuse.Dirent, err error)

type RootNode added in v0.1.1

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

RootNode represents the root directory of the FUSE mount.

func (*RootNode) Attr added in v0.1.1

func (n *RootNode) Attr(ctx context.Context, attr *fuse.Attr) error

Attr returns the attributes for the root directory.

func (*RootNode) Create added in v0.1.1

func (n *RootNode) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (node fs.Node, h fs.Handle, err error)

func (*RootNode) ForgetNode added in v0.1.1

func (n *RootNode) ForgetNode(node fs.Node)

ForgetNode removes the node from the node map.

func (*RootNode) Fsync added in v0.1.1

func (n *RootNode) Fsync(ctx context.Context, req *fuse.FsyncRequest) error

Fsync is a no-op as directory sync is handled by the file. This is required as the database files are grouped by database internally.

func (*RootNode) Lookup added in v0.1.1

func (n *RootNode) Lookup(ctx context.Context, name string) (node fs.Node, err error)

Lookup returns a node for a file in the root directory.

func (*RootNode) Node added in v0.1.1

func (n *RootNode) Node(name string) fs.Node

Node returns a child node by filename. Returns nil if it does not exist.

func (*RootNode) Open added in v0.1.1

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

func (*RootNode) Remove added in v0.1.1

func (n *RootNode) Remove(ctx context.Context, req *fuse.RemoveRequest) (err error)

Remove deletes the file from disk. This is only supported on the journal file currently.

Jump to

Keyboard shortcuts

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