tape: implement inventory command
This commit is contained in:
@ -29,6 +29,7 @@ use crate::{
|
||||
},
|
||||
tape::{
|
||||
TAPE_STATUS_DIR,
|
||||
MediaLabelInfo,
|
||||
file_formats::{
|
||||
DriveLabel,
|
||||
MediaSetLabel,
|
||||
@ -46,6 +47,16 @@ pub struct MediaId {
|
||||
pub media_set_label: Option<MediaSetLabel>,
|
||||
}
|
||||
|
||||
impl From<MediaLabelInfo> for MediaId {
|
||||
fn from(info: MediaLabelInfo) -> Self {
|
||||
Self {
|
||||
label: info.label.clone(),
|
||||
media_set_label: info.media_set_label.map(|(l, _)| l),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Media Set
|
||||
///
|
||||
/// A List of backup media
|
||||
@ -240,17 +251,6 @@ impl Inventory {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/*
|
||||
/// Same a store, but extract MediaId form MediaLabelInfo
|
||||
pub fn store_media_info(&mut self, info: &MediaLabelInfo) -> Result<(), Error> {
|
||||
let media_id = MediaId {
|
||||
label: info.label.clone(),
|
||||
media_set_label: info.media_set_label.clone().map(|(l, _)| l),
|
||||
};
|
||||
self.store(media_id)
|
||||
}
|
||||
*/
|
||||
|
||||
/// Lookup media
|
||||
pub fn lookup_media(&self, uuid: &Uuid) -> Option<&MediaId> {
|
||||
self.map.get(uuid)
|
||||
|
Reference in New Issue
Block a user