pub struct Volume {
pub metadata: MetaData,
pub separation_context: SclName,
pub size_mib: u64,
pub status: VolumeStatus,
pub url: Option<Url>,
}Fields§
§metadata: MetaData§separation_context: SclNameSeparation context which the volume is belonging to.
size_mib: u64Size in mebibyte reserved for the volume.
status: VolumeStatusLatest status of the volume. Does not need to be specified by the user when creating (POST), as it is initialized with the default values.
url: Option<Url>Optional URL pointing to initial data that should be copied into the new volume.
Make sure that the size_mib is at least as large as the required disk space.
Implementations§
Source§impl Volume
impl Volume
Sourcepub fn file_path(&self, root: &Path) -> PathBuf
pub fn file_path(&self, root: &Path) -> PathBuf
Returns the path where the volume file should be stored.
Convenience wrapper around derive_volume_file_path, see its documentation for more information.
§Example
use crate::scl_lib::api_objects::{MetaData, SclName, Volume, derive_volume_file_path};
use std::path::Path;
use scl_lib::api_objects::SclObject;
let vol = Volume {
separation_context: SclName::try_from("sc01".to_string()).unwrap(),
metadata: MetaData::new(SclName::try_from("vol01".to_string()).unwrap()),
size_mib: 100,
status: Default::default(),
url: None,
};
let root = Path::new("/tmp/scl");
assert_eq!(vol.file_path(&root).as_path(), Path::new("/tmp/scl/sc01/volumes/vol01"));
assert_eq!(vol.file_path(&root), derive_volume_file_path(&root, &vol.separation_context, vol.name()))Trait Implementations§
Source§impl<'de> Deserialize<'de> for Volume
impl<'de> Deserialize<'de> for Volume
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Volume
impl Ord for Volume
Source§impl PartialOrd for Volume
impl PartialOrd for Volume
Source§impl SclObject for Volume
impl SclObject for Volume
Source§fn separation_context(&self) -> Option<&SclName>
fn separation_context(&self) -> Option<&SclName>
Returns the
SclName of the separation context if the SclObject is connected to one,
otherwise default None.Source§fn metadata(&self) -> &MetaData
fn metadata(&self) -> &MetaData
Providing access to
MetaData is essential for our optimistic concurrency control.Source§fn metadata_mut(&mut self) -> &mut MetaData
fn metadata_mut(&mut self) -> &mut MetaData
Providing access to
MetaData is essential for our optimistic concurrency control.Source§fn referenced_db_keys(&self) -> Vec<String>
fn referenced_db_keys(&self) -> Vec<String>
Returns all DB keys the object is referencing / depending on.
Source§fn validate_fields_before_create(&self) -> Result<()>
fn validate_fields_before_create(&self) -> Result<()>
Checks if all fields (except references to other SclObjects) are legal initial fields.
Should be called before a create operation.
Source§fn validate_fields_before_update(
current_db_state: &Self,
proposed_new_state: &Self,
) -> Result<()>
fn validate_fields_before_update( current_db_state: &Self, proposed_new_state: &Self, ) -> Result<()>
Checks if a proposed updated is valid. Should be called before a regular (not
related to finalizers / deletion) update operation.
fn uuid(&self) -> Uuid
Source§fn api_endpoint<'a>(
sc: impl Into<Option<&'a str>>,
name: impl Into<Option<&'a str>>,
) -> String
fn api_endpoint<'a>( sc: impl Into<Option<&'a str>>, name: impl Into<Option<&'a str>>, ) -> String
impl Eq for Volume
impl StructuralPartialEq for Volume
Auto Trait Implementations§
impl Freeze for Volume
impl RefUnwindSafe for Volume
impl Send for Volume
impl Sync for Volume
impl Unpin for Volume
impl UnwindSafe for Volume
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.