Documentation ¶
Index ¶
- Constants
- type ChunkedDirtyPages
- func (pages *ChunkedDirtyPages) AddPage(offset int64, data []byte, isSequential bool)
- func (pages ChunkedDirtyPages) Destroy()
- func (pages *ChunkedDirtyPages) FlushData() error
- func (pages *ChunkedDirtyPages) GetStorageOptions() (collection, replication string)
- func (pages *ChunkedDirtyPages) LockForRead(startOffset, stopOffset int64)
- func (pages *ChunkedDirtyPages) ReadDirtyDataAt(data []byte, startOffset int64) (maxStop int64)
- func (pages *ChunkedDirtyPages) UnlockForRead(startOffset, stopOffset int64)
- type DirectoryHandle
- type DirectoryHandleId
- type DirectoryHandleToInode
- type FileHandle
- type FileHandleId
- type FileHandleToInode
- func (i *FileHandleToInode) AcquireFileHandle(wfs *WFS, inode uint64, entry *filer_pb.Entry) *FileHandle
- func (i *FileHandleToInode) FindFileHandle(inode uint64) (fh *FileHandle, found bool)
- func (i *FileHandleToInode) GetFileHandle(fh FileHandleId) *FileHandle
- func (i *FileHandleToInode) ReleaseByHandle(fh FileHandleId)
- func (i *FileHandleToInode) ReleaseByInode(inode uint64)
- type InodeEntry
- type InodeToPath
- func (i *InodeToPath) AllocateInode(path util.FullPath, unixTime int64) uint64
- func (i *InodeToPath) Forget(inode, nlookup uint64, onForgetDir func(dir util.FullPath))
- func (i *InodeToPath) GetInode(path util.FullPath) uint64
- func (i *InodeToPath) GetPath(inode uint64) (util.FullPath, fuse.Status)
- func (i *InodeToPath) HasInode(inode uint64) bool
- func (i *InodeToPath) HasPath(path util.FullPath) bool
- func (i *InodeToPath) IsChildrenCached(fullpath util.FullPath) bool
- func (i *InodeToPath) Lookup(path util.FullPath, unixTime int64, isDirectory bool, isHardlink bool, ...) uint64
- func (i *InodeToPath) MarkChildrenCached(fullpath util.FullPath)
- func (i *InodeToPath) MovePath(sourcePath, targetPath util.FullPath) (replacedInode uint64)
- func (i *InodeToPath) RemovePath(path util.FullPath)
- type Option
- type PageWriter
- func (pw *PageWriter) AddPage(offset int64, data []byte, isSequentail bool)
- func (pw *PageWriter) Destroy()
- func (pw *PageWriter) FlushData() error
- func (pw *PageWriter) GetStorageOptions() (collection, replication string)
- func (pw *PageWriter) LockForRead(startOffset, stopOffset int64)
- func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64)
- func (pw *PageWriter) UnlockForRead(startOffset, stopOffset int64)
- type WFS
- func (wfs *WFS) Access(cancel <-chan struct{}, input *fuse.AccessIn) (code fuse.Status)
- func (wfs *WFS) AcquireDirectoryHandle() (DirectoryHandleId, *DirectoryHandle)
- func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status)
- func (wfs *WFS) AdjustedUrl(location *filer_pb.Location) string
- func (wfs *WFS) Configure(ctx context.Context, request *mount_pb.ConfigureRequest) (*mount_pb.ConfigureResponse, error)
- func (wfs *WFS) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn) (written uint32, code fuse.Status)
- func (wfs *WFS) Create(cancel <-chan struct{}, in *fuse.CreateIn, name string, out *fuse.CreateOut) (code fuse.Status)
- func (wfs *WFS) Fallocate(cancel <-chan struct{}, in *fuse.FallocateIn) (code fuse.Status)
- func (wfs *WFS) Flush(cancel <-chan struct{}, in *fuse.FlushIn) fuse.Status
- func (wfs *WFS) Forget(nodeid, nlookup uint64)
- func (wfs *WFS) Fsync(cancel <-chan struct{}, in *fuse.FsyncIn) (code fuse.Status)
- func (wfs *WFS) FsyncDir(cancel <-chan struct{}, input *fuse.FsyncIn) (code fuse.Status)
- func (wfs *WFS) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse.Status)
- func (wfs *WFS) GetDirectoryHandle(dhid DirectoryHandleId) *DirectoryHandle
- func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle
- func (wfs *WFS) GetLk(cancel <-chan struct{}, in *fuse.LkIn, out *fuse.LkOut) (code fuse.Status)
- func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, dest []byte) (size uint32, code fuse.Status)
- func (wfs *WFS) Init(server *fuse.Server)
- func (wfs *WFS) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *fuse.EntryOut) (code fuse.Status)
- func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []byte) (n uint32, code fuse.Status)
- func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name string, out *fuse.EntryOut) (code fuse.Status)
- func (wfs *WFS) LookupFn() wdclient.LookupFileIdFunctionType
- func (wfs *WFS) Lseek(cancel <-chan struct{}, in *fuse.LseekIn, out *fuse.LseekOut) fuse.Status
- func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (code fuse.Status)
- func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) (code fuse.Status)
- func (wfs *WFS) Open(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) (status fuse.Status)
- func (wfs *WFS) OpenDir(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.OpenOut) (code fuse.Status)
- func (wfs *WFS) Read(cancel <-chan struct{}, in *fuse.ReadIn, buff []byte) (fuse.ReadResult, fuse.Status)
- func (wfs *WFS) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status)
- func (wfs *WFS) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status)
- func (wfs *WFS) Readlink(cancel <-chan struct{}, header *fuse.InHeader) (out []byte, code fuse.Status)
- func (wfs *WFS) Release(cancel <-chan struct{}, in *fuse.ReleaseIn)
- func (wfs *WFS) ReleaseDir(input *fuse.ReleaseIn)
- func (wfs *WFS) ReleaseDirectoryHandle(dhid DirectoryHandleId)
- func (wfs *WFS) ReleaseHandle(handleId FileHandleId)
- func (wfs *WFS) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string) fuse.Status
- func (wfs *WFS) Rename(cancel <-chan struct{}, in *fuse.RenameIn, oldName string, newName string) (code fuse.Status)
- func (wfs *WFS) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status)
- func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse.Status)
- func (wfs *WFS) SetLk(cancel <-chan struct{}, in *fuse.LkIn) (code fuse.Status)
- func (wfs *WFS) SetLkw(cancel <-chan struct{}, in *fuse.LkIn) (code fuse.Status)
- func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr string, data []byte) fuse.Status
- func (wfs *WFS) StartBackgroundTasks()
- func (wfs *WFS) StatFs(cancel <-chan struct{}, in *fuse.InHeader, out *fuse.StatfsOut) (code fuse.Status)
- func (wfs *WFS) String() string
- func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, ...) (code fuse.Status)
- func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status)
- func (wfs *WFS) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) (err error)
- func (wfs *WFS) Write(cancel <-chan struct{}, in *fuse.WriteIn, data []byte) (written uint32, code fuse.Status)
- type WriterPattern
Constants ¶
const ( RenameEmptyFlag = 0 RenameNoReplace = 1 RenameExchange = fs.RENAME_EXCHANGE RenameWhiteout = 3 )
- Rename a file *
- If the target exists it should be atomically replaced. If
- the target's inode's lookup count is non-zero, the file
- system is expected to postpone any removal of the inode
- until the lookup count reaches zero (see description of the
- forget function). *
- If this request is answered with an error code of ENOSYS, this is
- treated as a permanent failure with error code EINVAL, i.e. all
- future bmap requests will fail with EINVAL without being
- send to the filesystem process. *
- *flags* may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If
- RENAME_NOREPLACE is specified, the filesystem must not
- overwrite *newname* if it exists and return an error
- instead. If `RENAME_EXCHANGE` is specified, the filesystem
- must atomically exchange the two files, i.e. both must
- exist and neither may be deleted. *
- Valid replies:
- fuse_reply_err *
- @param req request handle
- @param parent inode number of the old parent directory
- @param name old name
- @param newparent inode number of the new parent directory
- @param newname new name
renameat2()
renameat2() has an additional flags argument. A renameat2() call with a zero flags argument is equivalent to renameat(). The flags argument is a bit mask consisting of zero or more of the following flags: RENAME_EXCHANGE Atomically exchange oldpath and newpath. Both pathnames must exist but may be of different types (e.g., one could be a non-empty directory and the other a symbolic link). RENAME_NOREPLACE Don't overwrite newpath of the rename. Return an error if newpath already exists. RENAME_NOREPLACE can't be employed together with RENAME_EXCHANGE. RENAME_NOREPLACE requires support from the underlying filesystem. Support for various filesystems was added as follows: * ext4 (Linux 3.15); * btrfs, tmpfs, and cifs (Linux 3.17); * xfs (Linux 4.0); * Support for many other filesystems was added in Linux 4.9, including ext2, minix, reiserfs, jfs, vfat, and bpf. RENAME_WHITEOUT (since Linux 3.18) This operation makes sense only for overlay/union filesystem implementations. Specifying RENAME_WHITEOUT creates a "whiteout" object at the source of the rename at the same time as performing the rename. The whole operation is atomic, so that if the rename succeeds then the whiteout will also have been created. A "whiteout" is an object that has special meaning in union/overlay filesystem constructs. In these constructs, multiple layers exist and only the top one is ever modified. A whiteout on an upper layer will effectively hide a matching file in the lower layer, making it appear as if the file didn't exist. When a file that exists on the lower layer is renamed, the file is first copied up (if not already on the upper layer) and then renamed on the upper, read-write layer. At the same time, the source file needs to be "whiteouted" (so that the version of the source file in the lower layer is rendered invisible). The whole operation needs to be done atomically. When not part of a union/overlay, the whiteout appears as a character device with a {0,0} device number. (Note that other union/overlay implementations may employ different methods for storing whiteout entries; specifically, BSD union mount employs a separate inode type, DT_WHT, which, while supported by some filesystems available in Linux, such as CODA and XFS, is ignored by the kernel's whiteout support code, as of Linux 4.19, at least.) RENAME_WHITEOUT requires the same privileges as creating a device node (i.e., the CAP_MKNOD capability). RENAME_WHITEOUT can't be employed together with RENAME_EXCHANGE. RENAME_WHITEOUT requires support from the underlying filesystem. Among the filesystems that support it are tmpfs (since Linux 3.18), ext4 (since Linux 3.18), XFS (since Linux 4.1), f2fs (since Linux 4.2), btrfs (since Linux 4.7), and ubifs (since Linux 4.9).
const ( // https://man7.org/linux/man-pages/man7/xattr.7.html#:~:text=The%20VFS%20imposes%20limitations%20that,in%20listxattr(2)). MAX_XATTR_NAME_SIZE = 255 MAX_XATTR_VALUE_SIZE = 65536 XATTR_PREFIX = "xattr-" // same as filer )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChunkedDirtyPages ¶
type ChunkedDirtyPages struct {
// contains filtered or unexported fields
}
func (*ChunkedDirtyPages) AddPage ¶
func (pages *ChunkedDirtyPages) AddPage(offset int64, data []byte, isSequential bool)
func (ChunkedDirtyPages) Destroy ¶
func (pages ChunkedDirtyPages) Destroy()
func (*ChunkedDirtyPages) FlushData ¶
func (pages *ChunkedDirtyPages) FlushData() error
func (*ChunkedDirtyPages) GetStorageOptions ¶
func (pages *ChunkedDirtyPages) GetStorageOptions() (collection, replication string)
func (*ChunkedDirtyPages) LockForRead ¶
func (pages *ChunkedDirtyPages) LockForRead(startOffset, stopOffset int64)
func (*ChunkedDirtyPages) ReadDirtyDataAt ¶
func (pages *ChunkedDirtyPages) ReadDirtyDataAt(data []byte, startOffset int64) (maxStop int64)
func (*ChunkedDirtyPages) UnlockForRead ¶
func (pages *ChunkedDirtyPages) UnlockForRead(startOffset, stopOffset int64)
type DirectoryHandle ¶
type DirectoryHandle struct {
// contains filtered or unexported fields
}
type DirectoryHandleId ¶
type DirectoryHandleId uint64
type DirectoryHandleToInode ¶
type DirectoryHandleToInode struct { // shares the file handle id sequencer with FileHandleToInode{nextFh} sync.Mutex // contains filtered or unexported fields }
func NewDirectoryHandleToInode ¶
func NewDirectoryHandleToInode() *DirectoryHandleToInode
type FileHandle ¶
func (*FileHandle) FullPath ¶
func (fh *FileHandle) FullPath() util.FullPath
func (*FileHandle) Release ¶
func (fh *FileHandle) Release()
type FileHandleId ¶
type FileHandleId uint64
type FileHandleToInode ¶
func NewFileHandleToInode ¶
func NewFileHandleToInode() *FileHandleToInode
func (*FileHandleToInode) AcquireFileHandle ¶
func (i *FileHandleToInode) AcquireFileHandle(wfs *WFS, inode uint64, entry *filer_pb.Entry) *FileHandle
func (*FileHandleToInode) FindFileHandle ¶
func (i *FileHandleToInode) FindFileHandle(inode uint64) (fh *FileHandle, found bool)
func (*FileHandleToInode) GetFileHandle ¶
func (i *FileHandleToInode) GetFileHandle(fh FileHandleId) *FileHandle
func (*FileHandleToInode) ReleaseByHandle ¶
func (i *FileHandleToInode) ReleaseByHandle(fh FileHandleId)
func (*FileHandleToInode) ReleaseByInode ¶
func (i *FileHandleToInode) ReleaseByInode(inode uint64)
type InodeEntry ¶
type InodeToPath ¶
func NewInodeToPath ¶
func NewInodeToPath(root util.FullPath) *InodeToPath
func (*InodeToPath) AllocateInode ¶
func (i *InodeToPath) AllocateInode(path util.FullPath, unixTime int64) uint64
func (*InodeToPath) Forget ¶
func (i *InodeToPath) Forget(inode, nlookup uint64, onForgetDir func(dir util.FullPath))
func (*InodeToPath) HasInode ¶
func (i *InodeToPath) HasInode(inode uint64) bool
func (*InodeToPath) IsChildrenCached ¶
func (i *InodeToPath) IsChildrenCached(fullpath util.FullPath) bool
func (*InodeToPath) MarkChildrenCached ¶
func (i *InodeToPath) MarkChildrenCached(fullpath util.FullPath)
func (*InodeToPath) MovePath ¶
func (i *InodeToPath) MovePath(sourcePath, targetPath util.FullPath) (replacedInode uint64)
func (*InodeToPath) RemovePath ¶
func (i *InodeToPath) RemovePath(path util.FullPath)
type Option ¶
type Option struct { MountDirectory string FilerAddresses []pb.ServerAddress GrpcDialOption grpc.DialOption FilerMountRootPath string Collection string Replication string TtlSec int32 DiskType types.DiskType ChunkSizeLimit int64 ConcurrentWriters int CacheDir string CacheSizeMB int64 DataCenter string Umask os.FileMode Quota int64 MountUid uint32 MountGid uint32 MountMode os.FileMode MountCtime time.Time MountMtime time.Time MountParentInode uint64 VolumeServerAccess string // how to access volume servers Cipher bool // whether encrypt data on volume server UidGidMapper *meta_cache.UidGidMapper // contains filtered or unexported fields }
type PageWriter ¶
type PageWriter struct {
// contains filtered or unexported fields
}
func (*PageWriter) AddPage ¶
func (pw *PageWriter) AddPage(offset int64, data []byte, isSequentail bool)
func (*PageWriter) Destroy ¶
func (pw *PageWriter) Destroy()
func (*PageWriter) FlushData ¶
func (pw *PageWriter) FlushData() error
func (*PageWriter) GetStorageOptions ¶
func (pw *PageWriter) GetStorageOptions() (collection, replication string)
func (*PageWriter) LockForRead ¶
func (pw *PageWriter) LockForRead(startOffset, stopOffset int64)
func (*PageWriter) ReadDirtyDataAt ¶
func (pw *PageWriter) ReadDirtyDataAt(data []byte, offset int64) (maxStop int64)
func (*PageWriter) UnlockForRead ¶
func (pw *PageWriter) UnlockForRead(startOffset, stopOffset int64)
type WFS ¶
type WFS struct { // https://dl.acm.org/doi/fullHtml/10.1145/3310148 // follow https://github.com/hanwen/go-fuse/blob/master/fuse/api.go fuse.RawFileSystem mount_pb.UnimplementedSeaweedMountServer fs.Inode IsOverQuota bool // contains filtered or unexported fields }
func NewSeaweedFileSystem ¶
func (*WFS) Access ¶
*
- Check file access permissions *
- This will be called for the access() system call. If the
- 'default_permissions' mount option is given, this method is not
- called. *
- This method is not called under Linux kernel versions 2.4.x
func (*WFS) AcquireDirectoryHandle ¶
func (wfs *WFS) AcquireDirectoryHandle() (DirectoryHandleId, *DirectoryHandle)
func (*WFS) AcquireHandle ¶
func (*WFS) Configure ¶
func (wfs *WFS) Configure(ctx context.Context, request *mount_pb.ConfigureRequest) (*mount_pb.ConfigureResponse, error)
func (*WFS) CopyFileRange ¶
func (wfs *WFS) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn) (written uint32, code fuse.Status)
*
- Copy a range of data from one file to anotherNiels de Vos, 4 years ago: • libfuse: add copy_file_range() support *
- Performs an optimized copy between two file descriptors without the
- additional cost of transferring data through the FUSE kernel module
- to user space (glibc) and then back into the FUSE filesystem again. *
- In case this method is not implemented, applications are expected to
- fall back to a regular file copy. (Some glibc versions did this
- emulation automatically, but the emulation has been removed from all
- glibc release branches.)
func (*WFS) Create ¶
func (wfs *WFS) Create(cancel <-chan struct{}, in *fuse.CreateIn, name string, out *fuse.CreateOut) (code fuse.Status)
*
- Create and open a file *
- If the file does not exist, first create it with the specified
- mode, and then open it. *
- If this method is not implemented or under Linux kernel
- versions earlier than 2.6.15, the mknod() and open() methods
- will be called instead.
func (*WFS) Fallocate ¶
func (wfs *WFS) Fallocate(cancel <-chan struct{}, in *fuse.FallocateIn) (code fuse.Status)
*
- Allocates space for an open file *
- This function ensures that required space is allocated for specified
- file. If this function returns success then any subsequent write
- request to specified range is guaranteed not to fail because of lack
- of space on the file system media.
func (*WFS) Flush ¶
*
Flush method *
This is called on each close() of the opened file. *
Since file descriptors can be duplicated (dup, dup2, fork), for
one open call there may be many flush calls. *
Filesystems shouldn't assume that flush will always be called
after some writes, or that if will be called at all. *
fi->fh will contain the value set by the open method, or will
be undefined if the open method didn't set any value. *
NOTE: the name of the method is misleading, since (unlike
fsync) the filesystem is not forced to flush pending writes.
One reason to flush data is if the filesystem wants to return
write errors during close. However, such use is non-portable
because POSIX does not require close to wait for delayed I/O to
complete. *
If the filesystem supports file locking operations (setlk,
getlk) it should remove all locks belonging to 'fi->owner'. *
If this request is answered with an error code of ENOSYS,
this is treated as success and future calls to flush() will
succeed automatically without being send to the filesystem
process. *
Valid replies:
fuse_reply_err *
@param req request handle
@param ino the inode number
@param fi file information *
func (*WFS) Forget ¶
Forget is called when the kernel discards entries from its dentry cache. This happens on unmount, and when the kernel is short on memory. Since it is not guaranteed to occur at any moment, and since there is no return value, Forget should not do I/O, as there is no channel to report back I/O errors. from https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h *
- Forget about an inode *
- This function is called when the kernel removes an inode
- from its internal caches. *
- The inode's lookup count increases by one for every call to
- fuse_reply_entry and fuse_reply_create. The nlookup parameter
- indicates by how much the lookup count should be decreased. *
- Inodes with a non-zero lookup count may receive request from
- the kernel even after calls to unlink, rmdir or (when
- overwriting an existing file) rename. Filesystems must handle
- such requests properly and it is recommended to defer removal
- of the inode until the lookup count reaches zero. Calls to
- unlink, rmdir or rename will be followed closely by forget
- unless the file or directory is open, in which case the
- kernel issues forget only after the release or releasedir
- calls. *
- Note that if a file system will be exported over NFS the
- inodes lifetime must extend even beyond forget. See the
- generation field in struct fuse_entry_param above. *
- On unmount the lookup count for all inodes implicitly drops
- to zero. It is not guaranteed that the file system will
- receive corresponding forget messages for the affected
- inodes. *
- Valid replies:
- fuse_reply_none *
- @param req request handle
- @param ino the inode number
- @param nlookup the number of lookups to forget
https://libfuse.github.io/doxygen/include_2fuse__lowlevel_8h.html
int fuse_reply_entry ( fuse_req_t req, const struct fuse_entry_param * e ) Reply with a directory entry
Possible requests: lookup, mknod, mkdir, symlink, link
Side effects: increments the lookup count on success
func (*WFS) Fsync ¶
*
- Synchronize file contents *
- If the datasync parameter is non-zero, then only the user data
- should be flushed, not the meta data. *
- If this request is answered with an error code of ENOSYS,
- this is treated as success and future calls to fsync() will
- succeed automatically without being send to the filesystem
- process. *
- Valid replies:
- fuse_reply_err *
- @param req request handle
- @param ino the inode number
- @param datasync flag indicating if only data should be flushed
- @param fi file information
func (*WFS) FsyncDir ¶
- Synchronize directory contents *
- If the directory has been removed after the call to opendir, the
- path parameter will be NULL. *
- If the datasync parameter is non-zero, then only the user data
- should be flushed, not the meta data
func (*WFS) GetDirectoryHandle ¶
func (wfs *WFS) GetDirectoryHandle(dhid DirectoryHandleId) *DirectoryHandle
func (*WFS) GetHandle ¶
func (wfs *WFS) GetHandle(handleId FileHandleId) *FileHandle
func (*WFS) GetXAttr ¶
func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, dest []byte) (size uint32, code fuse.Status)
GetXAttr reads an extended attribute, and should return the number of bytes. If the buffer is too small, return ERANGE, with the required buffer size.
func (*WFS) Link ¶
func (wfs *WFS) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *fuse.EntryOut) (code fuse.Status)
* Create a hard link to a file
func (*WFS) ListXAttr ¶
func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []byte) (n uint32, code fuse.Status)
ListXAttr lists extended attributes as '\0' delimited byte slice, and return the number of bytes. If the buffer is too small, return ERANGE, with the required buffer size.
func (*WFS) LookupFn ¶
func (wfs *WFS) LookupFn() wdclient.LookupFileIdFunctionType
func (*WFS) Mkdir ¶
func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (code fuse.Status)
- Create a directory *
- Note that the mode argument may not have the type specification
- bits set, i.e. S_ISDIR(mode) can be false. To obtain the
- correct directory type bits use mode|S_IFDIR *
func (*WFS) Mknod ¶
func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) (code fuse.Status)
- Create a file node *
- This is called for creation of all non-directory, non-symlink
- nodes. If the filesystem defines a create() method, then for
- regular files that will be called instead.
func (*WFS) Open ¶
func (wfs *WFS) Open(cancel <-chan struct{}, in *fuse.OpenIn, out *fuse.OpenOut) (status fuse.Status)
*
- Open a file *
- Open flags are available in fi->flags. The following rules
- apply. *
- - Creation (O_CREAT, O_EXCL, O_NOCTTY) flags will be
- filtered out / handled by the kernel. *
- - Access modes (O_RDONLY, O_WRONLY, O_RDWR) should be used
- by the filesystem to check if the operation is
- permitted. If the “-o default_permissions“ mount
- option is given, this check is already done by the
- kernel before calling open() and may thus be omitted by
- the filesystem. *
- - When writeback caching is enabled, the kernel may send
- read requests even for files opened with O_WRONLY. The
- filesystem should be prepared to handle this. *
- - When writeback caching is disabled, the filesystem is
- expected to properly handle the O_APPEND flag and ensure
- that each write is appending to the end of the file. *
- - When writeback caching is enabled, the kernel will
- handle O_APPEND. However, unless all changes to the file
- come through the kernel this will not work reliably. The
- filesystem should thus either ignore the O_APPEND flag
- (and let the kernel handle it), or return an error
- (indicating that reliably O_APPEND is not available). *
- Filesystem may store an arbitrary file handle (pointer,
- index, etc) in fi->fh, and use this in other all other file
- operations (read, write, flush, release, fsync). *
- Filesystem may also implement stateless file I/O and not store
- anything in fi->fh. *
- There are also some flags (direct_io, keep_cache) which the
- filesystem may set in fi, to change the way the file is opened.
- See fuse_file_info structure in <fuse_common.h> for more details. *
- If this request is answered with an error code of ENOSYS
- and FUSE_CAP_NO_OPEN_SUPPORT is set in
- `fuse_conn_info.capable`, this is treated as success and
- future calls to open and release will also succeed without being
- sent to the filesystem process. *
- Valid replies:
- fuse_reply_open
- fuse_reply_err *
- @param req request handle
- @param ino the inode number
- @param fi file information
func (*WFS) OpenDir ¶
func (wfs *WFS) OpenDir(cancel <-chan struct{}, input *fuse.OpenIn, out *fuse.OpenOut) (code fuse.Status)
- Open directory *
- Unless the 'default_permissions' mount option is given,
- this method should check if opendir is permitted for this
- directory. Optionally opendir may also return an arbitrary
- filehandle in the fuse_file_info structure, which will be
- passed to readdir, releasedir and fsyncdir.
func (*WFS) Read ¶
func (wfs *WFS) Read(cancel <-chan struct{}, in *fuse.ReadIn, buff []byte) (fuse.ReadResult, fuse.Status)
*
- Read data *
- Read should send exactly the number of bytes requested except
- on EOF or error, otherwise the rest of the data will be
- substituted with zeroes. An exception to this is when the file
- has been opened in 'direct_io' mode, in which case the return
- value of the read system call will reflect the return value of
- this operation. *
- fi->fh will contain the value set by the open method, or will
- be undefined if the open method didn't set any value. *
- Valid replies:
- fuse_reply_buf
- fuse_reply_iov
- fuse_reply_data
- fuse_reply_err *
- @param req request handle
- @param ino the inode number
- @param size number of bytes to read
- @param off offset to read from
- @param fi file information
func (*WFS) ReadDir ¶
func (wfs *WFS) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status)
- Read directory *
- The filesystem may choose between two modes of operation: *
- 1) The readdir implementation ignores the offset parameter, and
- passes zero to the filler function's offset. The filler
- function will not return '1' (unless an error happens), so the
- whole directory is read in a single readdir operation. *
- 2) The readdir implementation keeps track of the offsets of the
- directory entries. It uses the offset parameter and always
- passes non-zero offset to the filler function. When the buffer
- is full (or an error happens) the filler function will return
- '1'.
func (*WFS) ReadDirPlus ¶
func (*WFS) Release ¶
*
- Release an open file *
- Release is called when there are no more references to an open
- file: all file descriptors are closed and all memory mappings
- are unmapped. *
- For every open call there will be exactly one release call (unless
- the filesystem is force-unmounted). *
- The filesystem may reply with an error, but error values are
- not returned to close() or munmap() which triggered the
- release. *
- fi->fh will contain the value set by the open method, or will
- be undefined if the open method didn't set any value.
- fi->flags will contain the same flags as for open. *
- Valid replies:
- fuse_reply_err *
- @param req request handle
- @param ino the inode number
- @param fi file information
func (*WFS) ReleaseDir ¶
- Release directory *
- If the directory has been removed after the call to opendir, the
- path parameter will be NULL.
func (*WFS) ReleaseDirectoryHandle ¶
func (wfs *WFS) ReleaseDirectoryHandle(dhid DirectoryHandleId)
func (*WFS) ReleaseHandle ¶
func (wfs *WFS) ReleaseHandle(handleId FileHandleId)
func (*WFS) RemoveXAttr ¶
RemoveXAttr removes an extended attribute.
func (*WFS) Rmdir ¶
func (wfs *WFS) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status)
* Remove a directory
func (*WFS) SetXAttr ¶
func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr string, data []byte) fuse.Status
SetXAttr writes an extended attribute. https://man7.org/linux/man-pages/man2/setxattr.2.html
By default (i.e., flags is zero), the extended attribute will be created if it does not exist, or the value will be replaced if the attribute already exists. To modify these semantics, one of the following values can be specified in flags: XATTR_CREATE Perform a pure create, which fails if the named attribute exists already. XATTR_REPLACE Perform a pure replace operation, which fails if the named attribute does not already exist.
func (*WFS) StartBackgroundTasks ¶
func (wfs *WFS) StartBackgroundTasks()
func (*WFS) Symlink ¶
func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, out *fuse.EntryOut) (code fuse.Status)
* Create a symbolic link
func (*WFS) Unlink ¶
func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name string) (code fuse.Status)
* Remove a file
func (*WFS) WithFilerClient ¶
func (*WFS) Write ¶
func (wfs *WFS) Write(cancel <-chan struct{}, in *fuse.WriteIn, data []byte) (written uint32, code fuse.Status)
*
- Write data *
- Write should return exactly the number of bytes requested
- except on error. An exception to this is when the file has
- been opened in 'direct_io' mode, in which case the return value
- of the write system call will reflect the return value of this
- operation. *
- Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is
- expected to reset the setuid and setgid bits. *
- fi->fh will contain the value set by the open method, or will
- be undefined if the open method didn't set any value. *
- Valid replies:
- fuse_reply_write
- fuse_reply_err *
- @param req request handle
- @param ino the inode number
- @param buf data to write
- @param size number of bytes to write
- @param off offset to write to
- @param fi file information
type WriterPattern ¶
type WriterPattern struct {
// contains filtered or unexported fields
}
func NewWriterPattern ¶
func NewWriterPattern(chunkSize int64) *WriterPattern
func (*WriterPattern) IsRandomMode ¶
func (rp *WriterPattern) IsRandomMode() bool
func (*WriterPattern) IsStreamingMode ¶
func (rp *WriterPattern) IsStreamingMode() bool
func (*WriterPattern) MonitorWriteAt ¶
func (rp *WriterPattern) MonitorWriteAt(offset int64, size int)
func (*WriterPattern) Reset ¶
func (rp *WriterPattern) Reset()
Source Files ¶
- dirty_pages_chunked.go
- filehandle.go
- filehandle_map.go
- filehandle_read.go
- inode_to_path.go
- page_writer.go
- page_writer_pattern.go
- weedfs.go
- weedfs_attr.go
- weedfs_attr_linux.go
- weedfs_dir_lookup.go
- weedfs_dir_mkrm.go
- weedfs_dir_read.go
- weedfs_file_io.go
- weedfs_file_mkrm.go
- weedfs_file_read.go
- weedfs_file_sync.go
- weedfs_file_write.go
- weedfs_filehandle.go
- weedfs_forget.go
- weedfs_grpc_server.go
- weedfs_link.go
- weedfs_quota.go
- weedfs_rename.go
- weedfs_stats.go
- weedfs_symlink.go
- weedfs_unsupported.go
- weedfs_write.go
- weedfs_xattr.go
- wfs_filer_client.go
- wfs_save.go