|
1 | 1 | //! This module contains [`BackendOptions`] and helpers to choose a backend from a given url.
|
2 | 2 | use derive_setters::Setters;
|
3 |
| -use std::{collections::HashMap, sync::Arc}; |
| 3 | +use std::{collections::BTreeMap, sync::Arc}; |
4 | 4 | use strum_macros::{Display, EnumString};
|
5 | 5 |
|
6 | 6 | use rustic_core::{ErrorKind, RepositoryBackends, RusticError, RusticResult, WriteBackend};
|
@@ -48,18 +48,18 @@ pub struct BackendOptions {
|
48 | 48 |
|
49 | 49 | /// Other options for this repository (hot and cold part)
|
50 | 50 | #[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>, |
53 | 53 |
|
54 | 54 | /// Other options for the hot repository
|
55 | 55 | #[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>, |
58 | 58 |
|
59 | 59 | /// Other options for the cold repository
|
60 | 60 | #[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>, |
63 | 63 | }
|
64 | 64 |
|
65 | 65 | impl BackendOptions {
|
@@ -109,7 +109,7 @@ impl BackendOptions {
|
109 | 109 | fn get_backend(
|
110 | 110 | &self,
|
111 | 111 | repo_string: Option<&String>,
|
112 |
| - options: HashMap<String, String>, |
| 112 | + options: BTreeMap<String, String>, |
113 | 113 | ) -> RusticResult<Option<Arc<dyn WriteBackend>>> {
|
114 | 114 | repo_string
|
115 | 115 | .map(|string| {
|
@@ -142,7 +142,7 @@ pub trait BackendChoice {
|
142 | 142 | fn to_backend(
|
143 | 143 | &self,
|
144 | 144 | location: BackendLocation,
|
145 |
| - options: Option<HashMap<String, String>>, |
| 145 | + options: Option<BTreeMap<String, String>>, |
146 | 146 | ) -> RusticResult<Arc<dyn WriteBackend>>;
|
147 | 147 | }
|
148 | 148 |
|
@@ -180,7 +180,7 @@ impl BackendChoice for SupportedBackend {
|
180 | 180 | fn to_backend(
|
181 | 181 | &self,
|
182 | 182 | location: BackendLocation,
|
183 |
| - options: Option<HashMap<String, String>>, |
| 183 | + options: Option<BTreeMap<String, String>>, |
184 | 184 | ) -> RusticResult<Arc<dyn WriteBackend>> {
|
185 | 185 | let options = options.unwrap_or_default();
|
186 | 186 |
|
|
0 commit comments