libfuse

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package libfuse defines the component that interacts with the FUSE filesystem and defines all functions to interface with FUSE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLibfuseComponent

func NewLibfuseComponent() internal.Component

Pipeline will call this method to create your object, initialize your variables here << DO NOT DELETE ANY AUTO GENERATED CODE HERE >>

Types

type CgofuseFS

type CgofuseFS struct {
	// Implement the interface from cgofuse
	fuse.FileSystemBase
	// contains filtered or unexported fields
}

CgofuseFS defines the file system with functions that interface with FUSE.

func NewcgofuseFS

func NewcgofuseFS() *CgofuseFS

NewcgofuseFS creates a new empty fuse filesystem.

func (*CgofuseFS) Access

func (cf *CgofuseFS) Access(path string, mask uint32) int

Access is not implemented.

func (*CgofuseFS) Chmod

func (cf *CgofuseFS) Chmod(path string, mode uint32) int

Chmod changes permissions of a file.

func (*CgofuseFS) Chown

func (cf *CgofuseFS) Chown(path string, uid uint32, gid uint32) int

Chown changes the owner of a file.

func (*CgofuseFS) Create

func (cf *CgofuseFS) Create(path string, flags int, mode uint32) (int, uint64)

Create creates a new file and opens it.

func (*CgofuseFS) Destroy

func (cf *CgofuseFS) Destroy()

Destroy currently does nothing.

func (*CgofuseFS) Flush

func (cf *CgofuseFS) Flush(path string, fh uint64) int

Flush flushes any cached file data.

func (*CgofuseFS) Fsync

func (cf *CgofuseFS) Fsync(path string, datasync bool, fh uint64) int

Fsync synchronizes the file.

func (*CgofuseFS) Fsyncdir

func (cf *CgofuseFS) Fsyncdir(path string, datasync bool, fh uint64) int

Fsyncdir synchronizes a directory.

func (*CgofuseFS) Getattr

func (cf *CgofuseFS) Getattr(path string, stat *fuse.Stat_t, fh uint64) int

Getattr retrieves the file attributes at the path and fills them in stat.

func (*CgofuseFS) Getxattr

func (cf *CgofuseFS) Getxattr(path string, name string) (int, []byte)

Getxattr is not implemented.

func (*CgofuseFS) Init

func (cf *CgofuseFS) Init()

Init notifies the parent process once the mount is successful.

func (cf *CgofuseFS) Link(oldpath string, newpath string) int

Link is not implemented.

func (*CgofuseFS) Listxattr

func (cf *CgofuseFS) Listxattr(path string, fill func(name string) bool) int

Listxattr is not implemented.

func (*CgofuseFS) Mkdir

func (cf *CgofuseFS) Mkdir(path string, mode uint32) int

Mkdir creates a new directory at the path with the given mode.

func (*CgofuseFS) Mknod

func (cf *CgofuseFS) Mknod(path string, mode uint32, dev uint64) int

Mknod is not implemented.

func (*CgofuseFS) Open

func (cf *CgofuseFS) Open(path string, flags int) (int, uint64)

Open opens a file.

func (*CgofuseFS) Opendir

func (cf *CgofuseFS) Opendir(path string) (int, uint64)

Opendir opens the directory at the path.

func (*CgofuseFS) Read

func (cf *CgofuseFS) Read(path string, buff []byte, ofst int64, fh uint64) int

Read reads data from a file into the buffer with the given offset.

func (*CgofuseFS) Readdir

func (cf *CgofuseFS) Readdir(path string, fill func(name string, stat *fuse.Stat_t, ofst int64) bool, ofst int64, fh uint64) int

Readdir reads a directory at the path.

func (cf *CgofuseFS) Readlink(path string) (int, string)

Readlink reads the target of a symbolic link.

func (*CgofuseFS) Release

func (cf *CgofuseFS) Release(path string, fh uint64) int

Release closes an open file.

func (*CgofuseFS) Releasedir

func (cf *CgofuseFS) Releasedir(path string, fh uint64) int

Releasedir opens the handle for the directory at the path.

func (*CgofuseFS) Removexattr

func (cf *CgofuseFS) Removexattr(path string, name string) int

Removexattr is not implemented.

func (*CgofuseFS) Rename

func (cf *CgofuseFS) Rename(oldpath string, newpath string) int

Rename renames a file. https://man7.org/linux/man-pages/man2/rename.2.html errors handled: EISDIR, ENOENT, ENOTDIR, ENOTEMPTY, EEXIST TODO: handle EACCESS, EINVAL?

func (*CgofuseFS) Rmdir

func (cf *CgofuseFS) Rmdir(path string) int

Rmdir deletes a directory.

func (*CgofuseFS) Setxattr

func (cf *CgofuseFS) Setxattr(path string, name string, value []byte, flags int) int

Setxattr is not implemented.

func (*CgofuseFS) Statfs

func (cf *CgofuseFS) Statfs(path string, stat *fuse.Statfs_t) int

Statfs sets file system statistics. It returns 0 if successful.

func (cf *CgofuseFS) Symlink(target string, newpath string) int

Symlink creates a symbolic link

func (*CgofuseFS) Truncate

func (cf *CgofuseFS) Truncate(path string, size int64, fh uint64) int

Truncate changes the size of the given file.

func (cf *CgofuseFS) Unlink(path string) int

Unlink deletes a file.

func (*CgofuseFS) Utimens

func (cf *CgofuseFS) Utimens(path string, tmsp []fuse.Timespec) int

Utimens changes the access and modification time of a file.

func (*CgofuseFS) Write

func (cf *CgofuseFS) Write(path string, buff []byte, ofst int64, fh uint64) int

Write writes data to a file from the buffer with the given offset.

type Libfuse

type Libfuse struct {
	internal.BaseComponent
	// contains filtered or unexported fields
}

Libfuse holds the settings and information for the FUSE component.

func (*Libfuse) Configure

func (lf *Libfuse) Configure(_ bool) error

Configure : Pipeline will call this method after constructor so that you can read config and initialize yourself

Return failure if any config is not valid to exit the process

func (*Libfuse) Name

func (lf *Libfuse) Name() string

Name returns the component name.

func (*Libfuse) Priority

func (lf *Libfuse) Priority() internal.ComponentPriority

func (*Libfuse) SetName

func (lf *Libfuse) SetName(name string)

SetName sets the component name.

func (*Libfuse) SetNextComponent

func (lf *Libfuse) SetNextComponent(nc internal.Component)

SetNextComponent sets the next component in the pipeline.

func (*Libfuse) Start

func (lf *Libfuse) Start(ctx context.Context) error

Start : Pipeline calls this method to start the component functionality

this shall not block the call otherwise pipeline will not start

func (*Libfuse) Stop

func (lf *Libfuse) Stop() error

Stop : Stop the component functionality and kill all threads started

func (*Libfuse) Validate

func (lf *Libfuse) Validate(opt *LibfuseOptions) error

Validate : Validate available config and convert them if required

type LibfuseOptions

type LibfuseOptions struct {
	DefaultPermission       uint32 `config:"default-permission" yaml:"default-permission,omitempty"`
	AttributeExpiration     uint32 `config:"attribute-expiration-sec" yaml:"attribute-expiration-sec,omitempty"`
	EntryExpiration         uint32 `config:"entry-expiration-sec" yaml:"entry-expiration-sec,omitempty"`
	NegativeEntryExpiration uint32 `config:"negative-entry-expiration-sec" yaml:"negative-entry-expiration-sec,omitempty"`
	EnableFuseTrace         bool   `config:"fuse-trace" yaml:"fuse-trace,omitempty"`

	ExtensionPath         string `config:"extension" yaml:"extension,omitempty"`
	DisableWritebackCache bool   `config:"disable-writeback-cache" yaml:"-"`
	IgnoreOpenFlags       bool   `config:"ignore-open-flags" yaml:"ignore-open-flags,omitempty"`

	NetworkShare      bool   `config:"network-share" yaml:"network-share,omitempty"`
	Uid               uint32 `config:"uid" yaml:"uid,omitempty"`
	Gid               uint32 `config:"gid" yaml:"gid,omitempty"`
	MaxFuseThreads    uint32 `config:"max-fuse-threads" yaml:"max-fuse-threads,omitempty"`
	DirectIO          bool   `config:"direct-io" yaml:"direct-io,omitempty"`
	Umask             uint32 `config:"umask" yaml:"umask,omitempty"`
	DisplayCapacityMb uint64 `config:"display-capacity-mb" yaml:"display-capacity-mb,omitempty"`
	// contains filtered or unexported fields
}

LibfuseOptions defines the config parameters.

Jump to

Keyboard shortcuts

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