tape: improve docu
This commit is contained in:
parent
dd59e3c2a1
commit
9839d3f778
@ -9,19 +9,29 @@ use crate::tools::nom::{
|
|||||||
parse_failure, parse_error, IResult,
|
parse_failure, parse_error, IResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Changer element status.
|
||||||
|
///
|
||||||
|
/// Drive and slots may be `Empty`, or contain some media, either
|
||||||
|
/// with knwon volume tag `VolumeTag(String)`, or without (`Full`).
|
||||||
pub enum ElementStatus {
|
pub enum ElementStatus {
|
||||||
Empty,
|
Empty,
|
||||||
Full,
|
Full,
|
||||||
VolumeTag(String),
|
VolumeTag(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Changer drive status.
|
||||||
pub struct DriveStatus {
|
pub struct DriveStatus {
|
||||||
|
/// The slot the element was loaded from (if known).
|
||||||
pub loaded_slot: Option<u64>,
|
pub loaded_slot: Option<u64>,
|
||||||
|
/// The status.
|
||||||
pub status: ElementStatus,
|
pub status: ElementStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Changer status - show drive/slot usage
|
||||||
pub struct MtxStatus {
|
pub struct MtxStatus {
|
||||||
|
/// List of known drives
|
||||||
pub drives: Vec<DriveStatus>,
|
pub drives: Vec<DriveStatus>,
|
||||||
|
/// List of known slots
|
||||||
pub slots: Vec<ElementStatus>,
|
pub slots: Vec<ElementStatus>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ use crate::tape::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Writes chunk lists to tape.
|
/// Writes chunk archives to tape.
|
||||||
///
|
///
|
||||||
/// A chunk archive consists of a 'MediaContentHeader' followed by a
|
/// A chunk archive consists of a `MediaContentHeader` followed by a
|
||||||
/// list of chunks entries. Each chunk entry consists of a
|
/// list of chunks entries. Each chunk entry consists of a
|
||||||
/// 'ChunkArchiveEntryHeader' folowed by thew chunk data ('DataBlob').
|
/// `ChunkArchiveEntryHeader` folowed by the chunk data (`DataBlob`).
|
||||||
///
|
///
|
||||||
/// | MediaContentHeader | ( ChunkArchiveEntryHeader | DataBlob )* |
|
/// `| MediaContentHeader | ( ChunkArchiveEntryHeader | DataBlob )* |`
|
||||||
pub struct ChunkArchiveWriter<'a> {
|
pub struct ChunkArchiveWriter<'a> {
|
||||||
writer: Option<Box<dyn TapeWrite + 'a>>,
|
writer: Option<Box<dyn TapeWrite + 'a>>,
|
||||||
bytes_written: usize, // does not include bytes from current writer
|
bytes_written: usize, // does not include bytes from current writer
|
||||||
@ -75,7 +75,7 @@ impl <'a> ChunkArchiveWriter<'a> {
|
|||||||
|
|
||||||
/// Write chunk into archive.
|
/// Write chunk into archive.
|
||||||
///
|
///
|
||||||
/// This may return false when LEOM is detected (when close_on_leom is set).
|
/// This may return false when `LEOM` is detected (when close_on_leom is set).
|
||||||
/// In that case the archive only contains parts of the last chunk.
|
/// In that case the archive only contains parts of the last chunk.
|
||||||
pub fn try_write_chunk(
|
pub fn try_write_chunk(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -131,9 +131,9 @@ impl <'a> ChunkArchiveWriter<'a> {
|
|||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This must be called at the end to add padding and EOF
|
/// This must be called at the end to add padding and `EOF`
|
||||||
///
|
///
|
||||||
/// Returns true on LEOM or when we hit max archive size
|
/// Returns true on `LEOM` or when we hit max archive size
|
||||||
pub fn finish(&mut self) -> Result<bool, std::io::Error> {
|
pub fn finish(&mut self) -> Result<bool, std::io::Error> {
|
||||||
match self.writer.take() {
|
match self.writer.take() {
|
||||||
Some(mut writer) => {
|
Some(mut writer) => {
|
||||||
|
@ -35,6 +35,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Serialize,Deserialize)]
|
#[derive(Serialize,Deserialize)]
|
||||||
|
/// Contains `MediaLabel` and `MediaSetLabel`, including additional content Uuids
|
||||||
pub struct MediaLabelInfo {
|
pub struct MediaLabelInfo {
|
||||||
pub label: MediaLabel,
|
pub label: MediaLabel,
|
||||||
pub label_uuid: Uuid,
|
pub label_uuid: Uuid,
|
||||||
|
@ -685,28 +685,28 @@ impl MediaSetCatalog {
|
|||||||
|
|
||||||
#[derive(Endian)]
|
#[derive(Endian)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct LabelEntry {
|
struct LabelEntry {
|
||||||
file_number: u64,
|
file_number: u64,
|
||||||
uuid: [u8;16],
|
uuid: [u8;16],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Endian)]
|
#[derive(Endian)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct ChunkArchiveStart {
|
struct ChunkArchiveStart {
|
||||||
file_number: u64,
|
file_number: u64,
|
||||||
uuid: [u8;16],
|
uuid: [u8;16],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Endian)]
|
#[derive(Endian)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct ChunkArchiveEnd{
|
struct ChunkArchiveEnd{
|
||||||
file_number: u64,
|
file_number: u64,
|
||||||
uuid: [u8;16],
|
uuid: [u8;16],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Endian)]
|
#[derive(Endian)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct SnapshotEntry{
|
struct SnapshotEntry{
|
||||||
file_number: u64,
|
file_number: u64,
|
||||||
uuid: [u8;16],
|
uuid: [u8;16],
|
||||||
name_len: u16,
|
name_len: u16,
|
||||||
|
@ -34,6 +34,7 @@ use crate::{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Media Pool lock guard
|
||||||
pub struct MediaPoolLockGuard(std::fs::File);
|
pub struct MediaPoolLockGuard(std::fs::File);
|
||||||
|
|
||||||
/// Media Pool
|
/// Media Pool
|
||||||
|
Loading…
Reference in New Issue
Block a user