From 2d59891dee0984d2129b6dcbbccc8d8df63fe339 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sun, 23 Apr 2023 00:27:09 -0700 Subject: [PATCH] organize "file"-related/adjacent crates together --- Cargo.toml | 10 +++++----- crates/lib/deprecated/container_common/Cargo.toml | 2 +- crates/lib/files/{ => files}/Cargo.toml | 0 crates/lib/files/{ => files}/src/hash.rs | 0 crates/lib/files/{ => files}/src/lib.rs | 0 crates/lib/files/{ => files}/src/mimetype.rs | 0 crates/lib/{ => files}/filesys/Cargo.toml | 2 +- .../filesys/src/create_dir_all_if_missing.rs | 0 crates/lib/{ => files}/filesys/src/directory_exists.rs | 4 ++-- crates/lib/{ => files}/filesys/src/file_exists.rs | 0 crates/lib/{ => files}/filesys/src/file_size.rs | 0 crates/lib/{ => files}/filesys/src/filename_concat.rs | 0 crates/lib/{ => files}/filesys/src/lib.rs | 0 crates/lib/{ => files}/filesys/src/path_to_string.rs | 0 crates/lib/{ => files}/hashing/Cargo.toml | 2 +- crates/lib/{ => files}/hashing/src/lib.rs | 0 crates/lib/{ => files}/hashing/src/sha256/mod.rs | 0 .../hashing/src/sha256/sha256_digest_buffer.rs | 0 .../{ => files}/hashing/src/sha256/sha256_hash_file.rs | 0 .../hashing/src/sha256/sha256_hash_string.rs | 0 crates/lib/{ => files}/media/Cargo.toml | 2 +- .../{ => files}/media/src/decode_basic_audio_info.rs | 0 crates/lib/{ => files}/media/src/lib.rs | 0 crates/lib/{ => files}/mimetypes/Cargo.toml | 2 +- crates/lib/{ => files}/mimetypes/src/lib.rs | 0 .../{ => files}/mimetypes/src/mimetype_for_bytes.rs | 0 .../lib/{ => files}/mimetypes/src/mimetype_for_file.rs | 0 crates/programs/aichatbot-sidecar/Cargo.toml | 8 ++++---- crates/service/job/download_job/Cargo.toml | 6 +++--- crates/service/job/inference_job/Cargo.toml | 6 +++--- crates/service/job/tts_download_job/Cargo.toml | 2 +- crates/service/job/tts_inference_job/Cargo.toml | 2 +- crates/service/job/w2l_download_job/Cargo.toml | 2 +- crates/service/web/storyteller_web/Cargo.toml | 4 ++-- 34 files changed, 27 insertions(+), 27 deletions(-) rename crates/lib/files/{ => files}/Cargo.toml (100%) rename crates/lib/files/{ => files}/src/hash.rs (100%) rename crates/lib/files/{ => files}/src/lib.rs (100%) rename crates/lib/files/{ => files}/src/mimetype.rs (100%) rename crates/lib/{ => files}/filesys/Cargo.toml (90%) rename crates/lib/{ => files}/filesys/src/create_dir_all_if_missing.rs (100%) rename crates/lib/{ => files}/filesys/src/directory_exists.rs (91%) rename crates/lib/{ => files}/filesys/src/file_exists.rs (100%) rename crates/lib/{ => files}/filesys/src/file_size.rs (100%) rename crates/lib/{ => files}/filesys/src/filename_concat.rs (100%) rename crates/lib/{ => files}/filesys/src/lib.rs (100%) rename crates/lib/{ => files}/filesys/src/path_to_string.rs (100%) rename crates/lib/{ => files}/hashing/Cargo.toml (91%) rename crates/lib/{ => files}/hashing/src/lib.rs (100%) rename crates/lib/{ => files}/hashing/src/sha256/mod.rs (100%) rename crates/lib/{ => files}/hashing/src/sha256/sha256_digest_buffer.rs (100%) rename crates/lib/{ => files}/hashing/src/sha256/sha256_hash_file.rs (100%) rename crates/lib/{ => files}/hashing/src/sha256/sha256_hash_string.rs (100%) rename crates/lib/{ => files}/media/Cargo.toml (93%) rename crates/lib/{ => files}/media/src/decode_basic_audio_info.rs (100%) rename crates/lib/{ => files}/media/src/lib.rs (100%) rename crates/lib/{ => files}/mimetypes/Cargo.toml (91%) rename crates/lib/{ => files}/mimetypes/src/lib.rs (100%) rename crates/lib/{ => files}/mimetypes/src/mimetype_for_bytes.rs (100%) rename crates/lib/{ => files}/mimetypes/src/mimetype_for_file.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 5a32ab2c75..bebc8b0408 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,13 +29,13 @@ members = [ "crates/lib/deprecated/http_server_common", # TODO(bt, 2023-03-20): Move useful pieces to actix_helpers "crates/lib/envvar", "crates/lib/errors", - "crates/lib/files", - "crates/lib/filesys", - "crates/lib/hashing", + "crates/lib/files/files", + "crates/lib/files/filesys", + "crates/lib/files/hashing", + "crates/lib/files/media", + "crates/lib/files/mimetypes", "crates/lib/idempotency", "crates/lib/jobs_common", - "crates/lib/media", - "crates/lib/mimetypes", "crates/lib/mysql_queries", "crates/lib/redis_common", "crates/lib/sqlite_queries", diff --git a/crates/lib/deprecated/container_common/Cargo.toml b/crates/lib/deprecated/container_common/Cargo.toml index 35dfbfa2b3..17ffbf1ed4 100644 --- a/crates/lib/deprecated/container_common/Cargo.toml +++ b/crates/lib/deprecated/container_common/Cargo.toml @@ -15,7 +15,7 @@ path = "src/lib.rs" [dependencies] # Internal errors = { path = "../../errors" } -hashing = { path = "../../hashing" } +hashing = { path = "../../files/hashing" } # External anyhow = "1.0.40" diff --git a/crates/lib/files/Cargo.toml b/crates/lib/files/files/Cargo.toml similarity index 100% rename from crates/lib/files/Cargo.toml rename to crates/lib/files/files/Cargo.toml diff --git a/crates/lib/files/src/hash.rs b/crates/lib/files/files/src/hash.rs similarity index 100% rename from crates/lib/files/src/hash.rs rename to crates/lib/files/files/src/hash.rs diff --git a/crates/lib/files/src/lib.rs b/crates/lib/files/files/src/lib.rs similarity index 100% rename from crates/lib/files/src/lib.rs rename to crates/lib/files/files/src/lib.rs diff --git a/crates/lib/files/src/mimetype.rs b/crates/lib/files/files/src/mimetype.rs similarity index 100% rename from crates/lib/files/src/mimetype.rs rename to crates/lib/files/files/src/mimetype.rs diff --git a/crates/lib/filesys/Cargo.toml b/crates/lib/files/filesys/Cargo.toml similarity index 90% rename from crates/lib/filesys/Cargo.toml rename to crates/lib/files/filesys/Cargo.toml index f1ef0dbfb3..8fb3e5007b 100644 --- a/crates/lib/filesys/Cargo.toml +++ b/crates/lib/files/filesys/Cargo.toml @@ -15,7 +15,7 @@ path = "src/lib.rs" [dependencies] # Internal -errors = { path = "../../lib/errors" } +errors = { path = "../../errors" } # External # KEEP THIS TO A MINIMUM OR NIL. diff --git a/crates/lib/filesys/src/create_dir_all_if_missing.rs b/crates/lib/files/filesys/src/create_dir_all_if_missing.rs similarity index 100% rename from crates/lib/filesys/src/create_dir_all_if_missing.rs rename to crates/lib/files/filesys/src/create_dir_all_if_missing.rs diff --git a/crates/lib/filesys/src/directory_exists.rs b/crates/lib/files/filesys/src/directory_exists.rs similarity index 91% rename from crates/lib/filesys/src/directory_exists.rs rename to crates/lib/files/filesys/src/directory_exists.rs index 7f2644a7a6..471c4d3bf7 100644 --- a/crates/lib/filesys/src/directory_exists.rs +++ b/crates/lib/files/filesys/src/directory_exists.rs @@ -21,13 +21,13 @@ mod tests { #[test] fn test_directory_exists() { // Common directories - assert_eq!(true, directory_exists(".")); + assert_eq!(true, directory_exists("../../../../..")); assert_eq!(true, directory_exists("./")); assert_eq!(true, directory_exists("../")); assert_eq!(true, directory_exists("/")); // As PathBuf - assert_eq!(true, directory_exists(PathBuf::from("."))); + assert_eq!(true, directory_exists(PathBuf::from("../../../../.."))); assert_eq!(true, directory_exists(PathBuf::from("./"))); assert_eq!(true, directory_exists(PathBuf::from("../"))); assert_eq!(true, directory_exists(PathBuf::from("/"))); diff --git a/crates/lib/filesys/src/file_exists.rs b/crates/lib/files/filesys/src/file_exists.rs similarity index 100% rename from crates/lib/filesys/src/file_exists.rs rename to crates/lib/files/filesys/src/file_exists.rs diff --git a/crates/lib/filesys/src/file_size.rs b/crates/lib/files/filesys/src/file_size.rs similarity index 100% rename from crates/lib/filesys/src/file_size.rs rename to crates/lib/files/filesys/src/file_size.rs diff --git a/crates/lib/filesys/src/filename_concat.rs b/crates/lib/files/filesys/src/filename_concat.rs similarity index 100% rename from crates/lib/filesys/src/filename_concat.rs rename to crates/lib/files/filesys/src/filename_concat.rs diff --git a/crates/lib/filesys/src/lib.rs b/crates/lib/files/filesys/src/lib.rs similarity index 100% rename from crates/lib/filesys/src/lib.rs rename to crates/lib/files/filesys/src/lib.rs diff --git a/crates/lib/filesys/src/path_to_string.rs b/crates/lib/files/filesys/src/path_to_string.rs similarity index 100% rename from crates/lib/filesys/src/path_to_string.rs rename to crates/lib/files/filesys/src/path_to_string.rs diff --git a/crates/lib/hashing/Cargo.toml b/crates/lib/files/hashing/Cargo.toml similarity index 91% rename from crates/lib/hashing/Cargo.toml rename to crates/lib/files/hashing/Cargo.toml index 5c594f5624..4b687faa42 100644 --- a/crates/lib/hashing/Cargo.toml +++ b/crates/lib/files/hashing/Cargo.toml @@ -15,7 +15,7 @@ path = "src/lib.rs" [dependencies] # Internal -errors = { path = "../../lib/errors" } +errors = { path = "../../errors" } # External data-encoding = "2.3.2" diff --git a/crates/lib/hashing/src/lib.rs b/crates/lib/files/hashing/src/lib.rs similarity index 100% rename from crates/lib/hashing/src/lib.rs rename to crates/lib/files/hashing/src/lib.rs diff --git a/crates/lib/hashing/src/sha256/mod.rs b/crates/lib/files/hashing/src/sha256/mod.rs similarity index 100% rename from crates/lib/hashing/src/sha256/mod.rs rename to crates/lib/files/hashing/src/sha256/mod.rs diff --git a/crates/lib/hashing/src/sha256/sha256_digest_buffer.rs b/crates/lib/files/hashing/src/sha256/sha256_digest_buffer.rs similarity index 100% rename from crates/lib/hashing/src/sha256/sha256_digest_buffer.rs rename to crates/lib/files/hashing/src/sha256/sha256_digest_buffer.rs diff --git a/crates/lib/hashing/src/sha256/sha256_hash_file.rs b/crates/lib/files/hashing/src/sha256/sha256_hash_file.rs similarity index 100% rename from crates/lib/hashing/src/sha256/sha256_hash_file.rs rename to crates/lib/files/hashing/src/sha256/sha256_hash_file.rs diff --git a/crates/lib/hashing/src/sha256/sha256_hash_string.rs b/crates/lib/files/hashing/src/sha256/sha256_hash_string.rs similarity index 100% rename from crates/lib/hashing/src/sha256/sha256_hash_string.rs rename to crates/lib/files/hashing/src/sha256/sha256_hash_string.rs diff --git a/crates/lib/media/Cargo.toml b/crates/lib/files/media/Cargo.toml similarity index 93% rename from crates/lib/media/Cargo.toml rename to crates/lib/files/media/Cargo.toml index e6c8a945c2..f6992d239b 100644 --- a/crates/lib/media/Cargo.toml +++ b/crates/lib/files/media/Cargo.toml @@ -15,7 +15,7 @@ path = "src/lib.rs" [dependencies] # Internal -errors = { path = "../errors" } +errors = { path = "../../errors" } # External log = "0.4.14" diff --git a/crates/lib/media/src/decode_basic_audio_info.rs b/crates/lib/files/media/src/decode_basic_audio_info.rs similarity index 100% rename from crates/lib/media/src/decode_basic_audio_info.rs rename to crates/lib/files/media/src/decode_basic_audio_info.rs diff --git a/crates/lib/media/src/lib.rs b/crates/lib/files/media/src/lib.rs similarity index 100% rename from crates/lib/media/src/lib.rs rename to crates/lib/files/media/src/lib.rs diff --git a/crates/lib/mimetypes/Cargo.toml b/crates/lib/files/mimetypes/Cargo.toml similarity index 91% rename from crates/lib/mimetypes/Cargo.toml rename to crates/lib/files/mimetypes/Cargo.toml index d4d1cde116..6c96cfe30e 100644 --- a/crates/lib/mimetypes/Cargo.toml +++ b/crates/lib/files/mimetypes/Cargo.toml @@ -15,7 +15,7 @@ path = "src/lib.rs" [dependencies] # Internal -errors = { path = "../../lib/errors" } +errors = { path = "../../errors" } # External infer = "0.11" # Mimetype detection diff --git a/crates/lib/mimetypes/src/lib.rs b/crates/lib/files/mimetypes/src/lib.rs similarity index 100% rename from crates/lib/mimetypes/src/lib.rs rename to crates/lib/files/mimetypes/src/lib.rs diff --git a/crates/lib/mimetypes/src/mimetype_for_bytes.rs b/crates/lib/files/mimetypes/src/mimetype_for_bytes.rs similarity index 100% rename from crates/lib/mimetypes/src/mimetype_for_bytes.rs rename to crates/lib/files/mimetypes/src/mimetype_for_bytes.rs diff --git a/crates/lib/mimetypes/src/mimetype_for_file.rs b/crates/lib/files/mimetypes/src/mimetype_for_file.rs similarity index 100% rename from crates/lib/mimetypes/src/mimetype_for_file.rs rename to crates/lib/files/mimetypes/src/mimetype_for_file.rs diff --git a/crates/programs/aichatbot-sidecar/Cargo.toml b/crates/programs/aichatbot-sidecar/Cargo.toml index b836f0ef59..1a4e2e54c2 100644 --- a/crates/programs/aichatbot-sidecar/Cargo.toml +++ b/crates/programs/aichatbot-sidecar/Cargo.toml @@ -20,12 +20,12 @@ concurrency = { path = "../../lib/concurrency" } enums = { path = "../../_types/enums" } errors = { path = "../../lib/errors" } fakeyou_client = { path = "../../lib/api_clients/fakeyou_client" } -files = { path = "../../lib/files" } -filesys = { path = "../../lib/filesys" } -hashing = { path = "../../lib/hashing" } +files = { path = "../../lib/files/files" } +filesys = { path = "../../lib/files/filesys" } +hashing = { path = "../../lib/files/hashing" } http_server_common = { path = "../../lib/deprecated/http_server_common" } idempotency = { path = "../../lib/idempotency" } -media = { path = "../../lib/media" } +media = { path = "../../lib/files/media" } sqlite_queries = { path = "../../lib/sqlite_queries" } tokens = { path = "../../_types/tokens" } web_scrapers = { path = "../../lib/web_scrapers" } diff --git a/crates/service/job/download_job/Cargo.toml b/crates/service/job/download_job/Cargo.toml index 4a55b5085a..1701ad1cf0 100644 --- a/crates/service/job/download_job/Cargo.toml +++ b/crates/service/job/download_job/Cargo.toml @@ -21,10 +21,10 @@ container_common = { path = "../../../lib/deprecated/container_common" } enums = { path = "../../../_types/enums" } envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } -files = { path = "../../../lib/files" } -filesys = { path = "../../../lib/filesys" } +files = { path = "../../../lib/files/files" } +filesys = { path = "../../../lib/files/filesys" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } -hashing = { path = "../../../lib/hashing" } +hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } mysql_queries = { path = "../../../lib/mysql_queries" } reusable_types = { path = "../../../_types/reusable_types" } diff --git a/crates/service/job/inference_job/Cargo.toml b/crates/service/job/inference_job/Cargo.toml index 23536d6b62..9899304662 100644 --- a/crates/service/job/inference_job/Cargo.toml +++ b/crates/service/job/inference_job/Cargo.toml @@ -22,9 +22,9 @@ container_common = { path = "../../../lib/deprecated/container_common" } enums = { path = "../../../_types/enums" } envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } -files = { path = "../../../lib/files" } -filesys = { path = "../../../lib/filesys" } -hashing = { path = "../../../lib/hashing" } +files = { path = "../../../lib/files/files" } +filesys = { path = "../../../lib/files/filesys" } +hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } memory_caching = { path = "../../../lib/caching/memory_caching" } mysql_queries = { path = "../../../lib/mysql_queries" } diff --git a/crates/service/job/tts_download_job/Cargo.toml b/crates/service/job/tts_download_job/Cargo.toml index c41b19e461..8795acd7b9 100644 --- a/crates/service/job/tts_download_job/Cargo.toml +++ b/crates/service/job/tts_download_job/Cargo.toml @@ -20,7 +20,7 @@ config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } enums = { path = "../../../_types/enums" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } -hashing = { path = "../../../lib/hashing" } +hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } mysql_queries = { path = "../../../lib/mysql_queries" } tts_common = { path = "../../../lib/tts_common" } diff --git a/crates/service/job/tts_inference_job/Cargo.toml b/crates/service/job/tts_inference_job/Cargo.toml index 47f4d3b707..8f4835ee6a 100644 --- a/crates/service/job/tts_inference_job/Cargo.toml +++ b/crates/service/job/tts_inference_job/Cargo.toml @@ -18,7 +18,7 @@ path = "src/main.rs" cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } -hashing = { path = "../../../lib/hashing" } +hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } memory_caching = { path = "../../../lib/caching/memory_caching" } mysql_queries = { path = "../../../lib/mysql_queries" } diff --git a/crates/service/job/w2l_download_job/Cargo.toml b/crates/service/job/w2l_download_job/Cargo.toml index 833583066d..3388ab0ff7 100644 --- a/crates/service/job/w2l_download_job/Cargo.toml +++ b/crates/service/job/w2l_download_job/Cargo.toml @@ -20,7 +20,7 @@ cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } -hashing = { path = "../../../lib/hashing" } +hashing = { path = "../../../lib/files/hashing" } jobs_common = { path = "../../../lib/jobs_common" } mysql_queries = { path = "../../../lib/mysql_queries" } tts_common = { path = "../../../lib/tts_common" } diff --git a/crates/service/web/storyteller_web/Cargo.toml b/crates/service/web/storyteller_web/Cargo.toml index 03d9f05022..6cb88e4316 100644 --- a/crates/service/web/storyteller_web/Cargo.toml +++ b/crates/service/web/storyteller_web/Cargo.toml @@ -25,11 +25,11 @@ datetimes = { path = "../../../lib/datetimes" } enums = { path = "../../../_types/enums" } envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } -files = { path = "../../../lib/files" } +files = { path = "../../../lib/files/files" } google_drive_common = { path = "../../../lib/api_clients/google_drive_common" } http_server_common = { path = "../../../lib/deprecated/http_server_common" } jobs_common = { path = "../../../lib/jobs_common" } -media = { path = "../../../lib/media" } +media = { path = "../../../lib/files/media" } memory_caching = { path = "../../../lib/caching/memory_caching" } mysql_queries = { path = "../../../lib/mysql_queries" } redis_caching = { path = "../../../lib/caching/redis_caching" }