Drive

Struct Drive 

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

Fields§

§lb: Lb§root: Uuid

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

  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§

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>

either an overwrite rename or move

Source§

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

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

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>

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

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)
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

Returns the set of capabilities supported
Source§

impl NfsReadFileSystem for Drive

Source§

type Handle = UuidFileHandle

Type that can be used to indentify a file or folder in the file system. Read more
Source§

fn root_dir(&self) -> Self::Handle

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

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>

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>

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>

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>

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 more
Reads a symlink
Source§

fn lookup_by_path( &self, path: &str, ) -> impl Future<Output = Result<Self::Handle, nfsstat3>> + Send

This method is used when the client tries to mount a subdirectory. The default implementation walks the directory structure with lookup.
Source§

fn fsinfo( &self, root_fileid: &Self::Handle, ) -> impl Future<Output = Result<FSINFO3resok, nfsstat3>> + Send

Get static file system Information

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>

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>

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)

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)

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

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

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

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be 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> Fruit for T
where T: Send + Downcast,