move manifest and backup_info to pbs-datastore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-07-07 11:34:45 +02:00
parent f75292bd8d
commit a5951b4f38
6 changed files with 20 additions and 16 deletions

View File

@ -9,6 +9,7 @@ description = "low level pbs data storage access"
anyhow = "1.0"
crc32fast = "1"
endian_trait = { version = "0.6", features = [ "arrays" ] }
libc = "0.2"
log = "0.4"
nix = "0.19.1"
openssl = "0.10"

View File

@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use anyhow::{bail, format_err, Error};
use crate::api2::types::{
use pbs_api_types::{
BACKUP_ID_REGEX,
BACKUP_TYPE_REGEX,
BACKUP_DATE_REGEX,
@ -372,7 +372,7 @@ impl BackupInfo {
// backup is considered unfinished if there is no manifest
self.files
.iter()
.any(|name| name == super::MANIFEST_BLOB_NAME)
.any(|name| name == MANIFEST_BLOB_NAME)
}
}

View File

@ -178,6 +178,7 @@ pub fn backup_group() -> Result<nix::unistd::Group, Error> {
.ok_or_else(|| format_err!("Unable to lookup backup user."))
}
pub mod backup_info;
pub mod catalog;
pub mod checksum_reader;
pub mod checksum_writer;
@ -191,15 +192,19 @@ pub mod data_blob_writer;
pub mod file_formats;
pub mod index;
pub mod key_derivation;
pub mod manifest;
pub mod task;
pub use backup_info::{BackupDir, BackupGroup, BackupInfo};
pub use checksum_reader::ChecksumReader;
pub use checksum_writer::ChecksumWriter;
pub use chunker::Chunker;
pub use crypt_config::{CryptConfig, CryptMode};
pub use crypt_config::{CryptConfig, CryptMode, Fingerprint};
pub use crypt_reader::CryptReader;
pub use crypt_writer::CryptWriter;
pub use data_blob::DataBlob;
pub use key_derivation::{
decrypt_key, load_and_decrypt_key, rsa_decrypt_key_config, rsa_encrypt_key_config,
};
pub use key_derivation::{Kdf, KeyConfig, KeyDerivationConfig, KeyInfo};
pub use manifest::BackupManifest;

View File

@ -1,11 +1,12 @@
use anyhow::{bail, format_err, Error};
use std::convert::TryFrom;
use std::path::Path;
use serde_json::{json, Value};
use ::serde::{Deserialize, Serialize};
use anyhow::{bail, format_err, Error};
use crate::backup::{BackupDir, CryptMode, CryptConfig, Fingerprint};
use serde_json::{json, Value};
use serde::{Deserialize, Serialize};
use crate::{BackupDir, CryptMode, CryptConfig, Fingerprint};
pub const MANIFEST_BLOB_NAME: &str = "index.json.blob";
pub const MANIFEST_LOCK_NAME: &str = ".index.json.lck";
@ -149,7 +150,7 @@ impl BackupManifest {
// Generate canonical json
fn to_canonical_json(value: &Value) -> Result<Vec<u8>, Error> {
crate::tools::json::to_canonical_json(value)
pbs_tools::json::to_canonical_json(value)
}
/// Compute manifest signature

View File

@ -178,6 +178,8 @@ pub fn backup_group() -> Result<nix::unistd::Group, Error> {
}
}
pub use pbs_datastore::backup_info;
pub use pbs_datastore::backup_info::*;
pub use pbs_datastore::catalog;
pub use pbs_datastore::catalog::*;
pub use pbs_datastore::checksum_reader;
@ -204,9 +206,8 @@ pub use pbs_datastore::index;
pub use pbs_datastore::index::*;
pub use pbs_datastore::key_derivation;
pub use pbs_datastore::key_derivation::*;
mod manifest;
pub use manifest::*;
pub use pbs_datastore::manifest;
pub use pbs_datastore::manifest::*;
mod chunk_stream;
pub use chunk_stream::*;
@ -226,10 +227,6 @@ pub use fixed_index::*;
mod dynamic_index;
pub use dynamic_index::*;
#[macro_use]
mod backup_info;
pub use backup_info::*;
mod prune;
pub use prune::*;

View File

@ -23,6 +23,7 @@ use proxmox_http::{
ProxyConfig,
};
pub use pbs_tools::json;
pub use pbs_tools::nom;
pub use pbs_tools::{run_command, command_output, command_output_as_string};
@ -40,7 +41,6 @@ pub mod fuse_loop;
mod memcom;
pub use memcom::Memcom;
pub mod json;
pub mod logrotate;
pub mod loopdev;
pub mod lru_cache;