diff --git a/Cargo.lock b/Cargo.lock index 3d18f3db..b9d683a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -739,9 +739,9 @@ dependencies = [ [[package]] name = "conflate" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06f57b4959992e02db0da86fcb4b0c80dc112d31b823de27f61576b1c809bc45" +checksum = "ce1803bd64597191f7f4afa2dd0437f76b7b3c065d0e4566380012406c28eaac" dependencies = [ "conflate_derive", "num-traits", diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index abc8c9e7..525600b2 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -71,7 +71,7 @@ url = "2.5.2" # cli support clap = { version = "4.5.19", optional = true, features = ["derive", "env", "wrap_help"] } -conflate = { version = "0.2.0", optional = true } +conflate = { version = "0.3.1", optional = true } # local backend aho-corasick = { workspace = true } diff --git a/crates/backend/src/choose.rs b/crates/backend/src/choose.rs index 9dca3831..ca83a42d 100644 --- a/crates/backend/src/choose.rs +++ b/crates/backend/src/choose.rs @@ -1,6 +1,6 @@ //! This module contains [`BackendOptions`] and helpers to choose a backend from a given url. use derive_setters::Setters; -use std::{collections::HashMap, sync::Arc}; +use std::{collections::BTreeMap, sync::Arc}; use strum_macros::{Display, EnumString}; use rustic_core::{ErrorKind, RepositoryBackends, RusticError, RusticResult, WriteBackend}; @@ -48,18 +48,18 @@ pub struct BackendOptions { /// Other options for this repository (hot and cold part) #[cfg_attr(feature = "clap", clap(skip))] - #[cfg_attr(feature = "merge", merge(strategy = conflate::hashmap::ignore))] - pub options: HashMap, + #[cfg_attr(feature = "merge", merge(strategy = conflate::btreemap::append_or_ignore))] + pub options: BTreeMap, /// Other options for the hot repository #[cfg_attr(feature = "clap", clap(skip))] - #[cfg_attr(feature = "merge", merge(strategy = conflate::hashmap::ignore))] - pub options_hot: HashMap, + #[cfg_attr(feature = "merge", merge(strategy = conflate::btreemap::append_or_ignore))] + pub options_hot: BTreeMap, /// Other options for the cold repository #[cfg_attr(feature = "clap", clap(skip))] - #[cfg_attr(feature = "merge", merge(strategy = conflate::hashmap::ignore))] - pub options_cold: HashMap, + #[cfg_attr(feature = "merge", merge(strategy = conflate::btreemap::append_or_ignore))] + pub options_cold: BTreeMap, } impl BackendOptions { @@ -109,7 +109,7 @@ impl BackendOptions { fn get_backend( &self, repo_string: Option<&String>, - options: HashMap, + options: BTreeMap, ) -> RusticResult>> { repo_string .map(|string| { @@ -142,7 +142,7 @@ pub trait BackendChoice { fn to_backend( &self, location: BackendLocation, - options: Option>, + options: Option>, ) -> RusticResult>; } @@ -180,7 +180,7 @@ impl BackendChoice for SupportedBackend { fn to_backend( &self, location: BackendLocation, - options: Option>, + options: Option>, ) -> RusticResult> { let options = options.unwrap_or_default(); diff --git a/crates/backend/src/opendal.rs b/crates/backend/src/opendal.rs index e1fb71fa..c57b5c7f 100644 --- a/crates/backend/src/opendal.rs +++ b/crates/backend/src/opendal.rs @@ -1,5 +1,5 @@ /// `OpenDAL` backend for rustic. -use std::{collections::HashMap, str::FromStr, sync::OnceLock}; +use std::{collections::BTreeMap, str::FromStr, sync::OnceLock}; use bytes::Bytes; use bytesize::ByteSize; @@ -102,7 +102,7 @@ impl OpenDALBackend { /// # Returns /// /// A new `OpenDAL` backend. - pub fn new(path: impl AsRef, options: HashMap) -> RusticResult { + pub fn new(path: impl AsRef, options: BTreeMap) -> RusticResult { let max_retries = match options.get("retry").map(String::as_str) { Some("false" | "off") => 0, None | Some("default") => constants::DEFAULT_RETRY, @@ -521,7 +521,7 @@ mod tests { #[derive(Deserialize)] struct TestCase { path: String, - options: HashMap, + options: BTreeMap, } let test: TestCase = toml::from_str(&fs::read_to_string(test_case)?)?; diff --git a/crates/backend/src/rclone.rs b/crates/backend/src/rclone.rs index 24836cf4..94bb4b3b 100644 --- a/crates/backend/src/rclone.rs +++ b/crates/backend/src/rclone.rs @@ -1,5 +1,5 @@ use std::{ - collections::HashMap, + collections::BTreeMap, io::{BufRead, BufReader}, process::{Child, Command, Stdio}, thread::JoinHandle, @@ -144,7 +144,7 @@ impl RcloneBackend { /// * If the rclone command is not found. // TODO: This should be an error, not a panic. #[allow(clippy::too_many_lines)] - pub fn new(url: impl AsRef, options: HashMap) -> RusticResult { + pub fn new(url: impl AsRef, options: BTreeMap) -> RusticResult { let rclone_command = options.get("rclone-command"); let use_password = options .get("use-password") diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 2c02d814..382c27cf 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -87,7 +87,7 @@ dirs = "5.0.1" # cli support clap = { version = "4.5.19", optional = true, features = ["derive", "env", "wrap_help"] } -conflate = { version = "0.2.0", optional = true } +conflate = { version = "0.3.1", optional = true } # vfs support dav-server = { version = "0.7.0", default-features = false, optional = true }