update to first proxmox crate split
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -25,7 +25,12 @@ zstd = { version = "0.6", features = [ "bindgen" ] }
|
||||
pathpatterns = "0.1.2"
|
||||
pxar = "0.10.1"
|
||||
|
||||
proxmox = { version = "0.14.0", default-features = false, features = [ "api-macro" ] }
|
||||
proxmox = "0.14.0"
|
||||
proxmox-io = "1"
|
||||
proxmox-lang = "1"
|
||||
proxmox-schema = { version = "1", features = [ "api-macro" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-uuid = "1"
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-tools = { path = "../pbs-tools" }
|
||||
|
@ -138,7 +138,7 @@ impl BackupGroup {
|
||||
}
|
||||
}
|
||||
|
||||
let timestamp = proxmox::tools::time::parse_rfc3339(backup_time)?;
|
||||
let timestamp = proxmox_time::parse_rfc3339(backup_time)?;
|
||||
if let Some(last_timestamp) = last {
|
||||
if timestamp > last_timestamp {
|
||||
last = Some(timestamp);
|
||||
@ -215,7 +215,7 @@ impl BackupDir {
|
||||
V: Into<String>,
|
||||
{
|
||||
let backup_time_string = backup_time_string.into();
|
||||
let backup_time = proxmox::tools::time::parse_rfc3339(&backup_time_string)?;
|
||||
let backup_time = proxmox_time::parse_rfc3339(&backup_time_string)?;
|
||||
let group = BackupGroup::new(backup_type.into(), backup_id.into());
|
||||
Ok(Self {
|
||||
group,
|
||||
@ -255,7 +255,7 @@ impl BackupDir {
|
||||
|
||||
pub fn backup_time_to_string(backup_time: i64) -> Result<String, Error> {
|
||||
// fixme: can this fail? (avoid unwrap)
|
||||
proxmox::tools::time::epoch_to_rfc3339_utc(backup_time)
|
||||
Ok(proxmox_time::epoch_to_rfc3339_utc(backup_time)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@ use anyhow::{bail, format_err, Error};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use pathpatterns::{MatchList, MatchType};
|
||||
use proxmox::api::api;
|
||||
use proxmox::tools::io::ReadExt;
|
||||
|
||||
use proxmox_io::ReadExt;
|
||||
use proxmox_schema::api;
|
||||
|
||||
use crate::file_formats::PROXMOX_CATALOG_FILE_MAGIC_1_0;
|
||||
|
||||
@ -570,7 +571,7 @@ impl <R: Read + Seek> CatalogReader<R> {
|
||||
}
|
||||
CatalogEntryType::File => {
|
||||
let mut mtime_string = mtime.to_string();
|
||||
if let Ok(s) = proxmox::tools::time::strftime_local("%FT%TZ", mtime as i64) {
|
||||
if let Ok(s) = proxmox_time::strftime_local("%FT%TZ", mtime as i64) {
|
||||
mtime_string = s;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use std::io::Write;
|
||||
use anyhow::{bail, Error};
|
||||
use openssl::symm::{decrypt_aead, Mode};
|
||||
|
||||
use proxmox::tools::io::{ReadExt, WriteExt};
|
||||
use proxmox_io::{ReadExt, WriteExt};
|
||||
|
||||
use pbs_tools::crypt_config::CryptConfig;
|
||||
use pbs_api_types::CryptMode;
|
||||
@ -58,13 +58,13 @@ impl DataBlob {
|
||||
|
||||
/// accessor to crc32 checksum
|
||||
pub fn crc(&self) -> u32 {
|
||||
let crc_o = proxmox::offsetof!(DataBlobHeader, crc);
|
||||
let crc_o = proxmox_lang::offsetof!(DataBlobHeader, crc);
|
||||
u32::from_le_bytes(self.raw_data[crc_o..crc_o+4].try_into().unwrap())
|
||||
}
|
||||
|
||||
// set the CRC checksum field
|
||||
pub fn set_crc(&mut self, crc: u32) {
|
||||
let crc_o = proxmox::offsetof!(DataBlobHeader, crc);
|
||||
let crc_o = proxmox_lang::offsetof!(DataBlobHeader, crc);
|
||||
self.raw_data[crc_o..crc_o+4].copy_from_slice(&crc.to_le_bytes());
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,8 @@ use std::io::{BufReader, Read};
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use proxmox::tools::io::ReadExt;
|
||||
|
||||
use proxmox_io::ReadExt;
|
||||
|
||||
use pbs_tools::crypt_config::CryptConfig;
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
use anyhow::Error;
|
||||
use proxmox::tools::io::WriteExt;
|
||||
use std::io::{Seek, SeekFrom, Write};
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Error;
|
||||
|
||||
use proxmox_io::WriteExt;
|
||||
|
||||
use pbs_tools::crypt_config::CryptConfig;
|
||||
|
||||
use crate::checksum_writer::ChecksumWriter;
|
||||
|
@ -620,7 +620,7 @@ impl DataStore {
|
||||
// writer" information and thus no safe atime cutoff
|
||||
let _exclusive_lock = self.chunk_store.try_exclusive_lock()?;
|
||||
|
||||
let phase1_start_time = proxmox::tools::time::epoch_i64();
|
||||
let phase1_start_time = proxmox_time::epoch_i64();
|
||||
let oldest_writer = self.chunk_store.oldest_writer().unwrap_or(phase1_start_time);
|
||||
|
||||
let mut gc_status = GarbageCollectionStatus::default();
|
||||
@ -742,7 +742,7 @@ impl DataStore {
|
||||
path.push(backup_dir.relative_path());
|
||||
path.push(filename);
|
||||
|
||||
proxmox::try_block!({
|
||||
proxmox_lang::try_block!({
|
||||
let mut file = std::fs::File::open(&path)?;
|
||||
DataBlob::load_from_reader(&mut file)
|
||||
}).map_err(|err| format_err!("unable to load blob '{:?}' - {}", path, err))
|
||||
@ -758,7 +758,7 @@ impl DataStore {
|
||||
|
||||
let (chunk_path, digest_str) = self.chunk_store.chunk_path(digest);
|
||||
|
||||
proxmox::try_block!({
|
||||
proxmox_lang::try_block!({
|
||||
let mut file = std::fs::File::open(&chunk_path)?;
|
||||
DataBlob::load_from_reader(&mut file)
|
||||
}).map_err(|err| format_err!(
|
||||
|
@ -9,9 +9,9 @@ use std::task::Context;
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
|
||||
use proxmox::tools::io::ReadExt;
|
||||
use proxmox::tools::uuid::Uuid;
|
||||
use proxmox::tools::mmap::Mmap;
|
||||
use proxmox_io::ReadExt;
|
||||
use proxmox_uuid::Uuid;
|
||||
use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation};
|
||||
|
||||
use pbs_tools::lru_cache::LruCache;
|
||||
@ -35,7 +35,7 @@ pub struct DynamicIndexHeader {
|
||||
pub index_csum: [u8; 32],
|
||||
reserved: [u8; 4032], // overall size is one page (4096 bytes)
|
||||
}
|
||||
proxmox::static_assert_size!(DynamicIndexHeader, 4096);
|
||||
proxmox_lang::static_assert_size!(DynamicIndexHeader, 4096);
|
||||
// TODO: Once non-Copy unions are stabilized, use:
|
||||
// union DynamicIndexHeader {
|
||||
// reserved: [u8; 4096],
|
||||
@ -119,7 +119,7 @@ impl DynamicIndexReader {
|
||||
bail!("got unknown magic number");
|
||||
}
|
||||
|
||||
let ctime = proxmox::tools::time::epoch_i64();
|
||||
let ctime = proxmox_time::epoch_i64();
|
||||
|
||||
let index_size = stat.st_size as usize - header_size;
|
||||
let index_count = index_size / 40;
|
||||
@ -301,7 +301,7 @@ impl DynamicIndexWriter {
|
||||
|
||||
let mut writer = BufWriter::with_capacity(1024 * 1024, file);
|
||||
|
||||
let ctime = proxmox::tools::time::epoch_i64();
|
||||
let ctime = proxmox_time::epoch_i64();
|
||||
|
||||
let uuid = Uuid::generate();
|
||||
|
||||
@ -344,7 +344,7 @@ impl DynamicIndexWriter {
|
||||
|
||||
self.writer.flush()?;
|
||||
|
||||
let csum_offset = proxmox::offsetof!(DynamicIndexHeader, index_csum);
|
||||
let csum_offset = proxmox_lang::offsetof!(DynamicIndexHeader, index_csum);
|
||||
self.writer.seek(SeekFrom::Start(csum_offset as u64))?;
|
||||
|
||||
let csum = self.csum.take().unwrap();
|
||||
|
@ -9,8 +9,8 @@ use anyhow::{bail, format_err, Error};
|
||||
|
||||
use pbs_tools::process_locker::ProcessLockSharedGuard;
|
||||
|
||||
use proxmox::tools::io::ReadExt;
|
||||
use proxmox::tools::Uuid;
|
||||
use proxmox_io::ReadExt;
|
||||
use proxmox_uuid::Uuid;
|
||||
|
||||
use crate::chunk_stat::ChunkStat;
|
||||
use crate::chunk_store::ChunkStore;
|
||||
@ -30,7 +30,7 @@ pub struct FixedIndexHeader {
|
||||
pub chunk_size: u64,
|
||||
reserved: [u8; 4016], // overall size is one page (4096 bytes)
|
||||
}
|
||||
proxmox::static_assert_size!(FixedIndexHeader, 4096);
|
||||
proxmox_lang::static_assert_size!(FixedIndexHeader, 4096);
|
||||
|
||||
// split image into fixed size chunks
|
||||
|
||||
@ -149,7 +149,7 @@ impl FixedIndexReader {
|
||||
println!("ChunkSize: {}", self.chunk_size);
|
||||
|
||||
let mut ctime_str = self.ctime.to_string();
|
||||
if let Ok(s) = proxmox::tools::time::strftime_local("%c", self.ctime) {
|
||||
if let Ok(s) = proxmox_time::strftime_local("%c", self.ctime) {
|
||||
ctime_str = s;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ impl FixedIndexWriter {
|
||||
panic!("got unexpected header size");
|
||||
}
|
||||
|
||||
let ctime = proxmox::tools::time::epoch_i64();
|
||||
let ctime = proxmox_time::epoch_i64();
|
||||
|
||||
let uuid = Uuid::generate();
|
||||
|
||||
@ -361,7 +361,7 @@ impl FixedIndexWriter {
|
||||
|
||||
self.unmap()?;
|
||||
|
||||
let csum_offset = proxmox::offsetof!(FixedIndexHeader, index_csum);
|
||||
let csum_offset = proxmox_lang::offsetof!(FixedIndexHeader, index_csum);
|
||||
self.file.seek(SeekFrom::Start(csum_offset as u64))?;
|
||||
self.file.write_all(&index_csum)?;
|
||||
self.file.flush()?;
|
||||
|
@ -4,7 +4,7 @@ use std::process::{Command, Stdio};
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use proxmox::api::api;
|
||||
use proxmox_schema::api;
|
||||
|
||||
use pbs_config::key_config::KeyConfig;
|
||||
|
||||
|
@ -135,17 +135,17 @@ pub fn compute_prune_info(
|
||||
})?;
|
||||
}
|
||||
|
||||
use proxmox::tools::time::strftime_local;
|
||||
use proxmox_time::strftime_local;
|
||||
|
||||
if let Some(keep_hourly) = options.keep_hourly {
|
||||
mark_selections(&mut mark, &list, keep_hourly as usize, |info| {
|
||||
strftime_local("%Y/%m/%d/%H", info.backup_dir.backup_time())
|
||||
strftime_local("%Y/%m/%d/%H", info.backup_dir.backup_time()).map_err(Error::from)
|
||||
})?;
|
||||
}
|
||||
|
||||
if let Some(keep_daily) = options.keep_daily {
|
||||
mark_selections(&mut mark, &list, keep_daily as usize, |info| {
|
||||
strftime_local("%Y/%m/%d", info.backup_dir.backup_time())
|
||||
strftime_local("%Y/%m/%d", info.backup_dir.backup_time()).map_err(Error::from)
|
||||
})?;
|
||||
}
|
||||
|
||||
@ -153,19 +153,19 @@ pub fn compute_prune_info(
|
||||
mark_selections(&mut mark, &list, keep_weekly as usize, |info| {
|
||||
// Note: Use iso-week year/week here. This year number
|
||||
// might not match the calendar year number.
|
||||
strftime_local("%G/%V", info.backup_dir.backup_time())
|
||||
strftime_local("%G/%V", info.backup_dir.backup_time()).map_err(Error::from)
|
||||
})?;
|
||||
}
|
||||
|
||||
if let Some(keep_monthly) = options.keep_monthly {
|
||||
mark_selections(&mut mark, &list, keep_monthly as usize, |info| {
|
||||
strftime_local("%Y/%m", info.backup_dir.backup_time())
|
||||
strftime_local("%Y/%m", info.backup_dir.backup_time()).map_err(Error::from)
|
||||
})?;
|
||||
}
|
||||
|
||||
if let Some(keep_yearly) = options.keep_yearly {
|
||||
mark_selections(&mut mark, &list, keep_yearly as usize, |info| {
|
||||
strftime_local("%Y", info.backup_dir.backup_time())
|
||||
strftime_local("%Y", info.backup_dir.backup_time()).map_err(Error::from)
|
||||
})?;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ impl <'a> Iterator for SnapshotChunkIterator<'a> {
|
||||
type Item = Result<[u8; 32], Error>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
proxmox::try_block!({
|
||||
proxmox_lang::try_block!({
|
||||
loop {
|
||||
if self.current_index.is_none() {
|
||||
if let Some(filename) = self.todo_list.pop() {
|
||||
|
Reference in New Issue
Block a user