chrono = "0.4" # Date and time library for Rust
crc32fast = "1"
endian_trait = { version = "0.6", features = ["arrays"] }
-failure = "0.1"
+anyhow = "1.0"
futures = "0.3"
h2 = { version = "0.2", features = ["stream"] }
http = "0.2"
pam-sys = "0.5"
percent-encoding = "2.1"
pin-utils = "0.1.0-alpha"
-proxmox = { version = "0.1.21", features = [ "sortable-macro", "api-macro" ] }
+proxmox = { version = "0.1.22", features = [ "sortable-macro", "api-macro" ] }
#proxmox = { git = "ssh://gitolite3@proxdev.maurer-it.com/rust/proxmox", version = "0.1.2", features = [ "sortable-macro", "api-macro" ] }
#proxmox = { path = "../proxmox/proxmox", features = [ "sortable-macro", "api-macro" ] }
regex = "1.2"
-use failure::*;
+use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
-use failure::*;
+use anyhow::{bail, Error};
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, Router, RpcEnvironment, Permission};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
-use failure::*;
+use anyhow::Error;
use serde_json::{json, Value};
-use failure::*;
+use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use std::convert::TryFrom;
use chrono::{TimeZone, Local};
-use failure::*;
+use anyhow::{bail, Error};
use futures::*;
use hyper::http::request::Parts;
use hyper::{header, Body, Response, StatusCode};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
use hyper::header::{HeaderValue, UPGRADE};
use hyper::http::request::Parts;
-use failure::*;
+use anyhow::{bail, Error};
use std::sync::{Arc, Mutex};
use std::collections::HashMap;
use std::sync::Arc;
use std::task::{Context, Poll};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
use hyper::Body;
use hyper::http::request::Parts;
use std::path::PathBuf;
-use failure::*;
+use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
-use failure::*;
+use anyhow::{bail, Error};
use serde_json::Value;
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use std::sync::{Arc, Mutex};
-use failure::*;
+use anyhow::{Error};
use lazy_static::lazy_static;
use openssl::sha;
use regex::Regex;
use std::process::{Command, Stdio};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use std::io::{BufRead,BufReader};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, Permission};
use std::process::{Command, Stdio};
-use failure::*;
+use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::{sortable, identity, list_subdirs_api_method};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::sys::linux::procfs;
use std::process::{Command, Stdio};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
use std::fs::File;
use std::io::{BufRead, BufReader};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, RpcEnvironment, Permission};
use std::mem::{self, MaybeUninit};
use chrono::prelude::*;
-use failure::*;
+use anyhow::{bail, Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, Permission};
//! Sync datastore from remote server
-use failure::*;
+use anyhow::{bail, format_err, Error};
use serde_json::json;
use std::convert::TryFrom;
use std::sync::Arc;
//use chrono::{Local, TimeZone};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
use hyper::header::{self, HeaderValue, UPGRADE};
use hyper::http::request::Parts;
-//use failure::*;
+//use anyhow::{bail, format_err, Error};
use std::sync::Arc;
use std::collections::HashMap;
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{api, Router, Permission};
-use failure::*;
+use anyhow::{bail};
use ::serde::{Deserialize, Serialize};
use proxmox::api::{api, schema::*};
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
use std::ffi::{CString, CStr};
use base64;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use serde_json::json;
pub trait ProxmoxAuthenticator {
-use failure::*;
+use anyhow::{bail, format_err, Error};
use lazy_static::lazy_static;
use openssl::rsa::{Rsa};
//!
//! Not sure if this is better. TODO
-use failure::*;
+use anyhow::{bail, Error};
// Note: .pcat1 => Proxmox Catalog Format version 1
pub const CATALOG_NAME: &str = "catalog.pcat1.didx";
use crate::tools;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use regex::Regex;
use std::os::unix::io::RawFd;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use std::fmt;
use std::ffi::{CStr, CString, OsStr};
use std::os::unix::ffi::OsStrExt;
use std::path::{Component, Path, PathBuf};
use chrono::{Utc, offset::TimeZone};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use nix::sys::stat::{Mode, SFlag};
use proxmox::api::{cli::*, *};
-use failure::*;
+use anyhow::{Error};
use std::sync::Arc;
use std::io::Read;
use std::sync::Arc;
use std::io::Write;
-use failure::*;
+use anyhow::{Error};
use super::CryptConfig;
use crate::tools::borrow::Tied;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use std::path::{Path, PathBuf};
use std::io::Write;
use std::task::{Context, Poll};
use bytes::BytesMut;
-use failure::*;
+use anyhow::{Error};
use futures::ready;
use futures::stream::{Stream, TryStream};
//! See the Wikipedia Artikel for [Authenticated
//! encryption](https://en.wikipedia.org/wiki/Authenticated_encryption)
//! for a short introduction.
-use failure::*;
+use anyhow::{bail, Error};
use openssl::pkcs5::pbkdf2_hmac;
use openssl::hash::MessageDigest;
use openssl::symm::{decrypt_aead, Cipher, Crypter, Mode};
-use failure::*;
+use anyhow::{bail, Error};
use std::sync::Arc;
use std::io::{Read, BufRead};
-use failure::*;
+use anyhow::{Error};
use std::sync::Arc;
use std::io::Write;
-use failure::*;
+use anyhow::{bail, Error};
use std::convert::TryInto;
use proxmox::tools::io::{ReadExt, WriteExt};
-use failure::*;
+use anyhow::{bail, Error};
use std::sync::Arc;
use std::io::{Read, BufReader};
use proxmox::tools::io::ReadExt;
-use failure::*;
+use anyhow::{Error};
use std::sync::Arc;
use std::io::{Write, Seek, SeekFrom};
use proxmox::tools::io::WriteExt;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use lazy_static::lazy_static;
use chrono::{DateTime, Utc};
use std::path::{Path, PathBuf};
use std::sync::Arc;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use proxmox::tools::io::ReadExt;
use proxmox::tools::uuid::Uuid;
}
impl<'a, S: ReadChunk> crate::tools::lru_cache::Cacher<usize, (u64, u64, Vec<u8>)> for ChunkCacher<'a, S> {
- fn fetch(&mut self, index: usize) -> Result<Option<(u64, u64, Vec<u8>)>, failure::Error> {
+ fn fetch(&mut self, index: usize) -> Result<Option<(u64, u64, Vec<u8>)>, anyhow::Error> {
let (start, end, digest) = self.index.chunk_info(index)?;
self.store.read_chunk(&digest).and_then(|data| Ok(Some((start, end, data))))
}
-use failure::*;
+use anyhow::{bail, format_err, Error};
use std::convert::TryInto;
use std::io::{Seek, SeekFrom};
use std::task::{Context, Poll};
use bytes::{Bytes, BytesMut};
-use failure::*;
+use anyhow::{format_err, Error};
use futures::*;
/// Trait to get digest list from index files
-use failure::*;
+use anyhow::{bail, format_err, Error};
use serde::{Deserialize, Serialize};
use chrono::{Local, TimeZone, DateTime};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use std::convert::TryFrom;
use std::path::Path;
-use failure::*;
+use anyhow::{Error};
use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
-use failure::*;
+use anyhow::{Error};
use std::sync::Arc;
use super::datastore::*;
-use failure::*;
+use anyhow::{Error};
// chacha20-poly1305
-use failure::*;
+use anyhow::{Error};
use proxmox::api::{*, cli::*};
use std::io::Write;
-use failure::*;
+use anyhow::{Error};
use chrono::{DateTime, Utc};
-use failure::*;
+use anyhow::{Error};
use proxmox::api::format::*;
-use failure::*;
+use anyhow::{Error};
use proxmox::api::format::*;
use proxmox::api::cli::*;
-use failure::*;
+use anyhow::{Error};
use proxmox::api::format::dump_api;
-use failure::*;
+use anyhow::{bail, Error};
use std::thread;
use std::path::PathBuf;
use std::pin::Pin;
use std::task::{Context, Poll};
-use failure::*;
+use anyhow::{Error};
use futures::future::TryFutureExt;
use futures::stream::Stream;
use tokio::net::TcpStream;
use std::pin::Pin;
use std::task::{Context, Poll};
-use failure::*;
+use anyhow::{format_err, Error};
use futures::future::TryFutureExt;
use futures::stream::Stream;
use std::sync::Arc;
-use failure::*;
+use anyhow::{format_err, Error};
use futures::*;
use hyper::{Request, Response, Body};
use openssl::ssl::{SslMethod, SslAcceptor, SslFiletype};
-use failure::*;
+use anyhow::{Error};
use futures::*;
// Simple H2 server to test H2 speed with h2client.rs
-use failure::*;
+use anyhow::{bail, Error};
use futures::*;
use proxmox::try_block;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use nix::unistd::{fork, ForkResult, pipe};
use std::os::unix::io::RawFd;
use chrono::{Local, DateTime, Utc, TimeZone};
use std::path::PathBuf;
use std::collections::HashMap;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use serde_json::{json, Value};
use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
use std::sync::Arc;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
use hyper;
use openssl::ssl::{SslMethod, SslAcceptor, SslFiletype};
extern crate proxmox_backup;
-use failure::*;
+use anyhow::{format_err, Error};
use proxmox::{sortable, identity};
use proxmox::api::{ApiHandler, ApiMethod, RpcEnvironment};
// also see https://www.johndcook.com/blog/standard_deviation/
-use failure::*;
+use anyhow::{Error};
use std::io::{Read, Write};
use proxmox_backup::backup::*;
-use failure::*;
+use anyhow::{Error};
use futures::*;
extern crate proxmox_backup;
-use failure::*;
+use anyhow::{Error};
use proxmox_backup::client::*;
-use failure::*;
+use anyhow::{format_err, Error};
use std::io::{Read, Write, Seek, SeekFrom};
use std::fs::File;
use std::sync::Arc;
use std::fmt;
-use failure::*;
+use anyhow::{format_err, Error};
use proxmox::api::schema::*;
use proxmox::const_regex;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
-use failure::*;
+use anyhow::{format_err, Error};
use chrono::{DateTime, Utc};
use futures::*;
use futures::stream::Stream;
use std::sync::{Arc, Mutex};
use chrono::Utc;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
use http::Uri;
use http::header::HeaderValue;
use std::pin::Pin;
use std::task::{Context, Poll};
-use failure::*;
+use anyhow::{Error};
use futures::*;
use crate::backup::ChunkInfo;
use std::task::{Context, Poll};
use bytes::Bytes;
-use failure::*;
+use anyhow::{format_err, Error};
use futures::{ready, Future};
use h2::SendStream;
use std::task::{Context, Poll};
use std::thread;
-use failure::*;
+use anyhow::{format_err, Error};
use futures::stream::Stream;
use nix::fcntl::OFlag;
-use failure::*;
+use anyhow::{Error};
use std::thread;
use std::os::unix::io::FromRawFd;
use std::collections::HashMap;
use std::sync::Arc;
-use failure::*;
+use anyhow::{Error};
use super::BackupReader;
use crate::backup::{ReadChunk, DataBlob, CryptConfig};
-use failure::*;
+use anyhow::{bail, Error};
use serde_json::json;
use super::HttpClient;
//! This library contains helper to read, parse and write the
//! configuration files.
-use failure::*;
+use anyhow::{bail, format_err, Error};
use std::path::PathBuf;
use nix::sys::stat::Mode;
use openssl::rsa::{Rsa};
use std::path::{PathBuf, Path};
use std::sync::{Arc, RwLock};
-use failure::*;
+use anyhow::{bail, Error};
use lazy_static::lazy_static;
#[cfg(test)]
mod test {
- use failure::*;
+ use anyhow::{Error};
use super::AclTree;
fn check_roles(
use std::sync::Arc;
-use failure::*;
+use anyhow::{Error};
use proxmox::api::section_config::SectionConfigData;
use proxmox::api::UserInformation;
-use failure::*;
+use anyhow::{bail, Error};
use lazy_static::lazy_static;
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
-use failure::*;
+use anyhow::{bail, Error};
use lazy_static::lazy_static;
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
use std::collections::HashMap;
use std::sync::{Arc, RwLock};
-use failure::*;
+use anyhow::{bail, Error};
use lazy_static::lazy_static;
use serde::{Serialize, Deserialize};
use serde_json::json;
//! A file list catalog simply store a directory tree. Such catalogs
//! may be used as index to do a fast search for files.
-use failure::*;
+use anyhow::{Error};
use std::ffi::CStr;
pub trait BackupCatalogWriter {
use std::path::{Path, PathBuf};
use std::os::unix::ffi::OsStrExt;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use libc;
use super::binary_search_tree::search_binary_tree_by;
use std::os::unix::io::{AsRawFd, RawFd};
use std::path::PathBuf;
-use failure::{format_err, Error};
+use anyhow::{format_err, Error};
use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
use std::path::{Path, PathBuf};
use endian_trait::Endian;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::sys::stat::FileStat;
use std::cmp::Ordering;
use endian_trait::Endian;
-use failure::{bail, Error};
+use anyhow::{bail, Error};
use siphasher::sip::SipHasher24;
use std::path::Path;
use std::sync::Mutex;
-use failure::{bail, format_err, Error};
+use anyhow::{bail, format_err, Error};
use libc;
use libc::{c_char, c_int, c_void, size_t};
use std::io::Read;
use std::os::unix::io::{FromRawFd, RawFd};
-use failure::{bail, Error};
+use anyhow::{bail, Error};
use libc::{c_char, c_int};
use nix::errno::Errno;
use nix::fcntl;
/// ```
/// # use std::ffi::CString;
/// # use self::proxmox_backup::pxar::{MatchPattern, MatchType};
-/// # fn main() -> Result<(), failure::Error> {
+/// # fn main() -> Result<(), anyhow::Error> {
/// let filename = CString::new("some.conf")?;
/// let is_dir = false;
///
/// original pattern.
/// ```
/// # use self::proxmox_backup::pxar::{MatchPattern, MatchPatternSlice, MatchType};
- /// # fn main() -> Result<(), failure::Error> {
+ /// # fn main() -> Result<(), anyhow::Error> {
/// let pattern = MatchPattern::from_line(b"some/match/pattern/")?.unwrap();
/// let slice = pattern.as_slice();
/// let front = slice.get_front_pattern();
/// If no slash is encountered, the `MatchPatternSlice` will be empty.
/// ```
/// # use self::proxmox_backup::pxar::{MatchPattern, MatchPatternSlice, MatchType};
- /// # fn main() -> Result<(), failure::Error> {
+ /// # fn main() -> Result<(), anyhow::Error> {
/// let pattern = MatchPattern::from_line(b"some/match/pattern/")?.unwrap();
/// let slice = pattern.as_slice();
/// let rest = slice.get_rest_pattern();
/// ```
/// # use std::ffi::CString;
/// # use self::proxmox_backup::pxar::{MatchPattern, MatchPatternSlice, MatchType};
- /// # fn main() -> Result<(), failure::Error> {
+ /// # fn main() -> Result<(), anyhow::Error> {
/// let patterns = vec![
/// MatchPattern::from_line(b"some/match/pattern/")?.unwrap(),
/// MatchPattern::from_line(b"to_match/")?.unwrap()
/// ```
/// # use std::ffi::CString;
/// # use self::proxmox_backup::pxar::{MatchPattern, MatchPatternSlice, MatchType};
- /// # fn main() -> Result<(), failure::Error> {
+ /// # fn main() -> Result<(), anyhow::Error> {
/// let patterns = vec![
/// MatchPattern::from_line(b"some/match/pattern/")?.unwrap(),
/// MatchPattern::from_line(b"to_match/")?.unwrap()
use std::path::{Path, PathBuf};
use endian_trait::Endian;
-use failure::{bail, format_err, Error};
+use anyhow::{bail, format_err, Error};
use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
-use failure::*;
+use anyhow::{Error};
use serde_json::{json, Value};
use hyper::{Body, Response, StatusCode};
-use failure::*;
+use anyhow::{Error};
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::Arc;
use std::task::{Context, Poll};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::future::{self, FutureExt, TryFutureExt};
use futures::stream::TryStreamExt;
use hyper::header;
-use failure::*;
+use anyhow::{Error};
use lazy_static::lazy_static;
use std::sync::Mutex;
-use failure::*;
+use anyhow::{bail, Error};
use lazy_static::lazy_static;
use regex::Regex;
use chrono::Local;
use std::sync::{Arc, Mutex};
use chrono::Local;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use futures::*;
use lazy_static::lazy_static;
use nix::unistd::Pid;
use std::path::Path;
use std::time::Duration;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use serde_json::Value;
use openssl::hash::{hash, DigestBytes, MessageDigest};
use percent_encoding::AsciiSet;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
-use failure::*;
+use anyhow::{format_err, Error};
use futures::future::{FutureExt, TryFutureExt};
use tokio::sync::oneshot;
use std::pin::Pin;
use std::task::{Context, Poll};
-use failure::*;
+use anyhow::{bail, format_err, Error};
use proxmox::tools::io::{ReadExt, WriteExt};
-use failure::*;
+use anyhow::{Error};
use chrono::{TimeZone, Local};
use std::io::Write;
/// #### Example:
/// ```
/// #[macro_use] extern crate proxmox_backup;
-/// # use failure::*;
+/// # use anyhow::{bail, format_err, Error};
/// use proxmox_backup::tools::FileLogger;
///
/// # std::fs::remove_file("test.log");
-use failure::*;
+use anyhow::{Error};
use serde_json::Value;
use chrono::{Local, TimeZone};
use std::ops::{Deref, DerefMut};
use std::os::unix::io::{AsRawFd, RawFd};
-use failure::*;
+use anyhow::{format_err, Error};
use nix::dir;
use nix::dir::Dir;
use regex::Regex;
}
// Since Tied<T, U> implements Deref to U, a Tied<Dir, Iterator> already implements Iterator.
-// This is simply a wrapper with a shorter type name mapping nix::Error to failure::Error.
+// This is simply a wrapper with a shorter type name mapping nix::Error to anyhow::Error.
/// Wrapper over a pair of `nix::dir::Dir` and `nix::dir::Iter`, returned by `read_subdir()`.
pub struct ReadDir {
iter: Tied<Dir, dyn Iterator<Item = nix::Result<dir::Entry>> + Send>,
/// Whenever a cache miss occurs, the fetch method provides a corresponding value.
/// If no value can be obtained for the given key, None is returned, the cache is
/// not updated in that case.
- fn fetch(&mut self, key: K) -> Result<Option<V>, failure::Error>;
+ fn fetch(&mut self, key: K) -> Result<Option<V>, anyhow::Error>;
}
/// Node of the doubly linked list storing key and value
/// # Examples:
/// ```
/// # use self::proxmox_backup::tools::lru_cache::{Cacher, LruCache};
-/// # fn main() -> Result<(), failure::Error> {
+/// # fn main() -> Result<(), anyhow::Error> {
/// struct LruCacher {};
///
/// impl Cacher<u64, u64> for LruCacher {
-/// fn fetch(&mut self, key: u64) -> Result<Option<u64>, failure::Error> {
+/// fn fetch(&mut self, key: u64) -> Result<Option<u64>, anyhow::Error> {
/// Ok(Some(key))
/// }
/// }
/// value.
/// If fetch returns a value, it is inserted as the most recently used entry
/// in the cache.
- pub fn access<'a>(&'a mut self, key: K, cacher: &mut dyn Cacher<K, V>) -> Result<Option<&'a mut V>, failure::Error> {
+ pub fn access<'a>(&'a mut self, key: K, cacher: &mut dyn Cacher<K, V>) -> Result<Option<&'a mut V>, anyhow::Error> {
match self.map.entry(key) {
Entry::Occupied(mut o) => {
// Cache hit, birng node to front of list
//! the timestamp for the oldest open lock with
//! `oldest_shared_lock()`.
-use failure::*;
+use anyhow::{bail, Error};
use std::sync::{Arc, Mutex};
use std::os::unix::io::AsRawFd;
use std::io::Write;
use std::sync::mpsc::SyncSender;
-use failure::*;
+use anyhow::{Error};
/// Wrapper around SyncSender, which implements Write
///
//! Generate and verify Authentification tickets
-use failure::*;
+use anyhow::{bail, Error};
use base64;
use openssl::pkey::{PKey, Public, Private};
mod test {
use std::io;
- use failure::Error;
+ use anyhow::Error;
use futures::stream::TryStreamExt;
#[test]
-use failure::*;
+use anyhow::{bail, Error};
use std::sync::Arc;
use std::io::Cursor;
use std::io::{Read, Write, Seek, SeekFrom };
-use failure::*;
+use anyhow::{Error};
use std::process::Command;
use proxmox_backup::pxar::*;
-use failure::*;
+use anyhow::{Error};
use std::path::PathBuf;
use proxmox_backup::backup::*;
-use failure::*;
+use anyhow::{bail, format_err, Error};
use proxmox_backup::api2;
use proxmox::api::*;
-use failure::*;
+use anyhow::{bail, Error};
#[macro_use]
extern crate proxmox_backup;