Struct Drive

Source
pub struct Drive {
    pub lb: Lb,
    pub root: Uuid,
    pub data: Arc<Mutex<HashMap<fileid3, FileEntry>>>,
}

Fields§

§lb: Lb§root: Uuid

must 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:

  1. size computations are expensive in core
  2. nfs needs to update timestamps to specified values
  3. nfs models properties we don’t, like file permission bits

Implementations§

Source§

impl Drive

Source

pub async fn prepare_caches(&self)

Source

pub async fn sync(&self)

Source§

impl Drive

Source

pub async fn init() -> Self

Source

pub async fn import() -> CliResult<()>

Source

pub async fn mount() -> CliResult<()>

Source

pub fn progress() -> Option<Box<dyn Fn(SyncProgress) + Send>>

Trait Implementations§

Source§

impl Clone for Drive

Source§

fn clone(&self) -> Drive

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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,

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,

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,

either an overwrite rename or move

Source§

fn root_dir(&self) -> fileid3

Returns the ID the of the root directory “/”
Source§

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,

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,

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,

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,

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,

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,

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,

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,

Makes a directory with the following attributes. If not supported dur to readonly file system this should return Err(nfsstat3::NFS3ERR_ROFS)
Makes a symlink with the following attributes. If not supported due to readonly file system this should return Err(nfsstat3::NFS3ERR_ROFS)
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,

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,

Get static file system Information
Source§

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>

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,

Converts a complete path to a fileid. Optional. The default implementation walks the directory structure with lookup()
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Fruit for T
where T: Send + Downcast,