Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32587848
D14704.1767409672.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D14704.1767409672.diff
View Options
diff --git a/services/backup/src/database/backup_item.rs b/services/backup/src/database/backup_item.rs
--- a/services/backup/src/database/backup_item.rs
+++ b/services/backup/src/database/backup_item.rs
@@ -2,8 +2,11 @@
use aws_sdk_dynamodb::types::AttributeValue;
use chrono::{DateTime, Utc};
use comm_lib::{
+ backup::BackupVersionInfo,
blob::types::BlobInfo,
- database::{AttributeExtractor, DBItemError, TryFromAttribute},
+ database::{
+ parse_int_attribute, AttributeExtractor, DBItemError, TryFromAttribute,
+ },
};
use std::collections::HashMap;
@@ -18,6 +21,8 @@
pub backup_id: String,
pub user_keys: BlobInfo,
pub siwe_backup_msg: Option<String>,
+ pub total_size: u64,
+ pub version_info: BackupVersionInfo,
}
impl TryFrom<HashMap<String, AttributeValue>> for OrderedBackupItem {
@@ -47,12 +52,26 @@
let siwe_backup_msg: Option<String> =
value.take_attr(backup_table::attr::SIWE_BACKUP_MSG)?;
+ let size_attr = value.remove(backup_table::attr::TOTAL_SIZE);
+ let total_size = if size_attr.is_some() {
+ parse_int_attribute(backup_table::attr::TOTAL_SIZE, size_attr)?
+ } else {
+ 0u64
+ };
+
+ // older backups don't have this attribute
+ let version_info: BackupVersionInfo = value
+ .take_attr::<Option<_>>(backup_table::attr::VERSION_INFO)?
+ .unwrap_or_default();
+
Ok(OrderedBackupItem {
user_id,
created,
backup_id,
user_keys,
siwe_backup_msg,
+ total_size,
+ version_info,
})
}
}
diff --git a/services/backup/src/http/handlers/backup.rs b/services/backup/src/http/handlers/backup.rs
--- a/services/backup/src/http/handlers/backup.rs
+++ b/services/backup/src/http/handlers/backup.rs
@@ -306,6 +306,7 @@
keyserver_device_id,
total_backup_size,
creation_timestamp: backup_item.created.to_rfc3339(),
+ version_info: backup_item.version_info,
};
Ok(web::Json(response))
diff --git a/services/terraform/modules/shared/dynamodb.tf b/services/terraform/modules/shared/dynamodb.tf
--- a/services/terraform/modules/shared/dynamodb.tf
+++ b/services/terraform/modules/shared/dynamodb.tf
@@ -28,7 +28,7 @@
hash_key = "userID"
range_key = "created"
projection_type = "INCLUDE"
- non_key_attributes = ["userKeys", "siweBackupMsg"]
+ non_key_attributes = ["userKeys", "siweBackupMsg", "totalSize", "versionInfo"]
}
point_in_time_recovery {
diff --git a/shared/comm-lib/src/backup/mod.rs b/shared/comm-lib/src/backup/mod.rs
--- a/shared/comm-lib/src/backup/mod.rs
+++ b/shared/comm-lib/src/backup/mod.rs
@@ -27,6 +27,7 @@
// ISO 8601 / RFC 3339 DateTime string
pub creation_timestamp: String,
pub total_backup_size: u64,
+ pub version_info: BackupVersionInfo,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 3, 3:07 AM (5 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5885515
Default Alt Text
D14704.1767409672.diff (2 KB)
Attached To
Mode
D14704: [backup][terraform] Add size and version info to OrderedBackupItem
Attached
Detach File
Event Timeline
Log In to Comment