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