Skip to content

Commit 093eab3

Browse files
simonsanaawsome
andauthored
refactor(deps)!: upgrade to new conflate version (#300)
BREAKING CHANGE: We replaced the use of HashMaps with BTreeMaps in `rustic_backend`. --------- Signed-off-by: simonsan <[email protected]> Co-authored-by: aawsome <[email protected]>
1 parent 40ad287 commit 093eab3

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ url = "2.5.2"
7171

7272
# cli support
7373
clap = { version = "4.5.19", optional = true, features = ["derive", "env", "wrap_help"] }
74-
conflate = { version = "0.2.0", optional = true }
74+
conflate = { version = "0.3.1", optional = true }
7575

7676
# local backend
7777
aho-corasick = { workspace = true }

crates/backend/src/choose.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This module contains [`BackendOptions`] and helpers to choose a backend from a given url.
22
use derive_setters::Setters;
3-
use std::{collections::HashMap, sync::Arc};
3+
use std::{collections::BTreeMap, sync::Arc};
44
use strum_macros::{Display, EnumString};
55

66
use rustic_core::{ErrorKind, RepositoryBackends, RusticError, RusticResult, WriteBackend};
@@ -48,18 +48,18 @@ pub struct BackendOptions {
4848

4949
/// Other options for this repository (hot and cold part)
5050
#[cfg_attr(feature = "clap", clap(skip))]
51-
#[cfg_attr(feature = "merge", merge(strategy = conflate::hashmap::ignore))]
52-
pub options: HashMap<String, String>,
51+
#[cfg_attr(feature = "merge", merge(strategy = conflate::btreemap::append_or_ignore))]
52+
pub options: BTreeMap<String, String>,
5353

5454
/// Other options for the hot repository
5555
#[cfg_attr(feature = "clap", clap(skip))]
56-
#[cfg_attr(feature = "merge", merge(strategy = conflate::hashmap::ignore))]
57-
pub options_hot: HashMap<String, String>,
56+
#[cfg_attr(feature = "merge", merge(strategy = conflate::btreemap::append_or_ignore))]
57+
pub options_hot: BTreeMap<String, String>,
5858

5959
/// Other options for the cold repository
6060
#[cfg_attr(feature = "clap", clap(skip))]
61-
#[cfg_attr(feature = "merge", merge(strategy = conflate::hashmap::ignore))]
62-
pub options_cold: HashMap<String, String>,
61+
#[cfg_attr(feature = "merge", merge(strategy = conflate::btreemap::append_or_ignore))]
62+
pub options_cold: BTreeMap<String, String>,
6363
}
6464

6565
impl BackendOptions {
@@ -109,7 +109,7 @@ impl BackendOptions {
109109
fn get_backend(
110110
&self,
111111
repo_string: Option<&String>,
112-
options: HashMap<String, String>,
112+
options: BTreeMap<String, String>,
113113
) -> RusticResult<Option<Arc<dyn WriteBackend>>> {
114114
repo_string
115115
.map(|string| {
@@ -142,7 +142,7 @@ pub trait BackendChoice {
142142
fn to_backend(
143143
&self,
144144
location: BackendLocation,
145-
options: Option<HashMap<String, String>>,
145+
options: Option<BTreeMap<String, String>>,
146146
) -> RusticResult<Arc<dyn WriteBackend>>;
147147
}
148148

@@ -180,7 +180,7 @@ impl BackendChoice for SupportedBackend {
180180
fn to_backend(
181181
&self,
182182
location: BackendLocation,
183-
options: Option<HashMap<String, String>>,
183+
options: Option<BTreeMap<String, String>>,
184184
) -> RusticResult<Arc<dyn WriteBackend>> {
185185
let options = options.unwrap_or_default();
186186

crates/backend/src/opendal.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// `OpenDAL` backend for rustic.
2-
use std::{collections::HashMap, str::FromStr, sync::OnceLock};
2+
use std::{collections::BTreeMap, str::FromStr, sync::OnceLock};
33

44
use bytes::Bytes;
55
use bytesize::ByteSize;
@@ -102,7 +102,7 @@ impl OpenDALBackend {
102102
/// # Returns
103103
///
104104
/// A new `OpenDAL` backend.
105-
pub fn new(path: impl AsRef<str>, options: HashMap<String, String>) -> RusticResult<Self> {
105+
pub fn new(path: impl AsRef<str>, options: BTreeMap<String, String>) -> RusticResult<Self> {
106106
let max_retries = match options.get("retry").map(String::as_str) {
107107
Some("false" | "off") => 0,
108108
None | Some("default") => constants::DEFAULT_RETRY,
@@ -521,7 +521,7 @@ mod tests {
521521
#[derive(Deserialize)]
522522
struct TestCase {
523523
path: String,
524-
options: HashMap<String, String>,
524+
options: BTreeMap<String, String>,
525525
}
526526

527527
let test: TestCase = toml::from_str(&fs::read_to_string(test_case)?)?;

crates/backend/src/rclone.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
collections::HashMap,
2+
collections::BTreeMap,
33
io::{BufRead, BufReader},
44
process::{Child, Command, Stdio},
55
thread::JoinHandle,
@@ -144,7 +144,7 @@ impl RcloneBackend {
144144
/// * If the rclone command is not found.
145145
// TODO: This should be an error, not a panic.
146146
#[allow(clippy::too_many_lines)]
147-
pub fn new(url: impl AsRef<str>, options: HashMap<String, String>) -> RusticResult<Self> {
147+
pub fn new(url: impl AsRef<str>, options: BTreeMap<String, String>) -> RusticResult<Self> {
148148
let rclone_command = options.get("rclone-command");
149149
let use_password = options
150150
.get("use-password")

crates/core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ dirs = "5.0.1"
8787

8888
# cli support
8989
clap = { version = "4.5.19", optional = true, features = ["derive", "env", "wrap_help"] }
90-
conflate = { version = "0.2.0", optional = true }
90+
conflate = { version = "0.3.1", optional = true }
9191

9292
# vfs support
9393
dav-server = { version = "0.7.0", default-features = false, optional = true }

0 commit comments

Comments
 (0)