Skip to content

Commit

Permalink
define a crate fs-properties to manage properties
Browse files Browse the repository at this point in the history
Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser committed Mar 12, 2024
1 parent 8490c03 commit 43ba24d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"fs-atomic-versions",
"fs-atomic-light",
"fs-metadata",
"fs-properties",
"fs-index",
"fs-storage",
]
Expand All @@ -21,6 +22,7 @@ default-members = [
"fs-atomic-versions",
"fs-atomic-light",
"fs-metadata",
"fs-properties",
"fs-index",
"fs-storage",
]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The purpose of the library is to manage _resource index_ of folders with various
| `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 |
Expand Down
1 change: 1 addition & 0 deletions data-link/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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" }

Expand Down
9 changes: 4 additions & 5 deletions data-link/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ use data_error::Result;
use data_resource::ResourceId;
use fs_atomic_versions::atomic::AtomicFile;
use fs_metadata::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_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};
Expand Down
19 changes: 19 additions & 0 deletions fs-properties/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "fs-properties"
version = "0.1.0"
edition = "2021"


[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"
4 changes: 3 additions & 1 deletion fs-storage/src/prop.rs → fs-properties/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 0 additions & 11 deletions fs-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,3 @@ edition = "2021"


[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"
3 changes: 0 additions & 3 deletions fs-storage/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub mod prop;

pub const ARK_FOLDER: &str = ".ark";

// Should not be lost if possible
Expand All @@ -9,7 +7,6 @@ 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";
Expand Down

0 comments on commit 43ba24d

Please sign in to comment.