From c95c1c83b0237254eef2215fddf3c2d045733079 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 27 Sep 2021 09:58:20 +0200 Subject: [PATCH] move src/backup/snapshot_reader.rs to pbs_datastore crate --- pbs-datastore/src/lib.rs | 3 +++ {src/backup => pbs-datastore/src}/snapshot_reader.rs | 12 ++++++------ src/api2/tape/backup.rs | 3 +-- src/backup/mod.rs | 3 --- src/tape/file_formats/snapshot_archive.rs | 3 +-- src/tape/pool_writer/mod.rs | 3 +-- src/tape/pool_writer/new_chunks_iterator.rs | 3 +-- 7 files changed, 13 insertions(+), 17 deletions(-) rename {src/backup => pbs-datastore/src}/snapshot_reader.rs (94%) diff --git a/pbs-datastore/src/lib.rs b/pbs-datastore/src/lib.rs index fc08d00c..fcc368ff 100644 --- a/pbs-datastore/src/lib.rs +++ b/pbs-datastore/src/lib.rs @@ -198,3 +198,6 @@ pub use store_progress::StoreProgress; mod datastore; pub use datastore::{check_backup_owner, DataStore}; + +mod snapshot_reader; +pub use snapshot_reader::SnapshotReader; diff --git a/src/backup/snapshot_reader.rs b/pbs-datastore/src/snapshot_reader.rs similarity index 94% rename from src/backup/snapshot_reader.rs rename to pbs-datastore/src/snapshot_reader.rs index 03ca45ce..c49cf16f 100644 --- a/src/backup/snapshot_reader.rs +++ b/pbs-datastore/src/snapshot_reader.rs @@ -6,12 +6,12 @@ use std::fs::File; use anyhow::{bail, Error}; use nix::dir::Dir; -use pbs_datastore::backup_info::BackupDir; -use pbs_datastore::index::IndexFile; -use pbs_datastore::fixed_index::FixedIndexReader; -use pbs_datastore::dynamic_index::DynamicIndexReader; -use pbs_datastore::manifest::{archive_type, ArchiveType, CLIENT_LOG_BLOB_NAME, MANIFEST_BLOB_NAME}; -use pbs_datastore::DataStore; +use crate::backup_info::BackupDir; +use crate::index::IndexFile; +use crate::fixed_index::FixedIndexReader; +use crate::dynamic_index::DynamicIndexReader; +use crate::manifest::{archive_type, ArchiveType, CLIENT_LOG_BLOB_NAME, MANIFEST_BLOB_NAME}; +use crate::DataStore; use pbs_tools::fs::lock_dir_noblock_shared; /// Helper to access the contents of a datastore backup snapshot diff --git a/src/api2/tape/backup.rs b/src/api2/tape/backup.rs index aad5968a..7627e35b 100644 --- a/src/api2/tape/backup.rs +++ b/src/api2/tape/backup.rs @@ -20,7 +20,7 @@ use pbs_api_types::{ UPID_SCHEMA, JOB_ID_SCHEMA, PRIV_DATASTORE_READ, PRIV_TAPE_AUDIT, PRIV_TAPE_WRITE, }; -use pbs_datastore::{DataStore, StoreProgress}; +use pbs_datastore::{DataStore, StoreProgress, SnapshotReader}; use pbs_datastore::backup_info::{BackupDir, BackupInfo}; use pbs_tools::{task_log, task_warn, task::WorkerTaskContext}; use pbs_config::CachedUserInfo; @@ -36,7 +36,6 @@ use crate::{ compute_schedule_status, }, }, - backup::SnapshotReader, tape::{ TAPE_STATUS_DIR, Inventory, diff --git a/src/backup/mod.rs b/src/backup/mod.rs index 861010f7..59078c1d 100644 --- a/src/backup/mod.rs +++ b/src/backup/mod.rs @@ -9,6 +9,3 @@ pub use read_chunk::*; mod verify; pub use verify::*; - -mod snapshot_reader; -pub use snapshot_reader::SnapshotReader; diff --git a/src/tape/file_formats/snapshot_archive.rs b/src/tape/file_formats/snapshot_archive.rs index c898dc4a..c2f289d2 100644 --- a/src/tape/file_formats/snapshot_archive.rs +++ b/src/tape/file_formats/snapshot_archive.rs @@ -11,8 +11,7 @@ use pbs_tape::{ PROXMOX_TAPE_BLOCK_SIZE, TapeWrite, MediaContentHeader, }; - -use crate::backup::SnapshotReader; +use pbs_datastore::SnapshotReader; use crate::tape::file_formats::{ PROXMOX_BACKUP_SNAPSHOT_ARCHIVE_MAGIC_1_1, diff --git a/src/tape/pool_writer/mod.rs b/src/tape/pool_writer/mod.rs index b3f85a6e..eed0d61e 100644 --- a/src/tape/pool_writer/mod.rs +++ b/src/tape/pool_writer/mod.rs @@ -19,11 +19,10 @@ use pbs_tape::{ TapeWrite, sg_tape::tape_alert_flags_critical, }; -use pbs_datastore::DataStore; +use pbs_datastore::{DataStore, SnapshotReader}; use proxmox_rest_server::WorkerTask; use crate::{ - backup::SnapshotReader, tape::{ TAPE_STATUS_DIR, MAX_CHUNK_ARCHIVE_SIZE, diff --git a/src/tape/pool_writer/new_chunks_iterator.rs b/src/tape/pool_writer/new_chunks_iterator.rs index 97203fea..4adf67f9 100644 --- a/src/tape/pool_writer/new_chunks_iterator.rs +++ b/src/tape/pool_writer/new_chunks_iterator.rs @@ -3,9 +3,8 @@ use std::sync::{Arc, Mutex}; use anyhow::{format_err, Error}; -use pbs_datastore::{DataStore, DataBlob}; +use pbs_datastore::{DataStore, DataBlob, SnapshotReader}; -use crate::backup::SnapshotReader; use crate::tape::CatalogSet; /// Chunk iterator which use a separate thread to read chunks