diff --git a/Cargo.toml b/Cargo.toml index 1a75dffd..baba308d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,8 @@ members = [ "data-resource", "fs-atomic-versions", "fs-atomic-light", + "fs-metadata", + "fs-properties", "fs-index", "fs-storage", ] @@ -18,6 +20,9 @@ default-members = [ "data-pdf", "data-resource", "fs-atomic-versions", + "fs-atomic-light", + "fs-metadata", + "fs-properties", "fs-index", "fs-storage", ] diff --git a/README.md b/README.md index 1f6cadbd..9f7b003e 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ The purpose of the library is to manage _resource index_ of folders with various | `data-resource` | Resource hashing and ID construction | | `fs-index` | Resource Index construction and updating | | `fs-storage` | Filesystem storage for resources | +| `fs-metadata` | Metadata management | +| `fs-properties` | Properties management | | `data-link` | Linking resources | | `data-pdf` | PDF handling | | `data-error` | Error handling | diff --git a/data-error/Cargo.toml b/data-error/Cargo.toml index b30cb2a6..63ac295d 100644 --- a/data-error/Cargo.toml +++ b/data-error/Cargo.toml @@ -3,6 +3,11 @@ name = "data-error" version = "0.1.0" edition = "2021" +[lib] +name = "data_error" +crate-type = ["rlib"] +bench = false + [dependencies] thiserror = "1" reqwest = "0.11.11" diff --git a/data-json/Cargo.toml b/data-json/Cargo.toml index b56702df..0bd7f9aa 100644 --- a/data-json/Cargo.toml +++ b/data-json/Cargo.toml @@ -3,6 +3,10 @@ name = "data-json" version = "0.1.0" edition = "2021" +[lib] +name = "data_json" +crate-type = ["rlib"] +bench = false [dependencies] serde_json = "1.0.82" diff --git a/data-link/Cargo.toml b/data-link/Cargo.toml index 10a8c5bc..71c3d960 100644 --- a/data-link/Cargo.toml +++ b/data-link/Cargo.toml @@ -6,11 +6,14 @@ edition = "2021" [lib] name = "data_link" crate-type = ["rlib"] +bench = false [dependencies] fs-atomic-light = { path = "../fs-atomic-light" } fs-atomic-versions = { path = "../fs-atomic-versions" } fs-storage = { path = "../fs-storage" } +fs-metadata = { path = "../fs-metadata" } +fs-properties = { path = "../fs-properties" } data-resource = { path = "../data-resource" } data-error = { path = "../data-error" } diff --git a/data-link/src/lib.rs b/data-link/src/lib.rs index b02391d8..267d0de3 100644 --- a/data-link/src/lib.rs +++ b/data-link/src/lib.rs @@ -1,12 +1,11 @@ use data_error::Result; use data_resource::ResourceId; use fs_atomic_versions::atomic::AtomicFile; -use fs_storage::meta::store_metadata; -use fs_storage::prop::load_raw_properties; -use fs_storage::prop::store_properties; -use fs_storage::{ - ARK_FOLDER, PREVIEWS_STORAGE_FOLDER, PROPERTIES_STORAGE_FOLDER, -}; +use fs_metadata::store_metadata; +use fs_properties::load_raw_properties; +use fs_properties::store_properties; +use fs_properties::PROPERTIES_STORAGE_FOLDER; +use fs_storage::{ARK_FOLDER, PREVIEWS_STORAGE_FOLDER}; use reqwest::header::HeaderValue; use scraper::{Html, Selector}; use serde::{Deserialize, Serialize}; diff --git a/data-pdf/Cargo.toml b/data-pdf/Cargo.toml index a1131e1d..e6f31cd5 100644 --- a/data-pdf/Cargo.toml +++ b/data-pdf/Cargo.toml @@ -6,10 +6,11 @@ edition = "2021" [lib] name = "data_pdf" crate-type = ["rlib"] +bench = false [dependencies] once_cell = "1.16.0" -image = "0.24.2" +image = "=0.25.0" pdfium-render = { git = "https://github.com/ajrcarey/pdfium-render", rev = "d2559c1", features = [ "thread_safe", "sync", diff --git a/fs-atomic-light/Cargo.toml b/fs-atomic-light/Cargo.toml index abb4a81c..5c15bd54 100644 --- a/fs-atomic-light/Cargo.toml +++ b/fs-atomic-light/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [lib] name = "fs_atomic_light" crate-type = ["rlib"] +bench = false [dependencies] data-error = { path = "../data-error" } diff --git a/fs-atomic-versions/Cargo.toml b/fs-atomic-versions/Cargo.toml index d3cab8e5..70372063 100644 --- a/fs-atomic-versions/Cargo.toml +++ b/fs-atomic-versions/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [lib] name = "fs_atomic_versions" crate-type = ["rlib"] +bench = false [dependencies] data-error = { path = "../data-error" } diff --git a/fs-metadata/Cargo.toml b/fs-metadata/Cargo.toml new file mode 100644 index 00000000..89a9e03b --- /dev/null +++ b/fs-metadata/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "fs-metadata" +version = "0.1.0" +edition = "2021" + +[lib] +name = "fs_metadata" +crate-type = ["rlib"] +bench = false + +[dependencies] +data-error = { path = "../data-error" } +fs-atomic-versions = { path = "../fs-atomic-versions" } +data-resource = { path = "../data-resource" } +fs-storage = { path = "../fs-storage" } +serde = { version = "1.0.138", features = ["derive"] } + +[dev-dependencies] +log = { version = "0.4.17", features = ["release_max_level_off"] } +tempdir = "0.3.7" +serde_json = "1.0.82" diff --git a/fs-storage/src/meta.rs b/fs-metadata/src/lib.rs similarity index 96% rename from fs-storage/src/meta.rs rename to fs-metadata/src/lib.rs index 5ada9b72..3118fd4d 100644 --- a/fs-storage/src/meta.rs +++ b/fs-metadata/src/lib.rs @@ -5,8 +5,10 @@ use std::fmt::Debug; use std::io::Read; use std::path::Path; -use crate::{ARK_FOLDER, METADATA_STORAGE_FOLDER}; use data_resource::ResourceId; +use fs_storage::ARK_FOLDER; + +pub const METADATA_STORAGE_FOLDER: &str = "cache/metadata"; pub fn store_metadata< S: Serialize + DeserializeOwned + Clone + Debug, diff --git a/fs-properties/Cargo.toml b/fs-properties/Cargo.toml new file mode 100644 index 00000000..ece81dfa --- /dev/null +++ b/fs-properties/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "fs-properties" +version = "0.1.0" +edition = "2021" + +[lib] +name = "fs_properties" +crate-type = ["rlib"] +bench = false + +[dependencies] +data-error = { path = "../data-error" } +data-json = { path = "../data-json" } +fs-atomic-versions = { path = "../fs-atomic-versions" } +fs-storage = { path = "../fs-storage" } +data-resource = { path = "../data-resource" } + +serde_json = "1.0.82" +serde = { version = "1.0.138", features = ["derive"] } + +[dev-dependencies] +log = { version = "0.4.17", features = ["release_max_level_off"] } +tempdir = "0.3.7" diff --git a/fs-storage/src/prop.rs b/fs-properties/src/lib.rs similarity index 96% rename from fs-storage/src/prop.rs rename to fs-properties/src/lib.rs index e09cd2c9..45a71b9e 100644 --- a/fs-storage/src/prop.rs +++ b/fs-properties/src/lib.rs @@ -7,8 +7,10 @@ use std::fmt::Debug; use std::io::Read; use std::path::Path; -use crate::{ARK_FOLDER, PROPERTIES_STORAGE_FOLDER}; use data_resource::ResourceId; +use fs_storage::ARK_FOLDER; + +pub const PROPERTIES_STORAGE_FOLDER: &str = "user/properties"; pub fn store_properties< S: Serialize + DeserializeOwned + Clone + Debug, diff --git a/fs-storage/Cargo.toml b/fs-storage/Cargo.toml index 146e6c98..09fc9687 100644 --- a/fs-storage/Cargo.toml +++ b/fs-storage/Cargo.toml @@ -3,16 +3,9 @@ name = "fs-storage" version = "0.1.0" edition = "2021" +[lib] +name = "fs_storage" +crate-type = ["rlib"] +bench = false [dependencies] -data-error = { path = "../data-error" } -data-json = { path = "../data-json" } -fs-atomic-versions = { path = "../fs-atomic-versions" } -data-resource = { path = "../data-resource" } - -serde_json = "1.0.82" -serde = { version = "1.0.138", features = ["derive"] } - -[dev-dependencies] -log = { version = "0.4.17", features = ["release_max_level_off"] } -tempdir = "0.3.7" diff --git a/fs-storage/src/lib.rs b/fs-storage/src/lib.rs index 90cb61a5..6e7af127 100644 --- a/fs-storage/src/lib.rs +++ b/fs-storage/src/lib.rs @@ -1,6 +1,3 @@ -pub mod meta; -pub mod prop; - pub const ARK_FOLDER: &str = ".ark"; // Should not be lost if possible @@ -10,10 +7,8 @@ pub const FAVORITES_FILE: &str = "favorites"; // User-defined data pub const TAG_STORAGE_FILE: &str = "user/tags"; pub const SCORE_STORAGE_FILE: &str = "user/scores"; -pub const PROPERTIES_STORAGE_FOLDER: &str = "user/properties"; // Generated data pub const INDEX_PATH: &str = "index"; -pub const METADATA_STORAGE_FOLDER: &str = "cache/metadata"; pub const PREVIEWS_STORAGE_FOLDER: &str = "cache/previews"; pub const THUMBNAILS_STORAGE_FOLDER: &str = "cache/thumbnails";