pub struct Drive {
pub lb: Lb,
pub root: Uuid,
pub data: Arc<Mutex<HashMap<fileid3, FileEntry>>>,
}Fields§
§lb: Lb§root: Uuidmust be not-nil before NFSFIlesSystem is mounted
data: Arc<Mutex<HashMap<fileid3, FileEntry>>>probably this doesn’t need to have a global lock, but interactions here are generally speedy, and for now we’ll go for robustness over performance. Hopefully this accomplishes that and not deadlock. TBD.
this is stored in memory as it’s own entity and not stored in core for two reasons:
- size computations are expensive in core
- nfs needs to update timestamps to specified values
- nfs models properties we don’t, like file permission bits
Implementations§
Trait Implementations§
Source§impl NFSFileSystem for Drive
impl NFSFileSystem for Drive
Source§fn readdir<'life0, 'async_trait>(
&'life0 self,
dirid: fileid3,
start_after: fileid3,
max_entries: usize,
) -> Pin<Box<dyn Future<Output = Result<ReadDirResult, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn readdir<'life0, 'async_trait>(
&'life0 self,
dirid: fileid3,
start_after: fileid3,
max_entries: usize,
) -> Pin<Box<dyn Future<Output = Result<ReadDirResult, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
they will provide a start_after of 0 for no id
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<(), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<(), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Removes a file. If not supported dur to readonly file system this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_dirid: fileid3,
from_filename: &'life1 filename3,
to_dirid: fileid3,
to_filename: &'life2 filename3,
) -> Pin<Box<dyn Future<Output = Result<(), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn rename<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
from_dirid: fileid3,
from_filename: &'life1 filename3,
to_dirid: fileid3,
to_filename: &'life2 filename3,
) -> Pin<Box<dyn Future<Output = Result<(), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
either an overwrite rename or move
Source§fn capabilities(&self) -> VFSCapabilities
fn capabilities(&self) -> VFSCapabilities
Returns the set of capabilities supported
Source§fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
id: fileid3,
offset: u64,
buffer: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<fattr3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
id: fileid3,
offset: u64,
buffer: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<fattr3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the contents of a file returning (bytes, EOF)
Note that offset/count may go past the end of the file and that
in that case, the file is extended.
If not supported due to readonly file system
this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
attr: sattr3,
) -> Pin<Box<dyn Future<Output = Result<(fileid3, fattr3), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
attr: sattr3,
) -> Pin<Box<dyn Future<Output = Result<(fileid3, fattr3), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a file with the following attributes.
If not supported due to readonly file system
this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§fn create_exclusive<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<fileid3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_exclusive<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<fileid3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a file if it does not already exist
this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<fileid3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn lookup<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
filename: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<fileid3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up the id of a path in a directory Read more
Source§fn getattr<'life0, 'async_trait>(
&'life0 self,
id: fileid3,
) -> Pin<Box<dyn Future<Output = Result<fattr3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn getattr<'life0, 'async_trait>(
&'life0 self,
id: fileid3,
) -> Pin<Box<dyn Future<Output = Result<fattr3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the attributes of an id.
This method should be fast as it is used very frequently.
Source§fn setattr<'life0, 'async_trait>(
&'life0 self,
id: fileid3,
setattr: sattr3,
) -> Pin<Box<dyn Future<Output = Result<fattr3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn setattr<'life0, 'async_trait>(
&'life0 self,
id: fileid3,
setattr: sattr3,
) -> Pin<Box<dyn Future<Output = Result<fattr3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sets the attributes of an id
this should return Err(nfsstat3::NFS3ERR_ROFS) if readonly
Source§fn read<'life0, 'async_trait>(
&'life0 self,
id: fileid3,
offset: u64,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, bool), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read<'life0, 'async_trait>(
&'life0 self,
id: fileid3,
offset: u64,
count: u32,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, bool), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads the contents of a file returning (bytes, EOF)
Note that offset/count may go past the end of the file and that
in that case, all bytes till the end of file are returned.
EOF must be flagged if the end of the file is reached by the read.
Source§fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
dirname: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<(fileid3, fattr3), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mkdir<'life0, 'life1, 'async_trait>(
&'life0 self,
dirid: fileid3,
dirname: &'life1 filename3,
) -> Pin<Box<dyn Future<Output = Result<(fileid3, fattr3), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Makes a directory with the following attributes.
If not supported dur to readonly file system
this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§fn symlink<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_dirid: fileid3,
_linkname: &'life1 filename3,
_symlink: &'life2 nfspath3,
_attr: &'life3 sattr3,
) -> Pin<Box<dyn Future<Output = Result<(fileid3, fattr3), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn symlink<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_dirid: fileid3,
_linkname: &'life1 filename3,
_symlink: &'life2 nfspath3,
_attr: &'life3 sattr3,
) -> Pin<Box<dyn Future<Output = Result<(fileid3, fattr3), nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Makes a symlink with the following attributes.
If not supported due to readonly file system
this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§fn readlink<'life0, 'async_trait>(
&'life0 self,
_id: fileid3,
) -> Pin<Box<dyn Future<Output = Result<nfspath3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn readlink<'life0, 'async_trait>(
&'life0 self,
_id: fileid3,
) -> Pin<Box<dyn Future<Output = Result<nfspath3, nfsstat3>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reads a symlink
Source§fn readdir_simple<'life0, 'async_trait>(
&'life0 self,
dirid: u64,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<ReadDirSimpleResult, nfsstat3>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn readdir_simple<'life0, 'async_trait>(
&'life0 self,
dirid: u64,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<ReadDirSimpleResult, nfsstat3>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Simple version of readdir.
Only need to return filename and id
Source§fn fsinfo<'life0, 'async_trait>(
&'life0 self,
root_fileid: u64,
) -> Pin<Box<dyn Future<Output = Result<fsinfo3, nfsstat3>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn fsinfo<'life0, 'async_trait>(
&'life0 self,
root_fileid: u64,
) -> Pin<Box<dyn Future<Output = Result<fsinfo3, nfsstat3>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get static file system Information
Source§fn id_to_fh(&self, id: u64) -> nfs_fh3
fn id_to_fh(&self, id: u64) -> nfs_fh3
Converts the fileid to an opaque NFS file handle. Optional.
Source§fn fh_to_id(&self, id: &nfs_fh3) -> Result<u64, nfsstat3>
fn fh_to_id(&self, id: &nfs_fh3) -> Result<u64, nfsstat3>
Converts an opaque NFS file handle to a fileid. Optional.
Source§fn path_to_id<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<u64, nfsstat3>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn path_to_id<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<u64, nfsstat3>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Converts a complete path to a fileid. Optional.
The default implementation walks the directory structure with lookup()
fn serverid(&self) -> [u8; 8]
Auto Trait Implementations§
impl Freeze for Drive
impl !RefUnwindSafe for Drive
impl Send for Drive
impl Sync for Drive
impl Unpin for Drive
impl !UnwindSafe for Drive
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more