api2: tape: media: use MediaCatalog::snapshot_list for content listing
this should make the api call much faster, since it is not reading the whole catalog anymore Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
		
				
					committed by
					
						 Dietmar Maurer
						Dietmar Maurer
					
				
			
			
				
	
			
			
			
						parent
						
							5ad40a3dd1
						
					
				
				
					commit
					855b55dc14
				
			| @ -42,6 +42,7 @@ use crate::{ | |||||||
|         Inventory, |         Inventory, | ||||||
|         MediaPool, |         MediaPool, | ||||||
|         MediaCatalog, |         MediaCatalog, | ||||||
|  |         media_catalog_snapshot_list, | ||||||
|         changer::update_online_status, |         changer::update_online_status, | ||||||
|     }, |     }, | ||||||
| }; | }; | ||||||
| @ -502,10 +503,7 @@ pub fn list_content( | |||||||
|             .generate_media_set_name(&set.uuid, template) |             .generate_media_set_name(&set.uuid, template) | ||||||
|             .unwrap_or_else(|_| set.uuid.to_string()); |             .unwrap_or_else(|_| set.uuid.to_string()); | ||||||
|  |  | ||||||
|         let catalog = MediaCatalog::open(status_path, &media_id, false, false)?; |         for (store, snapshot) in media_catalog_snapshot_list(status_path, &media_id)? { | ||||||
|  |  | ||||||
|         for (store, content) in catalog.content() { |  | ||||||
|             for snapshot in content.snapshot_index.keys() { |  | ||||||
|             let backup_dir: BackupDir = snapshot.parse()?; |             let backup_dir: BackupDir = snapshot.parse()?; | ||||||
|  |  | ||||||
|             if let Some(ref backup_type) = filter.backup_type { |             if let Some(ref backup_type) = filter.backup_type { | ||||||
| @ -529,7 +527,6 @@ pub fn list_content( | |||||||
|             }); |             }); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|  |  | ||||||
|     Ok(list) |     Ok(list) | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user