5 pub use parse_mtx_status
::*;
8 pub use mtx_wrapper
::*;
11 pub use linux_tape
::*;
15 /// Interface to media change devices
16 pub trait MediaChange
{
18 /// Returns the changer status
19 fn status(&mut self) -> Result
<MtxStatus
, Error
>;
21 /// Load media from storage slot into drive
22 fn load_media_from_slot(&mut self, slot
: u64) -> Result
<(), Error
>;
24 /// Load media by changer-id into drive
26 /// This unloads first if the drive is already loaded with another media.
28 /// Note: This refuses to load media inside import/export slots.
29 fn load_media(&mut self, changer_id
: &str) -> Result
<(), Error
>;
31 /// Unload media from drive
33 /// This is a nop on drives without autoloader.
34 fn unload_media(&mut self, target_slot
: Option
<u64>) -> Result
<(), Error
>;
36 /// Returns true if unload_media automatically ejects drive media
37 fn eject_on_unload(&self) -> bool
{
41 /// List online media changer IDs (barcodes)
43 /// List acessible (online) changer IDs. This does not include
44 /// media inside import-export slots or cleaning media.
45 fn online_media_changer_ids(&mut self) -> Result
<Vec
<String
>, Error
> {
46 let status
= self.status()?
;
48 let mut list
= Vec
::new();
50 for drive_status
in status
.drives
.iter() {
51 if let ElementStatus
::VolumeTag(ref tag
) = drive_status
.status
{
52 list
.push(tag
.clone());
56 for (import_export
, element_status
) in status
.slots
.iter() {
57 if *import_export { continue; }
58 if let ElementStatus
::VolumeTag(ref tag
) = element_status
{
59 if !tag
.starts_with("CLN") { continue; }
60 list
.push(tag
.clone());