tape: MediaListEntry - add ctime
This commit is contained in:
parent
d91c6fd4e1
commit
6543214dde
@ -91,13 +91,13 @@ pub async fn list_media(pool: Option<String>) -> Result<Vec<MediaListEntry>, Err
|
||||
for media in pool.list_media() {
|
||||
let expired = pool.media_is_expired(&media, current_time);
|
||||
|
||||
let media_set_uuid = media.media_set_label().as_ref()
|
||||
let media_set_uuid = media.media_set_label()
|
||||
.map(|set| set.uuid.to_string());
|
||||
|
||||
let seq_nr = media.media_set_label().as_ref()
|
||||
let seq_nr = media.media_set_label()
|
||||
.map(|set| set.seq_nr);
|
||||
|
||||
let media_set_name = media.media_set_label().as_ref()
|
||||
let media_set_name = media.media_set_label()
|
||||
.map(|set| {
|
||||
pool.generate_media_set_name(&set.uuid, config.template.clone())
|
||||
.unwrap_or_else(|_| set.uuid.to_string())
|
||||
@ -113,11 +113,13 @@ pub async fn list_media(pool: Option<String>) -> Result<Vec<MediaListEntry>, Err
|
||||
list.push(MediaListEntry {
|
||||
uuid: media.uuid().to_string(),
|
||||
changer_id: media.changer_id().to_string(),
|
||||
ctime: media.ctime(),
|
||||
pool: Some(pool_name.to_string()),
|
||||
location: media.location().clone(),
|
||||
status: *media.status(),
|
||||
catalog: catalog_ok,
|
||||
expired,
|
||||
media_set_ctime: media.media_set_label().map(|set| set.ctime),
|
||||
media_set_uuid,
|
||||
media_set_name,
|
||||
seq_nr,
|
||||
@ -139,6 +141,7 @@ pub async fn list_media(pool: Option<String>) -> Result<Vec<MediaListEntry>, Err
|
||||
|
||||
list.push(MediaListEntry {
|
||||
uuid: media_id.label.uuid.to_string(),
|
||||
ctime: media_id.label.ctime,
|
||||
changer_id: media_id.label.changer_id.to_string(),
|
||||
location,
|
||||
status,
|
||||
@ -146,6 +149,7 @@ pub async fn list_media(pool: Option<String>) -> Result<Vec<MediaListEntry>, Err
|
||||
expired: false,
|
||||
media_set_uuid: None,
|
||||
media_set_name: None,
|
||||
media_set_ctime: None,
|
||||
seq_nr: None,
|
||||
pool: None,
|
||||
});
|
||||
|
@ -25,6 +25,8 @@ pub struct MediaListEntry {
|
||||
pub changer_id: String,
|
||||
/// Media Uuid
|
||||
pub uuid: String,
|
||||
/// Creation time stamp
|
||||
pub ctime: i64,
|
||||
pub location: MediaLocation,
|
||||
pub status: MediaStatus,
|
||||
/// Expired flag
|
||||
@ -40,6 +42,9 @@ pub struct MediaListEntry {
|
||||
/// Media set seq_nr
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub seq_nr: Option<u64>,
|
||||
/// MediaSet creation time stamp
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub media_set_ctime: Option<i64>,
|
||||
/// Media Pool
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub pool: Option<String>,
|
||||
|
@ -469,8 +469,13 @@ impl BackupMedia {
|
||||
}
|
||||
|
||||
/// Returns the media set label
|
||||
pub fn media_set_label(&self) -> &Option<MediaSetLabel> {
|
||||
&self.id.media_set_label
|
||||
pub fn media_set_label(&self) -> Option<&MediaSetLabel> {
|
||||
self.id.media_set_label.as_ref()
|
||||
}
|
||||
|
||||
/// Returns the media creation time
|
||||
pub fn ctime(&self) -> i64 {
|
||||
self.id.label.ctime
|
||||
}
|
||||
|
||||
/// Updates the media set label
|
||||
|
Loading…
Reference in New Issue
Block a user