pub struct Drive {
pub lb: Lb,
pub root: Uuid,
pub data: Arc<Mutex<HashMap<UuidFileHandle, FileEntry>>>,
}Fields§
§lb: Lb§root: Uuidmust be not-nil before NFSFIlesSystem is mounted
data: Arc<Mutex<HashMap<UuidFileHandle, 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§async fn remove(
&self,
dirid: &Self::Handle,
filename: &filename3<'_>,
) -> Result<(), nfsstat3>
async fn remove( &self, dirid: &Self::Handle, filename: &filename3<'_>, ) -> Result<(), nfsstat3>
Removes a file. If not supported dur to readonly file system this should return Err(nfsstat3::NFS3ERR_ROFS)
Source§async fn rename<'a>(
&self,
from_dirid: &Self::Handle,
from_filename: &filename3<'a>,
to_dirid: &Self::Handle,
to_filename: &filename3<'a>,
) -> Result<(), nfsstat3>
async fn rename<'a>( &self, from_dirid: &Self::Handle, from_filename: &filename3<'a>, to_dirid: &Self::Handle, to_filename: &filename3<'a>, ) -> Result<(), nfsstat3>
either an overwrite rename or move
Source§async fn setattr(
&self,
id: &Self::Handle,
setattr: sattr3,
) -> Result<fattr3, nfsstat3>
async fn setattr( &self, id: &Self::Handle, setattr: sattr3, ) -> Result<fattr3, nfsstat3>
Sets the attributes of an id
this should return
Err(nfsstat3::NFS3ERR_ROFS) if readonlySource§async fn write(
&self,
id: &Self::Handle,
offset: u64,
buffer: &[u8],
) -> Result<fattr3, nfsstat3>
async fn write( &self, id: &Self::Handle, offset: u64, buffer: &[u8], ) -> Result<fattr3, nfsstat3>
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) Read moreSource§async fn create(
&self,
dirid: &Self::Handle,
filename: &filename3<'_>,
attr: sattr3,
) -> Result<(Self::Handle, fattr3), nfsstat3>
async fn create( &self, dirid: &Self::Handle, filename: &filename3<'_>, attr: sattr3, ) -> Result<(Self::Handle, fattr3), nfsstat3>
Creates a file with the following attributes.
If not supported due to readonly file system
this should return
Err(nfsstat3::NFS3ERR_ROFS)Source§async fn create_exclusive(
&self,
dirid: &Self::Handle,
filename: &filename3<'_>,
createverf: createverf3,
) -> Result<Self::Handle, nfsstat3>
async fn create_exclusive( &self, dirid: &Self::Handle, filename: &filename3<'_>, createverf: createverf3, ) -> Result<Self::Handle, nfsstat3>
Creates a file if it does not already exist.
If not supported due to readonly file system
this should return
Err(nfsstat3::NFS3ERR_ROFS) Read moreSource§async fn mkdir(
&self,
dirid: &Self::Handle,
dirname: &filename3<'_>,
) -> Result<(Self::Handle, fattr3), nfsstat3>
async fn mkdir( &self, dirid: &Self::Handle, dirname: &filename3<'_>, ) -> Result<(Self::Handle, fattr3), nfsstat3>
Makes a directory with the following attributes.
If not supported dur to readonly file system
this should return
Err(nfsstat3::NFS3ERR_ROFS)Source§async fn symlink<'a>(
&self,
_dirid: &Self::Handle,
_linkname: &filename3<'a>,
_symlink: &nfspath3<'a>,
_attr: &sattr3,
) -> Result<(Self::Handle, fattr3), nfsstat3>
async fn symlink<'a>( &self, _dirid: &Self::Handle, _linkname: &filename3<'a>, _symlink: &nfspath3<'a>, _attr: &sattr3, ) -> Result<(Self::Handle, fattr3), nfsstat3>
Makes a symlink with the following attributes.
If not supported due to readonly file system
this should return
Err(nfsstat3::NFS3ERR_ROFS)Source§fn capabilities(&self) -> VFSCapabilities
fn capabilities(&self) -> VFSCapabilities
Returns the set of capabilities supported
Source§impl NfsReadFileSystem for Drive
impl NfsReadFileSystem for Drive
Source§type Handle = UuidFileHandle
type Handle = UuidFileHandle
Type that can be used to indentify a file or folder in the file system. Read more
Source§async fn lookup(
&self,
dirid: &Self::Handle,
filename: &filename3<'_>,
) -> Result<Self::Handle, nfsstat3>
async fn lookup( &self, dirid: &Self::Handle, filename: &filename3<'_>, ) -> Result<Self::Handle, nfsstat3>
Look up the id of a path in a directory Read more
Source§async fn getattr(&self, id: &Self::Handle) -> Result<fattr3, nfsstat3>
async fn getattr(&self, id: &Self::Handle) -> Result<fattr3, nfsstat3>
Returns the attributes of an id.
This method should be fast as it is used very frequently.
Source§async fn read(
&self,
id: &Self::Handle,
offset: u64,
count: u32,
) -> Result<(Vec<u8>, bool), nfsstat3>
async fn read( &self, id: &Self::Handle, offset: u64, count: u32, ) -> Result<(Vec<u8>, bool), nfsstat3>
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§async fn readdir(
&self,
dirid: &Self::Handle,
cookie: u64,
) -> Result<impl ReadDirIterator, nfsstat3>
async fn readdir( &self, dirid: &Self::Handle, cookie: u64, ) -> Result<impl ReadDirIterator, nfsstat3>
Simple version of readdir. Only need to return filename and id Read more
Source§async fn readdirplus(
&self,
dirid: &Self::Handle,
cookie: u64,
) -> Result<impl ReadDirPlusIterator<UuidFileHandle>, nfsstat3>
async fn readdirplus( &self, dirid: &Self::Handle, cookie: u64, ) -> Result<impl ReadDirPlusIterator<UuidFileHandle>, nfsstat3>
Returns the contents of a directory with pagination.
Directory listing should be deterministic.
Up to
max_entries may be returned, and start_after is used
to determine where to start returning entries from. Read moreSource§async fn readlink(&self, _id: &Self::Handle) -> Result<nfspath3<'_>, nfsstat3>
async fn readlink(&self, _id: &Self::Handle) -> Result<nfspath3<'_>, nfsstat3>
Reads a symlink
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
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