Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3361741
D9017.id30537.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9017.id30537.diff
View Options
diff --git a/services/backup/Cargo.lock b/services/backup/Cargo.lock
--- a/services/backup/Cargo.lock
+++ b/services/backup/Cargo.lock
@@ -759,7 +759,6 @@
"comm-services-lib",
"derive_more",
"once_cell",
- "rand",
"reqwest",
"serde",
"serde_json",
diff --git a/services/backup/Cargo.toml b/services/backup/Cargo.toml
--- a/services/backup/Cargo.toml
+++ b/services/backup/Cargo.toml
@@ -19,7 +19,6 @@
"blob-client",
] }
once_cell = "1.17"
-rand = "0.8.5"
tokio = { version = "1.24", features = ["rt-multi-thread", "macros"] }
tokio-stream = "0.1"
tracing = "0.1"
diff --git a/services/backup/src/main.rs b/services/backup/src/main.rs
--- a/services/backup/src/main.rs
+++ b/services/backup/src/main.rs
@@ -8,7 +8,6 @@
pub mod database;
pub mod error;
pub mod http;
-pub mod utils;
// re-export this to be available as crate::CONFIG
pub use config::CONFIG;
diff --git a/services/backup/src/utils.rs b/services/backup/src/utils.rs
deleted file mode 100644
--- a/services/backup/src/utils.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-use rand::{distributions::DistString, CryptoRng, Rng};
-use uuid::Uuid;
-
-use crate::constants::ID_SEPARATOR;
-
-/// Generates a blob `holder` string used to store backup/log data
-/// in Blob service
-pub fn generate_blob_holder(
- blob_hash: &str,
- backup_id: &str,
- resource_id: Option<&str>,
-) -> String {
- format!(
- "{backup_id}{sep}{resource_id}{sep}{blob_hash}{sep}{uuid}",
- backup_id = backup_id,
- resource_id = resource_id.unwrap_or_default(),
- blob_hash = blob_hash,
- sep = ID_SEPARATOR,
- uuid = Uuid::new_v4()
- )
-}
-
-pub fn generate_random_string(
- length: usize,
- rng: &mut (impl Rng + CryptoRng),
-) -> String {
- rand::distributions::Alphanumeric.sample_string(rng, length)
-}
diff --git a/services/comm-services-lib/src/tools.rs b/services/comm-services-lib/src/tools.rs
--- a/services/comm-services-lib/src/tools.rs
+++ b/services/comm-services-lib/src/tools.rs
@@ -1,3 +1,5 @@
+use rand::{distributions::DistString, CryptoRng, Rng};
+
// colon is valid because it is used as a separator
// in some backup service identifiers
const VALID_IDENTIFIER_CHARS: &'static [char] = &['_', '-', '=', ':'];
@@ -72,6 +74,13 @@
}
}
+pub fn generate_random_string(
+ length: usize,
+ rng: &mut (impl Rng + CryptoRng),
+) -> String {
+ rand::distributions::Alphanumeric.sample_string(rng, length)
+}
+
#[cfg(test)]
mod valid_identifier_tests {
use super::*;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 7:06 PM (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580468
Default Alt Text
D9017.id30537.diff (2 KB)
Attached To
Mode
D9017: [backup] Cleanup utils
Attached
Detach File
Event Timeline
Log In to Comment