coven/storage/local/
mod.rs1mod traits;
7
8pub use traits::BlobStore;
9
10pub fn storage_path(file_id: &str) -> String {
15 crate::library_dir::LibraryDir::hashed_path("storage", file_id)
16}
17
18#[cfg(test)]
19mod tests {
20 use super::*;
21
22 #[test]
23 fn storage_path_uses_first_four_hex_chars() {
24 let id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
25 let path = storage_path(id);
26 assert_eq!(path, format!("storage/a1/b2/{}", id));
27 }
28
29 #[test]
30 fn storage_path_preserves_original_id_with_dashes() {
31 let id = "12345678-aaaa-bbbb-cccc-ddddeeeeaaaa";
32 let path = storage_path(id);
33 assert_eq!(path, format!("storage/12/34/{}", id));
35 assert!(path.ends_with(id));
37 }
38}