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
impl Storage
Sourcepub fn register_scheme(&mut self, scheme: &str, factory: Box<dyn DriveFactory>)
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.
Sourcepub fn has_scheme(&self, scheme: &str) -> bool
pub fn has_scheme(&self, scheme: &str) -> bool
Returns true if the scheme
is already registered.
Sourcepub fn make_canonical(&self, raw_location: &str) -> Result<String>
pub fn make_canonical(&self, raw_location: &str) -> Result<String>
Converts a location, which needn’t exist, to its canonical form.
Sourcepub fn mount(&mut self, name: &str, uri: &str) -> Result<()>
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.
Sourcepub fn unmount(&mut self, name: &str) -> Result<()>
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.
Sourcepub fn mounted(&self) -> BTreeMap<&str, &str>
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.
Sourcepub fn cd(&mut self, location: &str) -> Result<()>
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:/
.
Sourcepub async fn delete(&mut self, raw_location: &str) -> Result<()>
pub async fn delete(&mut self, raw_location: &str) -> Result<()>
Deletes the program given by raw_location
.
Sourcepub async fn enumerate(&self, raw_location: &str) -> Result<DriveFiles>
pub async fn enumerate(&self, raw_location: &str) -> Result<DriveFiles>
Returns a sorted list of the entries in raw_location
and their metadata.
Sourcepub async fn get(&self, raw_location: &str) -> Result<String>
pub async fn get(&self, raw_location: &str) -> Result<String>
Loads the contents of the program given by raw_location
.
Sourcepub async fn get_acls(&self, raw_location: &str) -> Result<FileAcls>
pub async fn get_acls(&self, raw_location: &str) -> Result<FileAcls>
Gets the ACLs of the file raw_location
.
Sourcepub async fn put(&mut self, raw_location: &str, content: &str) -> Result<()>
pub async fn put(&mut self, raw_location: &str, content: &str) -> Result<()>
Saves the in-memory program given by content
into raw_location
.