Struct Storage

Source
pub struct Storage { /* private fields */ }
Expand description

Storage subsystem representation.

At the moment, the storage subsystem is backed by a single drive, so this type is a wrapper for the Drive type.

Implementations§

Source§

impl Storage

Source

pub fn register_scheme(&mut self, scheme: &str, factory: Box<dyn DriveFactory>)

Registers a new drive factory to handle the scheme. Must not have previously been registered and the scheme must be in lowercase.

Source

pub fn has_scheme(&self, scheme: &str) -> bool

Returns true if the scheme is already registered.

Source

pub fn make_canonical(&self, raw_location: &str) -> Result<String>

Converts a location, which needn’t exist, to its canonical form.

Source

pub fn mount(&mut self, name: &str, uri: &str) -> Result<()>

Instantiates and attaches a new drive with name that points to uri.

The name must be valid and must not yet have been registered.

Source

pub fn unmount(&mut self, name: &str) -> Result<()>

Detaches an existing drive named name.

The drive name must exist, cannot be the current drive, and cannot be the last mounted drive.

Source

pub fn mounted(&self) -> BTreeMap<&str, &str>

Returns information about the mounted drives as a mapping of drive names to the URIs that were used to mount them.

Source

pub fn cd(&mut self, location: &str) -> Result<()>

Changes the current location.

Given that we currently do not support directories, the location can only be of the forms DRIVE: or DRIVE:/.

Source

pub fn cwd(&self) -> String

Returns the current location, used to resolve relative paths.

Source

pub async fn delete(&mut self, raw_location: &str) -> Result<()>

Deletes the program given by raw_location.

Source

pub async fn enumerate(&self, raw_location: &str) -> Result<DriveFiles>

Returns a sorted list of the entries in raw_location and their metadata.

Source

pub async fn get(&self, raw_location: &str) -> Result<String>

Loads the contents of the program given by raw_location.

Source

pub async fn get_acls(&self, raw_location: &str) -> Result<FileAcls>

Gets the ACLs of the file raw_location.

Source

pub async fn put(&mut self, raw_location: &str, content: &str) -> Result<()>

Saves the in-memory program given by content into raw_location.

Source

pub async fn update_acls( &mut self, raw_location: &str, add: &FileAcls, remove: &FileAcls, ) -> Result<()>

Updates the ACLs of the file raw_location by extending them with the contents of add and removing the existing entries listed in remove.

Source

pub fn system_path(&self, raw_location: &str) -> Result<Option<PathBuf>>

Gets the system-addressable path of raw_location, if any.

Trait Implementations§

Source§

impl Default for Storage

Source§

fn default() -> Self

Creates a new storage subsytem backed by an in-memory drive.

Auto Trait Implementations§

§

impl Freeze for Storage

§

impl !RefUnwindSafe for Storage

§

impl !Send for Storage

§

impl !Sync for Storage

§

impl Unpin for Storage

§

impl !UnwindSafe for Storage

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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