pub struct S3FuseFilesystem<Client>{ /* private fields */ }Expand description
This is just a thin wrapper around S3Filesystem that implements the actual fuser protocol,
so that we can test our actual filesystem implementation without having actual FUSE in the loop.
Implementations§
Source§impl<Client> S3FuseFilesystem<Client>
impl<Client> S3FuseFilesystem<Client>
pub fn new( fs: S3Filesystem<Client>, error_logger: Option<Box<dyn ErrorLogger + Send + Sync>>, ) -> Self
Trait Implementations§
Source§impl<Client> Filesystem for S3FuseFilesystem<Client>
impl<Client> Filesystem for S3FuseFilesystem<Client>
Source§fn init(
&self,
req: &Request<'_>,
config: &mut KernelConfig,
) -> Result<(), c_int>
fn init( &self, req: &Request<'_>, config: &mut KernelConfig, ) -> Result<(), c_int>
Initialize filesystem.
Called before any other filesystem method.
The kernel module connection can be configured using the KernelConfig object
Source§fn lookup(
&self,
req: &Request<'_>,
parent: InodeNo,
name: &OsStr,
reply: ReplyEntry,
)
fn lookup( &self, req: &Request<'_>, parent: InodeNo, name: &OsStr, reply: ReplyEntry, )
Look up a directory entry by name and get its attributes.
Source§fn getattr(
&self,
req: &Request<'_>,
ino: InodeNo,
_fh: Option<u64>,
reply: ReplyAttr,
)
fn getattr( &self, req: &Request<'_>, ino: InodeNo, _fh: Option<u64>, reply: ReplyAttr, )
Get file attributes.
Source§fn forget(&self, req: &Request<'_>, ino: u64, nlookup: u64)
fn forget(&self, req: &Request<'_>, ino: u64, nlookup: u64)
Forget about an inode.
The nlookup parameter indicates the number of lookups previously performed on
this inode. If the filesystem implements inode lifetimes, it is recommended that
inodes acquire a single reference on each lookup, and lose nlookup references on
each forget. The filesystem may ignore forget calls, if the inodes don’t need to
have a limited lifetime. On unmount it is not guaranteed, that all referenced
inodes will receive a forget message.
Source§fn open(&self, req: &Request<'_>, ino: InodeNo, flags: i32, reply: ReplyOpen)
fn open(&self, req: &Request<'_>, ino: InodeNo, flags: i32, reply: ReplyOpen)
Open a file.
Open flags (with the exception of O_CREAT, O_EXCL, O_NOCTTY and O_TRUNC) are
available in flags. Filesystem may store an arbitrary file handle (pointer, index,
etc) in 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 fh. There are also some flags (direct_io, keep_cache) which the
filesystem may set, to change the way the file is opened. See fuse_file_info
structure in <fuse_common.h> for more details.
Source§fn read(
&self,
req: &Request<'_>,
ino: InodeNo,
fh: u64,
offset: i64,
size: u32,
flags: i32,
lock: Option<u64>,
reply: ReplyData,
)
fn read( &self, req: &Request<'_>, ino: InodeNo, fh: u64, offset: i64, size: u32, flags: i32, lock: Option<u64>, reply: ReplyData, )
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. fh will contain the value set by the open method, or will be undefined
if the open method didn’t set any value. Read more
Source§fn opendir(
&self,
req: &Request<'_>,
parent: InodeNo,
flags: i32,
reply: ReplyOpen,
)
fn opendir( &self, req: &Request<'_>, parent: InodeNo, flags: i32, reply: ReplyOpen, )
Open a directory.
Filesystem may store an arbitrary file handle (pointer, index, etc) in fh, and
use this in other all other directory stream operations (readdir, releasedir,
fsyncdir). Filesystem may also implement stateless directory I/O and not store
anything in fh, though that makes it impossible to implement standard conforming
directory stream operations in case the contents of the directory can change
between opendir and releasedir.
Source§fn readdir(
&self,
req: &Request<'_>,
parent: InodeNo,
fh: u64,
offset: i64,
reply: ReplyDirectory,
)
fn readdir( &self, req: &Request<'_>, parent: InodeNo, fh: u64, offset: i64, reply: ReplyDirectory, )
Read directory.
Send a buffer filled using buffer.fill(), with size not exceeding the
requested size. Send an empty buffer on end of stream. fh will contain the
value set by the opendir method, or will be undefined if the opendir method
didn’t set any value.
Source§fn readdirplus(
&self,
req: &Request<'_>,
parent: InodeNo,
fh: u64,
offset: i64,
reply: ReplyDirectoryPlus,
)
fn readdirplus( &self, req: &Request<'_>, parent: InodeNo, fh: u64, offset: i64, reply: ReplyDirectoryPlus, )
Read directory.
Send a buffer filled using buffer.fill(), with size not exceeding the
requested size. Send an empty buffer on end of stream. fh will contain the
value set by the opendir method, or will be undefined if the opendir method
didn’t set any value.
Source§fn fsync(
&self,
req: &Request<'_>,
ino: u64,
fh: u64,
datasync: bool,
reply: ReplyEmpty,
)
fn fsync( &self, req: &Request<'_>, ino: u64, fh: u64, datasync: bool, reply: ReplyEmpty, )
Synchronize file contents.
If the datasync parameter is non-zero, then only the user data should be flushed,
not the meta data.
Source§fn flush(
&self,
req: &Request<'_>,
ino: u64,
fh: u64,
lock_owner: u64,
reply: ReplyEmpty,
)
fn flush( &self, req: &Request<'_>, ino: u64, fh: u64, lock_owner: u64, reply: ReplyEmpty, )
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. 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. If the filesystem supports file locking
operations (setlk, getlk) it should remove all locks belonging to ‘lock_owner’.
Source§fn release(
&self,
req: &Request<'_>,
ino: InodeNo,
fh: u64,
flags: i32,
lock_owner: Option<u64>,
flush: bool,
reply: ReplyEmpty,
)
fn release( &self, req: &Request<'_>, ino: InodeNo, fh: u64, flags: i32, lock_owner: Option<u64>, flush: bool, reply: ReplyEmpty, )
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. The filesystem may reply with an
error, but error values are not returned to close() or munmap() which triggered
the release. fh will contain the value set by the open method, or will be undefined
if the open method didn’t set any value. flags will contain the same flags as for
open.
Source§fn releasedir(
&self,
req: &Request<'_>,
ino: u64,
fh: u64,
flags: i32,
reply: ReplyEmpty,
)
fn releasedir( &self, req: &Request<'_>, ino: u64, fh: u64, flags: i32, reply: ReplyEmpty, )
Release an open directory.
For every opendir call there will be exactly one releasedir call. fh will
contain the value set by the opendir method, or will be undefined if the
opendir method didn’t set any value.
Source§fn mknod(
&self,
req: &Request<'_>,
parent: InodeNo,
name: &OsStr,
mode: u32,
umask: u32,
rdev: u32,
reply: ReplyEntry,
)
fn mknod( &self, req: &Request<'_>, parent: InodeNo, name: &OsStr, mode: u32, umask: u32, rdev: u32, reply: ReplyEntry, )
Create file node.
Create a regular file, character device, block device, fifo or socket node.
Source§fn mkdir(
&self,
req: &Request<'_>,
parent: u64,
name: &OsStr,
mode: u32,
umask: u32,
reply: ReplyEntry,
)
fn mkdir( &self, req: &Request<'_>, parent: u64, name: &OsStr, mode: u32, umask: u32, reply: ReplyEntry, )
Create a directory.
Source§fn write(
&self,
req: &Request<'_>,
ino: InodeNo,
fh: u64,
offset: i64,
data: &[u8],
write_flags: u32,
flags: i32,
lock_owner: Option<u64>,
reply: ReplyWrite,
)
fn write( &self, req: &Request<'_>, ino: InodeNo, fh: u64, offset: i64, data: &[u8], write_flags: u32, flags: i32, lock_owner: Option<u64>, reply: ReplyWrite, )
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. fh will contain the value set by the open method, or
will be undefined if the open method didn’t set any value. Read more
Source§fn rmdir(&self, req: &Request<'_>, parent: u64, name: &OsStr, reply: ReplyEmpty)
fn rmdir(&self, req: &Request<'_>, parent: u64, name: &OsStr, reply: ReplyEmpty)
Remove a directory.
Source§fn unlink(
&self,
req: &Request<'_>,
parent: InodeNo,
name: &OsStr,
reply: ReplyEmpty,
)
fn unlink( &self, req: &Request<'_>, parent: InodeNo, name: &OsStr, reply: ReplyEmpty, )
Remove a file.
Source§fn setattr(
&self,
req: &Request<'_>,
ino: u64,
_mode: Option<u32>,
_uid: Option<u32>,
_gid: Option<u32>,
size: Option<u64>,
atime: Option<TimeOrNow>,
mtime: Option<TimeOrNow>,
_ctime: Option<SystemTime>,
_fh: Option<u64>,
_crtime: Option<SystemTime>,
_chgtime: Option<SystemTime>,
_bkuptime: Option<SystemTime>,
flags: Option<u32>,
reply: ReplyAttr,
)
fn setattr( &self, req: &Request<'_>, ino: u64, _mode: Option<u32>, _uid: Option<u32>, _gid: Option<u32>, size: Option<u64>, atime: Option<TimeOrNow>, mtime: Option<TimeOrNow>, _ctime: Option<SystemTime>, _fh: Option<u64>, _crtime: Option<SystemTime>, _chgtime: Option<SystemTime>, _bkuptime: Option<SystemTime>, flags: Option<u32>, reply: ReplyAttr, )
Set file attributes.
Source§fn symlink(
&self,
_req: &Request<'_>,
parent: u64,
name: &OsStr,
link: &Path,
reply: ReplyEntry,
)
fn symlink( &self, _req: &Request<'_>, parent: u64, name: &OsStr, link: &Path, reply: ReplyEntry, )
Create a symbolic link.
Source§fn rename(
&self,
req: &Request<'_>,
parent: u64,
name: &OsStr,
newparent: u64,
newname: &OsStr,
flags: u32,
reply: ReplyEmpty,
)
fn rename( &self, req: &Request<'_>, parent: u64, name: &OsStr, newparent: u64, newname: &OsStr, flags: u32, reply: ReplyEmpty, )
Rename a file.
Source§fn link(
&self,
_req: &Request<'_>,
ino: u64,
newparent: u64,
newname: &OsStr,
reply: ReplyEntry,
)
fn link( &self, _req: &Request<'_>, ino: u64, newparent: u64, newname: &OsStr, reply: ReplyEntry, )
Create a hard link.
Source§fn fsyncdir(
&self,
_req: &Request<'_>,
ino: u64,
fh: u64,
datasync: bool,
reply: ReplyEmpty,
)
fn fsyncdir( &self, _req: &Request<'_>, ino: u64, fh: u64, datasync: bool, reply: ReplyEmpty, )
Synchronize directory contents.
If the datasync parameter is set, then only the directory contents should
be flushed, not the meta data. fh will contain the value set by the opendir
method, or will be undefined if the opendir method didn’t set any value.
Source§fn setxattr(
&self,
_req: &Request<'_>,
ino: u64,
name: &OsStr,
_value: &[u8],
_flags: i32,
_position: u32,
reply: ReplyEmpty,
)
fn setxattr( &self, _req: &Request<'_>, ino: u64, name: &OsStr, _value: &[u8], _flags: i32, _position: u32, reply: ReplyEmpty, )
Set an extended attribute.
Source§fn getxattr(
&self,
_req: &Request<'_>,
ino: u64,
name: &OsStr,
_size: u32,
reply: ReplyXattr,
)
fn getxattr( &self, _req: &Request<'_>, ino: u64, name: &OsStr, _size: u32, reply: ReplyXattr, )
Get an extended attribute.
If
size is 0, the size of the value should be sent with reply.size().
If size is not 0, and the value fits, send it with reply.data(), or
reply.error(ERANGE) if it doesn’t.Source§fn listxattr(&self, _req: &Request<'_>, ino: u64, _size: u32, reply: ReplyXattr)
fn listxattr(&self, _req: &Request<'_>, ino: u64, _size: u32, reply: ReplyXattr)
List extended attribute names.
If
size is 0, the size of the value should be sent with reply.size().
If size is not 0, and the value fits, send it with reply.data(), or
reply.error(ERANGE) if it doesn’t.Source§fn removexattr(
&self,
_req: &Request<'_>,
ino: u64,
name: &OsStr,
reply: ReplyEmpty,
)
fn removexattr( &self, _req: &Request<'_>, ino: u64, name: &OsStr, reply: ReplyEmpty, )
Remove an extended attribute.
Source§fn access(&self, _req: &Request<'_>, ino: u64, mask: i32, reply: ReplyEmpty)
fn access(&self, _req: &Request<'_>, ino: u64, mask: i32, reply: ReplyEmpty)
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
Source§fn create(
&self,
_req: &Request<'_>,
parent: u64,
name: &OsStr,
_mode: u32,
_umask: u32,
_flags: i32,
reply: ReplyCreate,
)
fn create( &self, _req: &Request<'_>, parent: u64, name: &OsStr, _mode: u32, _umask: u32, _flags: i32, reply: ReplyCreate, )
Create and open a file.
If the file does not exist, first create it with the specified mode, and then
open it. You can use any open flags in the flags parameter except O_NOCTTY.
The filesystem can store any type of file handle (such as a pointer or index)
in fh, which can then be used across all subsequent file operations including
read, write, flush, release, and fsync. Additionally, the filesystem may set
certain flags like direct_io and keep_cache to change the way the file is
opened. See fuse_file_info structure in <fuse_common.h> for more details. 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.
Source§fn getlk(
&self,
_req: &Request<'_>,
ino: u64,
fh: u64,
_lock_owner: u64,
_start: u64,
_end: u64,
_typ: i32,
pid: u32,
reply: ReplyLock,
)
fn getlk( &self, _req: &Request<'_>, ino: u64, fh: u64, _lock_owner: u64, _start: u64, _end: u64, _typ: i32, pid: u32, reply: ReplyLock, )
Test for a POSIX file lock.
Source§fn setlk(
&self,
_req: &Request<'_>,
ino: u64,
fh: u64,
_lock_owner: u64,
_start: u64,
_end: u64,
_typ: i32,
pid: u32,
_sleep: bool,
reply: ReplyEmpty,
)
fn setlk( &self, _req: &Request<'_>, ino: u64, fh: u64, _lock_owner: u64, _start: u64, _end: u64, _typ: i32, pid: u32, _sleep: bool, reply: ReplyEmpty, )
Acquire, modify or release a POSIX file lock.
For POSIX threads (NPTL) there’s a 1-1 relation between pid and owner, but
otherwise this is not always the case. For checking lock ownership,
‘fi->owner’ must be used. The l_pid field in ‘struct flock’ should only be
used to fill in this field in getlk(). Note: if the locking methods are not
implemented, the kernel will still allow file locking to work locally.
Hence these are only interesting for network filesystems and similar.
Source§fn bmap(
&self,
_req: &Request<'_>,
ino: u64,
_blocksize: u32,
_idx: u64,
reply: ReplyBmap,
)
fn bmap( &self, _req: &Request<'_>, ino: u64, _blocksize: u32, _idx: u64, reply: ReplyBmap, )
Map block index within file to block index within device.
Note: This makes sense only for block device backed filesystems mounted
with the ‘blkdev’ option
Source§fn ioctl(
&self,
_req: &Request<'_>,
ino: u64,
fh: u64,
_flags: u32,
cmd: u32,
_in_data: &[u8],
_out_size: u32,
reply: ReplyIoctl,
)
fn ioctl( &self, _req: &Request<'_>, ino: u64, fh: u64, _flags: u32, cmd: u32, _in_data: &[u8], _out_size: u32, reply: ReplyIoctl, )
control device
Source§fn fallocate(
&self,
_req: &Request<'_>,
ino: u64,
fh: u64,
offset: i64,
length: i64,
_mode: i32,
reply: ReplyEmpty,
)
fn fallocate( &self, _req: &Request<'_>, ino: u64, fh: u64, offset: i64, length: i64, _mode: i32, reply: ReplyEmpty, )
Preallocate or deallocate space to a file
Source§fn lseek(
&self,
_req: &Request<'_>,
ino: u64,
fh: u64,
offset: i64,
whence: i32,
reply: ReplyLseek,
)
fn lseek( &self, _req: &Request<'_>, ino: u64, fh: u64, offset: i64, whence: i32, reply: ReplyLseek, )
Reposition read/write file offset
Source§fn copy_file_range(
&self,
_req: &Request<'_>,
ino_in: u64,
fh_in: u64,
offset_in: i64,
ino_out: u64,
fh_out: u64,
offset_out: i64,
len: u64,
_flags: u32,
reply: ReplyWrite,
)
fn copy_file_range( &self, _req: &Request<'_>, ino_in: u64, fh_in: u64, offset_in: i64, ino_out: u64, fh_out: u64, offset_out: i64, len: u64, _flags: u32, reply: ReplyWrite, )
Copy the specified range from the source inode to the destination inode
Source§fn batch_forget(&self, req: &Request<'_>, nodes: &[fuse_forget_one])
fn batch_forget(&self, req: &Request<'_>, nodes: &[fuse_forget_one])
Like forget, but take multiple forget requests at once for performance. The default
implementation will fallback to forget.
Auto Trait Implementations§
impl<Client> !Freeze for S3FuseFilesystem<Client>
impl<Client> !RefUnwindSafe for S3FuseFilesystem<Client>
impl<Client> Send for S3FuseFilesystem<Client>
impl<Client> Sync for S3FuseFilesystem<Client>
impl<Client> Unpin for S3FuseFilesystem<Client>where
Client: Unpin,
impl<Client> UnsafeUnpin for S3FuseFilesystem<Client>where
Client: UnsafeUnpin,
impl<Client> !UnwindSafe for S3FuseFilesystem<Client>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more