/// Returns the volume with the given name.
Returns the volume with the given name.
Returns the volume with the given name .
pub async fn volume(&self, volume_name: &str) -> Result<Volume, Error> {
        let (object_id, object_type) = self.directory.lookup(volume_name).await?;
        let volume_info_object_id = {
            if let ObjectDescriptor::Volume(object_id) = object_type {
                object_id
            } else {
                bail!(FxfsError::Inconsistent);
            }
        };
        let volume_store = {
            if let Some(volume_store) = self.filesystem.store(object_id) {
                volume_store
            } else {
                self.filesystem.root_store().open_store(object_id).await?
            }
        };
        let handle =
            volume_store.open_object(volume_info_object_id, HandleOptions::default()).await?;
        let serialized_info = handle.contents(MAX_VOLUME_INFO_SERIALIZED_SIZE).await?;
        let info: VolumeInfo = deserialize_from(&serialized_info[..])?;
        let dir = volume_store.open_directory(info.root_directory_object_id).await?;
        Ok(Volume::new(volume_store, dir))
    }
pub async fn volume ( & self , volume_name : & str ) -> Result < Volume , Error > { let ( object_id , object_type ) = self . directory . lookup ( volume_name ) . await ? ; let volume_info_object_id = { if let ObjectDescriptor :: Volume ( object_id ) = object_type { object_id } else { bail ! ( FxfsError Inconsistent ) ; } } ; let volume_store = { if let Some ( volume_store ) = self . filesystem . store ( object_id ) { volume_store } else { self . filesystem . root_store ( ) . open_store ( object_id ) . await ? } } ; let handle = volume_store . open_object ( volume_info_object_id , HandleOptions :: default ( ) ) . await ? ; let serialized_info = handle . contents ( MAX_VOLUME_INFO_SERIALIZED_SIZE ) . await ? ; let info : VolumeInfo = deserialize_from ( & serialized_info [ .. ] ) ? ; let dir = volume_store . open_directory ( info . root_directory_object_id ) . await ? ; Ok ( Volume :: new ( volume_store , dir ) ) }
Returns the volume with the given name.
Returns the volume with the given name .
&self
volume_name
&str