diff --git a/Cargo.lock b/Cargo.lock index 57a6035..d0a3ebe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -841,6 +841,10 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "did-wk" +version = "0.1.0" + [[package]] name = "digest" version = "0.10.7" @@ -1539,6 +1543,33 @@ dependencies = [ "serde_bytes", ] +[[package]] +name = "ipldstore" +version = "0.2.1" +dependencies = [ + "aliasable", + "anyhow", + "async-stream", + "async-trait", + "bytes", + "futures", + "getset", + "hex", + "ipld-core", + "monoutils", + "multihash", + "multihash-codetable", + "pretty-error-debug", + "rand 0.9.0", + "serde", + "serde_ipld_dagcbor", + "thiserror 2.0.6", + "tokio", + "tokio-util", + "tracing", + "typed-builder", +] + [[package]] name = "ipnet" version = "2.10.1" @@ -1758,11 +1789,11 @@ dependencies = [ "futures", "getset", "hex", + "ipldstore", "ipnetwork", "libc", "monofs", "monoutils", - "monoutils-store", "nix", "oci-spec", "pin-project", @@ -1818,8 +1849,8 @@ dependencies = [ "getset", "hex", "intaglio", + "ipldstore", "monoutils", - "monoutils-store", "nfsserve", "nix", "os_pipe", @@ -1864,41 +1895,6 @@ dependencies = [ name = "monoutils-cryptdag" version = "0.1.0" -[[package]] -name = "monoutils-did" -version = "0.1.0" - -[[package]] -name = "monoutils-store" -version = "0.2.1" -dependencies = [ - "aliasable", - "anyhow", - "async-stream", - "async-trait", - "bytes", - "futures", - "getset", - "hex", - "ipld-core", - "monoutils", - "multihash", - "multihash-codetable", - "pretty-error-debug", - "rand 0.9.0", - "serde", - "serde_ipld_dagcbor", - "thiserror 2.0.6", - "tokio", - "tokio-util", - "tracing", - "typed-builder", -] - -[[package]] -name = "monoutils-ucan" -version = "0.1.0" - [[package]] name = "multibase" version = "0.9.1" diff --git a/Cargo.toml b/Cargo.toml index 50c422c..16b02c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,10 +5,9 @@ members = [ "monofs", "monopacks", "monoutils", - "monoutils-did", - "monoutils-store", - "monoutils-ucan", - "monoutils-cryptdag", + "ipldstore", + "cryptdag", + "did-wk", ] resolver = "2" @@ -49,7 +48,7 @@ rand = "0.9" reqwest = { version = "0.12", features = ["stream", "json"] } reqwest-middleware = "0.3" # Cannot upgrade to 0.4 due to https://github.com/TrueLayer/reqwest-middleware/issues/204 reqwest-retry = "0.6" # Cannot upgrade to 0.7 due to https://github.com/TrueLayer/reqwest-middleware/issues/204 -monoutils-store = { version = "0.2", path = "./monoutils-store" } +ipldstore = { version = "0.2", path = "./ipldstore" } monoutils = { version = "0.2", path = "./monoutils" } monofs = { version = "0.2", path = "./monofs" } multihash = "0.19" diff --git a/monoutils-cryptdag/Cargo.toml b/cryptdag/Cargo.toml similarity index 100% rename from monoutils-cryptdag/Cargo.toml rename to cryptdag/Cargo.toml diff --git a/monoutils-cryptdag/README.md b/cryptdag/README.md similarity index 100% rename from monoutils-cryptdag/README.md rename to cryptdag/README.md diff --git a/monoutils-cryptdag/lib/lib.rs b/cryptdag/lib/lib.rs similarity index 70% rename from monoutils-cryptdag/lib/lib.rs rename to cryptdag/lib/lib.rs index 05ac73a..7cf18eb 100644 --- a/monoutils-cryptdag/lib/lib.rs +++ b/cryptdag/lib/lib.rs @@ -1,4 +1,4 @@ -//! `monoutils-cryptdag` is a key generation library for data structures that can be represented as trees or DAGs. +//! `cryptdag` is a key generation library for data structures that can be represented as trees or DAGs. #![warn(missing_docs)] #![allow(clippy::module_inception)] diff --git a/monoutils-did/Cargo.toml b/did-wk/Cargo.toml similarity index 56% rename from monoutils-did/Cargo.toml rename to did-wk/Cargo.toml index b0140c4..52604f7 100644 --- a/monoutils-did/Cargo.toml +++ b/did-wk/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "monoutils-did" +name = "did-wk" version = "0.1.0" -description = "`monoutils-did` is a library for working with DID-Web-Key and DID-Key decentralized identifiers (DIDs) methods." +description = "`did-wk` is a library for working with DID-Web-Key and DID-Key decentralized identifiers (DIDs) methods." license.workspace = true repository.workspace = true authors.workspace = true diff --git a/monoutils-did/README.md b/did-wk/README.md similarity index 100% rename from monoutils-did/README.md rename to did-wk/README.md diff --git a/monoutils-did/lib/lib.rs b/did-wk/lib/lib.rs similarity index 70% rename from monoutils-did/lib/lib.rs rename to did-wk/lib/lib.rs index 1a4f494..7d8529a 100644 --- a/monoutils-did/lib/lib.rs +++ b/did-wk/lib/lib.rs @@ -1,4 +1,4 @@ -//! `monoutils-did` is a library for working with DID-Web-Key and DID-Key decentralized identifiers (DIDs) methods. +//! `did-wk` is a library for working with DID-Web-Key and DID-Key decentralized identifiers (DIDs) methods. #![warn(missing_docs)] #![allow(clippy::module_inception)] diff --git a/monoutils-store/CHANGELOG.md b/ipldstore/CHANGELOG.md similarity index 100% rename from monoutils-store/CHANGELOG.md rename to ipldstore/CHANGELOG.md diff --git a/monoutils-store/Cargo.toml b/ipldstore/Cargo.toml similarity index 85% rename from monoutils-store/Cargo.toml rename to ipldstore/Cargo.toml index 07d7425..49805c5 100644 --- a/monoutils-store/Cargo.toml +++ b/ipldstore/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "monoutils-store" +name = "ipldstore" version = "0.2.1" -description = "`monoutils-store` is a library for working with IPLD content-addressed stores (CAS)." +description = "`ipldstore` is a library for working with IPLD content-addressed stores (CAS)." license.workspace = true repository.workspace = true authors.workspace = true @@ -9,7 +9,7 @@ edition.workspace = true readme = "README.md" [lib] -name = "monoutils_store" +name = "ipldstore" path = "lib/lib.rs" [dependencies] diff --git a/monoutils-store/README.md b/ipldstore/README.md similarity index 100% rename from monoutils-store/README.md rename to ipldstore/README.md diff --git a/monoutils-store/lib/chunker.rs b/ipldstore/lib/chunker.rs similarity index 100% rename from monoutils-store/lib/chunker.rs rename to ipldstore/lib/chunker.rs diff --git a/monoutils-store/lib/constants.rs b/ipldstore/lib/constants.rs similarity index 100% rename from monoutils-store/lib/constants.rs rename to ipldstore/lib/constants.rs diff --git a/monoutils-store/lib/error.rs b/ipldstore/lib/error.rs similarity index 100% rename from monoutils-store/lib/error.rs rename to ipldstore/lib/error.rs diff --git a/monoutils-store/lib/implementations/chunkers/fastcdc.rs b/ipldstore/lib/implementations/chunkers/fastcdc.rs similarity index 99% rename from monoutils-store/lib/implementations/chunkers/fastcdc.rs rename to ipldstore/lib/implementations/chunkers/fastcdc.rs index b3104f4..298ddfe 100644 --- a/monoutils-store/lib/implementations/chunkers/fastcdc.rs +++ b/ipldstore/lib/implementations/chunkers/fastcdc.rs @@ -581,8 +581,7 @@ mod tests { #[tokio::test] async fn test_fastcdc_chunk_distribution() -> anyhow::Result<()> { - use rand::rngs::StdRng; - use rand::{Rng, SeedableRng}; + use rand::{rngs::StdRng, Rng, SeedableRng}; // Test both random and repeating data to verify our normalization works let test_cases = vec![ diff --git a/monoutils-store/lib/implementations/chunkers/fixed.rs b/ipldstore/lib/implementations/chunkers/fixed.rs similarity index 99% rename from monoutils-store/lib/implementations/chunkers/fixed.rs rename to ipldstore/lib/implementations/chunkers/fixed.rs index 98fd5d3..e62aefc 100644 --- a/monoutils-store/lib/implementations/chunkers/fixed.rs +++ b/ipldstore/lib/implementations/chunkers/fixed.rs @@ -80,7 +80,6 @@ impl Chunker for FixedSizeChunker { Ok(Box::pin(s)) } - async fn chunk_max_size(&self) -> StoreResult> { Ok(Some(self.chunk_size)) } diff --git a/monoutils-store/lib/implementations/chunkers/gearcdc.rs b/ipldstore/lib/implementations/chunkers/gearcdc.rs similarity index 99% rename from monoutils-store/lib/implementations/chunkers/gearcdc.rs rename to ipldstore/lib/implementations/chunkers/gearcdc.rs index 7a56dd4..3c5818c 100644 --- a/monoutils-store/lib/implementations/chunkers/gearcdc.rs +++ b/ipldstore/lib/implementations/chunkers/gearcdc.rs @@ -372,8 +372,7 @@ mod tests { #[tokio::test] async fn test_gearcdc_chunk_distribution() -> anyhow::Result<()> { - use rand::rngs::StdRng; - use rand::{Rng, SeedableRng}; + use rand::{rngs::StdRng, Rng, SeedableRng}; // Test both random and repeating data to verify our high-bit feedback mechanism let test_cases = vec![ diff --git a/monoutils-store/lib/implementations/chunkers/mod.rs b/ipldstore/lib/implementations/chunkers/mod.rs similarity index 100% rename from monoutils-store/lib/implementations/chunkers/mod.rs rename to ipldstore/lib/implementations/chunkers/mod.rs index 1b798d7..1460c80 100644 --- a/monoutils-store/lib/implementations/chunkers/mod.rs +++ b/ipldstore/lib/implementations/chunkers/mod.rs @@ -1,11 +1,11 @@ -mod fixed; mod fastcdc; +mod fixed; mod gearcdc; //-------------------------------------------------------------------------------------------------- // Exports //-------------------------------------------------------------------------------------------------- -pub use fixed::*; pub use fastcdc::*; +pub use fixed::*; pub use gearcdc::*; diff --git a/monoutils-store/lib/implementations/layouts/balanceddag.rs b/ipldstore/lib/implementations/layouts/balanceddag.rs similarity index 100% rename from monoutils-store/lib/implementations/layouts/balanceddag.rs rename to ipldstore/lib/implementations/layouts/balanceddag.rs diff --git a/monoutils-store/lib/implementations/layouts/flat.rs b/ipldstore/lib/implementations/layouts/flat.rs similarity index 100% rename from monoutils-store/lib/implementations/layouts/flat.rs rename to ipldstore/lib/implementations/layouts/flat.rs diff --git a/monoutils-store/lib/implementations/layouts/mod.rs b/ipldstore/lib/implementations/layouts/mod.rs similarity index 100% rename from monoutils-store/lib/implementations/layouts/mod.rs rename to ipldstore/lib/implementations/layouts/mod.rs diff --git a/monoutils-store/lib/implementations/mod.rs b/ipldstore/lib/implementations/mod.rs similarity index 100% rename from monoutils-store/lib/implementations/mod.rs rename to ipldstore/lib/implementations/mod.rs diff --git a/monoutils-store/lib/implementations/stores/dualstore.rs b/ipldstore/lib/implementations/stores/dualstore.rs similarity index 98% rename from monoutils-store/lib/implementations/stores/dualstore.rs rename to ipldstore/lib/implementations/stores/dualstore.rs index b037544..c8084a1 100644 --- a/monoutils-store/lib/implementations/stores/dualstore.rs +++ b/ipldstore/lib/implementations/stores/dualstore.rs @@ -25,7 +25,7 @@ use crate::{Codec, IpldReferences, IpldStore, RawStore, StoreError, StoreResult} /// ## Examples /// /// ``` -/// use monoutils_store::{MemoryStore, DualStore, DualStoreConfig, Choice}; +/// use ipldstore::{MemoryStore, DualStore, DualStoreConfig, Choice}; /// /// // Create two stores /// let store_a = MemoryStore::default(); @@ -64,7 +64,7 @@ where /// ## Examples /// /// ``` -/// use monoutils_store::{DualStoreConfig, Choice}; +/// use ipldstore::{StoreConfig, DualStoreConfig, Choice}; /// /// // Configure to read from store A and write to store B /// let config = DualStoreConfig { @@ -102,7 +102,7 @@ pub enum Choice { /// ## Examples /// /// ``` -/// use monoutils_store::{DualStoreConfig, Choice}; +/// use ipldstore::{StoreConfig, DualStoreConfig, Choice}; /// /// // Default configuration - use store A for both reads and writes /// let default_config = DualStoreConfig::default(); diff --git a/monoutils-store/lib/implementations/stores/memstore.rs b/ipldstore/lib/implementations/stores/memstore.rs similarity index 99% rename from monoutils-store/lib/implementations/stores/memstore.rs rename to ipldstore/lib/implementations/stores/memstore.rs index de47047..5633e2d 100644 --- a/monoutils-store/lib/implementations/stores/memstore.rs +++ b/ipldstore/lib/implementations/stores/memstore.rs @@ -439,8 +439,7 @@ where mod tests { use crate::DEFAULT_MAX_CHUNK_SIZE; - use super::helper::TestNode; - use super::*; + use super::{helper::TestNode, *}; use multihash_codetable::{Code, MultihashDigest}; use tokio::io::AsyncReadExt; diff --git a/monoutils-store/lib/implementations/stores/mod.rs b/ipldstore/lib/implementations/stores/mod.rs similarity index 100% rename from monoutils-store/lib/implementations/stores/mod.rs rename to ipldstore/lib/implementations/stores/mod.rs diff --git a/monoutils-store/lib/layout.rs b/ipldstore/lib/layout.rs similarity index 100% rename from monoutils-store/lib/layout.rs rename to ipldstore/lib/layout.rs diff --git a/monoutils-store/lib/lib.rs b/ipldstore/lib/lib.rs similarity index 92% rename from monoutils-store/lib/lib.rs rename to ipldstore/lib/lib.rs index 4463e2a..c4a18a5 100644 --- a/monoutils-store/lib/lib.rs +++ b/ipldstore/lib/lib.rs @@ -1,4 +1,4 @@ -//! `monoutils-store` is a library for working with IPLD content-addressed stores (CAS). +//! `ipldstore` is a library for working with IPLD content-addressed stores (CAS). #![warn(missing_docs)] #![allow(clippy::module_inception)] diff --git a/monoutils-store/lib/merkle.rs b/ipldstore/lib/merkle.rs similarity index 100% rename from monoutils-store/lib/merkle.rs rename to ipldstore/lib/merkle.rs diff --git a/monoutils-store/lib/references.rs b/ipldstore/lib/references.rs similarity index 100% rename from monoutils-store/lib/references.rs rename to ipldstore/lib/references.rs diff --git a/monoutils-store/lib/storable.rs b/ipldstore/lib/storable.rs similarity index 100% rename from monoutils-store/lib/storable.rs rename to ipldstore/lib/storable.rs diff --git a/monoutils-store/lib/store.rs b/ipldstore/lib/store.rs similarity index 100% rename from monoutils-store/lib/store.rs rename to ipldstore/lib/store.rs diff --git a/monoutils-store/lib/utils.rs b/ipldstore/lib/utils.rs similarity index 100% rename from monoutils-store/lib/utils.rs rename to ipldstore/lib/utils.rs diff --git a/monocore/Cargo.toml b/monocore/Cargo.toml index f6cbccc..b3dda4b 100644 --- a/monocore/Cargo.toml +++ b/monocore/Cargo.toml @@ -77,7 +77,7 @@ ipnetwork = { version = "0.21.0", features = ["serde"] } sqlx.workspace = true monoutils.workspace = true regex.workspace = true -monoutils-store.workspace = true +ipldstore.workspace = true monofs.workspace = true async-recursion.workspace = true diff --git a/monocore/lib/error.rs b/monocore/lib/error.rs index 3532b2b..dd68441 100644 --- a/monocore/lib/error.rs +++ b/monocore/lib/error.rs @@ -1,6 +1,6 @@ use monofs::FsError; use monoutils::MonoutilsError; -use monoutils_store::{ipld, StoreError}; +use ipldstore::{ipld, StoreError}; use nix::errno::Errno; use sqlx::migrate::MigrateError; use std::{ diff --git a/monocore/lib/lib.rs b/monocore/lib/lib.rs index b433b0e..2efd831 100644 --- a/monocore/lib/lib.rs +++ b/monocore/lib/lib.rs @@ -70,10 +70,10 @@ mod error; pub mod cli; pub mod config; pub mod management; +pub mod monoimage; pub mod oci; pub mod runtime; pub mod utils; pub mod vm; -pub mod monoimage; pub use error::*; diff --git a/monocore/lib/management/image.rs b/monocore/lib/management/image.rs index 2ef9bc7..d3dada3 100644 --- a/monocore/lib/management/image.rs +++ b/monocore/lib/management/image.rs @@ -1,16 +1,15 @@ -use crate::management::db::{self, OCI_DB_MIGRATOR}; -use crate::management::rootfs; -use crate::utils::BLOCKS_SUBDIR; -use crate::utils::{env::get_monocore_home_path, path::OCI_DB_FILENAME}; use crate::{ + management::{ + db::{self, OCI_DB_MIGRATOR}, + rootfs, + }, oci::{DockerRegistry, OciRegistryPull, Reference}, + utils::{env::get_monocore_home_path, path::OCI_DB_FILENAME, BLOCKS_SUBDIR}, MonocoreError, MonocoreResult, }; use futures::future; -use monofs::filesystem::Dir; -use monofs::store::FlatFsStore; -use monoutils_store::ipld::cid::Cid; -use monoutils_store::{IpldStore, Storable}; +use ipldstore::{ipld::cid::Cid, IpldStore, Storable}; +use monofs::{filesystem::Dir, store::FlatFsStore}; use sqlx::SqlitePool; use std::path::{Path, PathBuf}; use tempfile::tempdir; diff --git a/monocore/lib/management/rootfs.rs b/monocore/lib/management/rootfs.rs index 13c65cb..1b303ec 100644 --- a/monocore/lib/management/rootfs.rs +++ b/monocore/lib/management/rootfs.rs @@ -1,11 +1,11 @@ use async_recursion::async_recursion; use chrono::{TimeZone, Utc}; +use ipldstore::ipld::ipld::Ipld; +use ipldstore::{ipld::cid::Cid, IpldStore}; use monofs::filesystem::{ Dir, Entity, File, Metadata, SymPathLink, UNIX_ATIME_KEY, UNIX_GID_KEY, UNIX_MODE_KEY, UNIX_MTIME_KEY, UNIX_UID_KEY, }; -use monoutils_store::ipld::ipld::Ipld; -use monoutils_store::{ipld::cid::Cid, IpldStore}; use std::fs; use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::Path; @@ -132,7 +132,7 @@ where /// /// ```ignore /// use monofs::filesystem::Dir; -/// use monoutils_store::MemoryStore; +/// use ipldstore::MemoryStore; /// /// # async fn example() -> Result<(), Box> { /// let store = MemoryStore::default(); @@ -363,7 +363,7 @@ where #[cfg(test)] mod tests { use super::*; - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use helper::*; @@ -526,7 +526,7 @@ mod tests { #[cfg(test)] mod helper { - use monoutils_store::IpldStoreSeekable; + use ipldstore::IpldStoreSeekable; use std::{ops::Deref, os::unix::fs::PermissionsExt}; use tokio::io::AsyncReadExt; diff --git a/monocore/lib/monoimage/registry.rs b/monocore/lib/monoimage/registry.rs index 9d6bc09..c62918d 100644 --- a/monocore/lib/monoimage/registry.rs +++ b/monocore/lib/monoimage/registry.rs @@ -30,10 +30,7 @@ pub struct SandboxesRegistry { impl SandboxesRegistry { /// Creates a new Sandboxes Registry client with the specified store directory and database. - pub fn new( - store_dir: PathBuf, - monoimage_db: Pool, - ) -> Self { + pub fn new(store_dir: PathBuf, monoimage_db: Pool) -> Self { let retry_policy = ExponentialBackoff::builder().build_with_max_retries(3); let client_builder = ClientBuilder::new(Client::new()); let client = client_builder diff --git a/monocore/lib/oci/implementations/docker.rs b/monocore/lib/oci/implementations/docker.rs index b7ea92d..e4d9b43 100644 --- a/monocore/lib/oci/implementations/docker.rs +++ b/monocore/lib/oci/implementations/docker.rs @@ -284,7 +284,8 @@ impl OciRegistryPull for DockerRegistry { } }; - let image_id = management::save_or_update_image(&self.oci_db, &reference, total_size).await?; + let image_id = + management::save_or_update_image(&self.oci_db, &reference, total_size).await?; // Save index let platform = Platform::default(); @@ -335,7 +336,9 @@ impl OciRegistryPull for DockerRegistry { .zip(config.rootfs().diff_ids()) .map(|(layer_desc, diff_id)| async { // Check if layer already exists and is complete in database - if management::layer_complete(&self.oci_db, &layer_desc.digest().to_string()).await? { + if management::layer_complete(&self.oci_db, &layer_desc.digest().to_string()) + .await? + { tracing::info!( "Layer {} already exists and is complete, skipping download", layer_desc.digest() diff --git a/monocore/lib/oci/reference.rs b/monocore/lib/oci/reference.rs index 7e82896..93190f2 100644 --- a/monocore/lib/oci/reference.rs +++ b/monocore/lib/oci/reference.rs @@ -1,13 +1,12 @@ -use crate::config::DEFAULT_OCI_REFERENCE_REPO_NAMESPACE; -use crate::config::DEFAULT_OCI_REFERENCE_TAG; -use crate::error::MonocoreError; -use crate::utils::env::get_oci_registry; -use getset::Getters; -use getset::Setters; +use crate::{ + config::{DEFAULT_OCI_REFERENCE_REPO_NAMESPACE, DEFAULT_OCI_REFERENCE_TAG}, + error::MonocoreError, + utils::env::get_oci_registry, +}; +use getset::{Getters, Setters}; use oci_spec::image::Digest; use regex::Regex; -use std::fmt; -use std::str::FromStr; +use std::{fmt, str::FromStr}; //-------------------------------------------------------------------------------------------------- // Types @@ -269,8 +268,10 @@ fn extract_repository_and_tag(path: &str) -> Result<(String, String), MonocoreEr #[cfg(test)] mod tests { use super::*; - use crate::config::{DEFAULT_OCI_REFERENCE_REPO_NAMESPACE, DEFAULT_OCI_REFERENCE_TAG}; - use crate::utils::env::get_oci_registry; + use crate::{ + config::{DEFAULT_OCI_REFERENCE_REPO_NAMESPACE, DEFAULT_OCI_REFERENCE_TAG}, + utils::env::get_oci_registry, + }; #[test] fn test_reference_valid_reference_with_registry_and_tag() { diff --git a/monocore/lib/runtime/monitor.rs b/monocore/lib/runtime/monitor.rs index b3a4be1..5c2a08e 100644 --- a/monocore/lib/runtime/monitor.rs +++ b/monocore/lib/runtime/monitor.rs @@ -1,15 +1,18 @@ -use std::path::Path; -use std::time::{SystemTime, UNIX_EPOCH}; -use std::{io::Write, path::PathBuf}; +use std::{ + io::Write, + path::{Path, PathBuf}, + time::{SystemTime, UNIX_EPOCH}, +}; use async_trait::async_trait; use monoutils::{MonoutilsError, MonoutilsResult, ProcessMonitor, RotatingLog, LOG_SUFFIX}; use sqlx::{Pool, Sqlite}; -use tokio::io::AsyncReadExt; -use tokio::process::{ChildStderr, ChildStdout}; +use tokio::{ + io::AsyncReadExt, + process::{ChildStderr, ChildStdout}, +}; -use crate::utils::MCRUN_LOG_PREFIX; -use crate::{management, MonocoreResult}; +use crate::{management, utils::MCRUN_LOG_PREFIX, MonocoreResult}; //-------------------------------------------------------------------------------------------------- // Types diff --git a/monofs/Cargo.toml b/monofs/Cargo.toml index b0674a3..05f8464 100644 --- a/monofs/Cargo.toml +++ b/monofs/Cargo.toml @@ -20,7 +20,7 @@ name = "mfsrun" path = "bin/mfsrun.rs" [dependencies] -monoutils-store.workspace = true +ipldstore.workspace = true serde.workspace = true chrono = { workspace = true, features = ["serde"] } getset.workspace = true diff --git a/monofs/README.md b/monofs/README.md index b64de55..4e1ad8e 100644 --- a/monofs/README.md +++ b/monofs/README.md @@ -53,7 +53,7 @@ TODO: Demo of running multiple servers on different paths syncing up with each o ```rust use monofs::filesystem::File; -use monoutils_store::MemoryStore; +use ipldstore::MemoryStore; use tokio::io::{AsyncReadExt, AsyncWriteExt}; #[tokio::main] @@ -90,7 +90,7 @@ async fn main() -> anyhow::Result<()> { ```rust use monofs::filesystem::{Dir, FsResult}; -use monoutils_store::MemoryStore; +use ipldstore::MemoryStore; #[tokio::main] async fn main() -> FsResult<()> { diff --git a/monofs/examples/dir.rs b/monofs/examples/dir.rs index acb107d..1fad444 100644 --- a/monofs/examples/dir.rs +++ b/monofs/examples/dir.rs @@ -22,8 +22,8 @@ //! cargo run --example dir //! ``` +use ipldstore::MemoryStore; use monofs::filesystem::{Dir, File}; -use monoutils_store::MemoryStore; //-------------------------------------------------------------------------------------------------- // Functions: main diff --git a/monofs/examples/file.rs b/monofs/examples/file.rs index 6e1fc86..aadf9fa 100644 --- a/monofs/examples/file.rs +++ b/monofs/examples/file.rs @@ -22,7 +22,7 @@ //! ``` use monofs::filesystem::File; -use monoutils_store::{MemoryStore, Storable}; +use ipldstore::{MemoryStore, Storable}; use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader}; //-------------------------------------------------------------------------------------------------- diff --git a/monofs/examples/flatfs_monofs.rs b/monofs/examples/flatfs_monofs.rs index ae26a8d..b2dc851 100644 --- a/monofs/examples/flatfs_monofs.rs +++ b/monofs/examples/flatfs_monofs.rs @@ -21,12 +21,12 @@ use anyhow::Result; use clap::Parser; +use ipldstore::{ipld::cid::Cid, IpldStore, Storable}; use monofs::{ filesystem::{Dir, Entity, File}, store::FlatFsStore, utils, }; -use monoutils_store::{ipld::cid::Cid, IpldStore, Storable}; use tokio::io::AsyncWriteExt; //-------------------------------------------------------------------------------------------------- diff --git a/monofs/examples/flatfs_store.rs b/monofs/examples/flatfs_store.rs index d62fac2..654d3b5 100644 --- a/monofs/examples/flatfs_store.rs +++ b/monofs/examples/flatfs_store.rs @@ -21,9 +21,8 @@ use anyhow::Result; use clap::Parser; +use ipldstore::{ipld::cid::Cid, IpldReferences, IpldStore}; use monofs::store::FlatFsStore; -use monoutils_store::ipld::cid::Cid; -use monoutils_store::{IpldReferences, IpldStore}; use serde::{Deserialize, Serialize}; use serde_json; use std::{collections::BTreeMap, path::PathBuf, sync::LazyLock}; diff --git a/monofs/lib/error.rs b/monofs/lib/error.rs index 50f9ec1..171bbe5 100644 --- a/monofs/lib/error.rs +++ b/monofs/lib/error.rs @@ -1,8 +1,11 @@ use std::{ - convert::Infallible, error::Error, fmt::{self, Display}, io + convert::Infallible, + error::Error, + fmt::{self, Display}, + io, }; -use monoutils_store::ipld::cid::Cid; +use ipldstore::ipld::cid::Cid; use thiserror::Error; use crate::filesystem::Utf8UnixPathSegment; @@ -51,7 +54,7 @@ pub enum FsError { // Did(#[from] monoutils_did_wk::DidError), /// IPLD Store error. #[error("IPLD Store error: {0}")] - IpldStore(#[from] monoutils_store::StoreError), + IpldStore(#[from] ipldstore::StoreError), /// Invalid deserialized OpenFlag value #[error("Invalid OpenFlag value: {0}")] @@ -87,7 +90,7 @@ pub enum FsError { /// CID error. #[error("CID error: {0}")] - CidError(#[from] monoutils_store::ipld::cid::Error), + CidError(#[from] ipldstore::ipld::cid::Error), /// Path has root. #[error("Path has root: {0}")] diff --git a/monofs/lib/filesystem/cidlink.rs b/monofs/lib/filesystem/cidlink.rs index 515ebec..6709867 100644 --- a/monofs/lib/filesystem/cidlink.rs +++ b/monofs/lib/filesystem/cidlink.rs @@ -8,7 +8,7 @@ use std::{ use async_once_cell::OnceCell; -use monoutils_store::{ipld::cid::Cid, IpldStore, Storable}; +use ipldstore::{ipld::cid::Cid, IpldStore, Storable}; use crate::{FsError, FsResult}; diff --git a/monofs/lib/filesystem/cidlink/attributes.rs b/monofs/lib/filesystem/cidlink/attributes.rs index e73a63c..b851fb7 100644 --- a/monofs/lib/filesystem/cidlink/attributes.rs +++ b/monofs/lib/filesystem/cidlink/attributes.rs @@ -1,6 +1,9 @@ -use monoutils_store::IpldStore; +use ipldstore::IpldStore; -use crate::{filesystem::{CidLink, ExtendedAttributes}, FsResult}; +use crate::{ + filesystem::{CidLink, ExtendedAttributes}, + FsResult, +}; //-------------------------------------------------------------------------------------------------- // Types diff --git a/monofs/lib/filesystem/cidlink/entity.rs b/monofs/lib/filesystem/cidlink/entity.rs index fa101e9..8c37e95 100644 --- a/monofs/lib/filesystem/cidlink/entity.rs +++ b/monofs/lib/filesystem/cidlink/entity.rs @@ -1,8 +1,11 @@ -use monoutils_store::IpldStore; +use ipldstore::IpldStore; -use crate::{filesystem::{ - dir::Dir, entity::Entity, file::File, symcidlink::SymCidLink, CidLink, SymPathLink, -}, FsResult}; +use crate::{ + filesystem::{ + dir::Dir, entity::Entity, file::File, symcidlink::SymCidLink, CidLink, SymPathLink, + }, + FsResult, +}; //-------------------------------------------------------------------------------------------------- // Types diff --git a/monofs/lib/filesystem/dir.rs b/monofs/lib/filesystem/dir.rs index 7061ab6..83ea386 100644 --- a/monofs/lib/filesystem/dir.rs +++ b/monofs/lib/filesystem/dir.rs @@ -10,9 +10,7 @@ use std::{ }; use chrono::Utc; -use monoutils_store::{ - ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult, -}; +use ipldstore::{ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult}; use serde::{Deserialize, Serialize}; use crate::{ @@ -118,7 +116,7 @@ where /// /// ``` /// use monofs::filesystem::Dir; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// let dir = Dir::new(MemoryStore::default()); /// assert!(dir.is_empty()); @@ -143,7 +141,7 @@ where /// /// ``` /// use monofs::filesystem::Dir; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -170,7 +168,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -202,7 +200,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -258,7 +256,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -286,7 +284,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -315,7 +313,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -341,7 +339,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -367,7 +365,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -403,7 +401,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -431,7 +429,7 @@ where /// /// ``` /// use monofs::filesystem::Dir; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// let dir = Dir::new(MemoryStore::default()); /// assert!(dir.is_empty()); @@ -447,7 +445,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -472,7 +470,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -500,7 +498,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -540,7 +538,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, File}; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -978,7 +976,7 @@ impl IpldReferences for DirSerializable { #[cfg(test)] mod tests { use anyhow::Ok; - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use crate::filesystem::SyncType; diff --git a/monofs/lib/filesystem/dir/find.rs b/monofs/lib/filesystem/dir/find.rs index b6cbea9..0e27855 100644 --- a/monofs/lib/filesystem/dir/find.rs +++ b/monofs/lib/filesystem/dir/find.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use monoutils_store::IpldStore; +use ipldstore::IpldStore; use typed_path::{Utf8UnixComponent, Utf8UnixPath}; use crate::{filesystem::entity::Entity, FsError, FsResult}; @@ -213,14 +213,14 @@ where #[cfg(test)] mod tests { - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use crate::filesystem::File; use super::*; mod fixtures { - use monoutils_store::Storable; + use ipldstore::Storable; use super::*; diff --git a/monofs/lib/filesystem/dir/ops.rs b/monofs/lib/filesystem/dir/ops.rs index a6e4d64..b6fdc23 100644 --- a/monofs/lib/filesystem/dir/ops.rs +++ b/monofs/lib/filesystem/dir/ops.rs @@ -1,4 +1,4 @@ -use monoutils_store::{ipld::cid::Cid, IpldStore}; +use ipldstore::{ipld::cid::Cid, IpldStore}; use typed_path::Utf8UnixPath; use crate::{ @@ -27,7 +27,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -70,7 +70,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -119,7 +119,7 @@ where /// Creating nested directories: /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -135,7 +135,7 @@ where /// Creating a file in a nested path: /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -150,7 +150,7 @@ where /// Finding existing entities: /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -324,7 +324,7 @@ where /// /// ``` /// use monofs::filesystem::Dir; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -354,7 +354,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -429,7 +429,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -476,7 +476,7 @@ where /// /// ``` /// use monofs::filesystem::{Dir, Entity}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -579,7 +579,7 @@ where #[cfg(test)] mod tests { - use monoutils_store::{ipld::cid::Cid, MemoryStore, Storable}; + use ipldstore::{ipld::cid::Cid, MemoryStore, Storable}; use tokio::io::AsyncReadExt; use crate::filesystem::{symcidlink::SymCidLink, sympathlink::SymPathLink, Dir, Entity, File}; diff --git a/monofs/lib/filesystem/entity.rs b/monofs/lib/filesystem/entity.rs index 6eb5496..e269f82 100644 --- a/monofs/lib/filesystem/entity.rs +++ b/monofs/lib/filesystem/entity.rs @@ -1,9 +1,12 @@ use std::fmt::{self, Debug}; -use monoutils_store::{ipld::cid::Cid, IpldStore, Storable, StoreError, StoreResult}; +use ipldstore::{ipld::cid::Cid, IpldStore, Storable, StoreError, StoreResult}; use serde::Deserialize; -use crate::{filesystem::{self, Dir, File, Metadata, SymCidLink, SymPathLink}, FsError, FsResult}; +use crate::{ + filesystem::{self, Dir, File, Metadata, SymCidLink, SymPathLink}, + FsError, FsResult, +}; //-------------------------------------------------------------------------------------------------- // Types @@ -163,7 +166,7 @@ where /// /// ``` /// use monofs::filesystem::{Entity, File}; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { diff --git a/monofs/lib/filesystem/file.rs b/monofs/lib/filesystem/file.rs index 52c3d2f..140f203 100644 --- a/monofs/lib/filesystem/file.rs +++ b/monofs/lib/filesystem/file.rs @@ -6,9 +6,7 @@ use std::{ }; use chrono::Utc; -use monoutils_store::{ - ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult, -}; +use ipldstore::{ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult}; use serde::{Deserialize, Serialize}; use tokio::io::AsyncRead; @@ -99,7 +97,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -128,7 +126,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -162,8 +160,8 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -194,8 +192,8 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -224,7 +222,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -245,7 +243,7 @@ where /// /// ``` /// use monofs::filesystem::{File, EntityType}; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// let store = MemoryStore::default(); /// let file = File::new(store); @@ -268,7 +266,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::{MemoryStore, IpldStore}; + /// use ipldstore::{MemoryStore, IpldStore}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -292,7 +290,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -323,7 +321,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -348,7 +346,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -370,7 +368,7 @@ where /// /// ``` /// use monofs::filesystem::File; - /// use monoutils_store::{MemoryStore, ipld::cid::Cid}; + /// use ipldstore::{MemoryStore, ipld::cid::Cid}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -483,7 +481,7 @@ impl IpldReferences for FileSerializable { #[cfg(test)] mod tests { - use monoutils_store::{MemoryStore, Storable}; + use ipldstore::{MemoryStore, Storable}; use tokio::io::AsyncReadExt; use super::*; diff --git a/monofs/lib/filesystem/file/io.rs b/monofs/lib/filesystem/file/io.rs index 35755f2..8f887cb 100644 --- a/monofs/lib/filesystem/file/io.rs +++ b/monofs/lib/filesystem/file/io.rs @@ -7,8 +7,8 @@ use std::{ use bytes::Bytes; use chrono::Utc; use futures::{future::BoxFuture, FutureExt}; +use ipldstore::{ipld::cid::Cid, IpldStore, IpldStoreSeekable}; use monoutils::{EmptySeekableReader, SeekableReader}; -use monoutils_store::{ipld::cid::Cid, IpldStore, IpldStoreSeekable}; use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite, ReadBuf}; use crate::filesystem::File; @@ -191,7 +191,7 @@ where #[cfg(test)] mod tests { use anyhow::Result; - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, BufReader}; use crate::filesystem::File; diff --git a/monofs/lib/filesystem/metadata.rs b/monofs/lib/filesystem/metadata.rs index 37d7c67..37a3103 100644 --- a/monofs/lib/filesystem/metadata.rs +++ b/monofs/lib/filesystem/metadata.rs @@ -1,11 +1,13 @@ -use std::collections::BTreeMap; -use std::fmt::{self, Debug}; -use std::iter; -use std::sync::Arc; +use std::{ + collections::BTreeMap, + fmt::{self, Debug}, + iter, + sync::Arc, +}; use chrono::{DateTime, Utc}; use getset::Getters; -use monoutils_store::{ +use ipldstore::{ ipld::{cid::Cid, ipld::Ipld}, IpldReferences, IpldStore, Storable, StoreError, StoreResult, }; @@ -50,7 +52,7 @@ pub const UNIX_MTIME_KEY: &str = "unix.mtime"; /// ``` /// use monofs::filesystem::{EntityType, Metadata, SyncType}; /// use monofs::config::DEFAULT_SYMLINK_DEPTH; -/// use monoutils_store::MemoryStore; +/// use ipldstore::MemoryStore; /// /// let store = MemoryStore::default(); /// let metadata = Metadata::new(EntityType::File, store); @@ -114,8 +116,8 @@ pub enum SyncType { /// /// ``` /// use monofs::filesystem::{EntityType, Metadata}; -/// use monoutils_store::MemoryStore; -/// use monoutils_store::ipld::ipld::Ipld; +/// use ipldstore::MemoryStore; +/// use ipldstore::ipld::ipld::Ipld; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -224,8 +226,8 @@ where /// /// ``` /// use monofs::filesystem::{EntityType, Metadata}; - /// use monoutils_store::MemoryStore; - /// use monoutils_store::ipld::ipld::Ipld; + /// use ipldstore::MemoryStore; + /// use ipldstore::ipld::ipld::Ipld; /// use std::sync::Arc; /// /// # #[tokio::main] @@ -267,8 +269,8 @@ where /// /// ``` /// use monofs::filesystem::{EntityType, Metadata}; - /// use monoutils_store::MemoryStore; - /// use monoutils_store::ipld::ipld::Ipld; + /// use ipldstore::MemoryStore; + /// use ipldstore::ipld::ipld::Ipld; /// use std::sync::Arc; /// /// # #[tokio::main] @@ -441,7 +443,7 @@ where #[cfg(test)] mod tests { - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use super::*; diff --git a/monofs/lib/filesystem/symcidlink.rs b/monofs/lib/filesystem/symcidlink.rs index 337bc82..0382004 100644 --- a/monofs/lib/filesystem/symcidlink.rs +++ b/monofs/lib/filesystem/symcidlink.rs @@ -7,13 +7,13 @@ use std::{ use async_recursion::async_recursion; use chrono::Utc; -use monoutils_store::{ - ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult, -}; +use ipldstore::{ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult}; use serde::{Deserialize, Serialize}; use crate::{ - config::DEFAULT_SYMLINK_DEPTH, filesystem::{CidLink, Dir, EntityCidLink, File, Metadata}, FsError, FsResult + config::DEFAULT_SYMLINK_DEPTH, + filesystem::{CidLink, Dir, EntityCidLink, File, Metadata}, + FsError, FsResult, }; use super::{entity::Entity, kind::EntityType, MetadataSerializable}; @@ -132,8 +132,8 @@ where /// /// ``` /// use monofs::filesystem::SymCidLink; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -165,8 +165,8 @@ where /// /// ``` /// use monofs::filesystem::SymCidLink; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -226,8 +226,8 @@ where /// /// ``` /// use monofs::filesystem::SymCidLink; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -346,8 +346,8 @@ where /// /// ``` /// use monofs::filesystem::{SymCidLink, Dir, File, Entity, CidFollowResult}; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -429,8 +429,8 @@ where /// filesystem::{SymCidLink, Dir, File, Entity}, /// FsError, /// }; - /// use monoutils_store::{MemoryStore, Storable}; - /// use monoutils_store::ipld::cid::Cid; + /// use ipldstore::{MemoryStore, Storable}; + /// use ipldstore::ipld::cid::Cid; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -576,7 +576,7 @@ mod tests { config::DEFAULT_SYMLINK_DEPTH, filesystem::{Dir, Entity, File}, }; - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; mod fixtures { use super::*; diff --git a/monofs/lib/filesystem/sympathlink.rs b/monofs/lib/filesystem/sympathlink.rs index c5f91a4..d4ee2ee 100644 --- a/monofs/lib/filesystem/sympathlink.rs +++ b/monofs/lib/filesystem/sympathlink.rs @@ -7,13 +7,14 @@ use std::{ }; use chrono::Utc; -use monoutils_store::{ - ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult, -}; +use ipldstore::{ipld::cid::Cid, IpldReferences, IpldStore, Storable, StoreError, StoreResult}; use serde::{Deserialize, Serialize}; use typed_path::Utf8UnixPathBuf; -use crate::{filesystem::{Metadata, MetadataSerializable}, FsResult}; +use crate::{ + filesystem::{Metadata, MetadataSerializable}, + FsResult, +}; use super::kind::EntityType; @@ -144,7 +145,7 @@ where /// /// ``` /// use monofs::filesystem::SymPathLink; - /// use monoutils_store::{MemoryStore, Storable}; + /// use ipldstore::{MemoryStore, Storable}; /// /// # #[tokio::main] /// # async fn main() -> Result<(), Box> { @@ -266,7 +267,7 @@ impl IpldReferences for SymPathLinkSerializable { #[cfg(test)] mod tests { use super::*; - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; #[tokio::test] async fn test_sympathlink_creation() -> FsResult<()> { diff --git a/monofs/lib/management/mfs.rs b/monofs/lib/management/mfs.rs index acde965..bc4ee42 100644 --- a/monofs/lib/management/mfs.rs +++ b/monofs/lib/management/mfs.rs @@ -1,23 +1,19 @@ -use crate::config::DEFAULT_MFSRUN_BIN_PATH; -use crate::management::db; -use crate::management::find; -use crate::management::FS_DB_MIGRATOR; -use crate::utils::path::{BLOCKS_SUBDIR, FS_DB_FILENAME, LOG_SUBDIR, MFS_LINK_FILENAME}; -use crate::utils::MFSRUN_BIN_PATH_ENV_VAR; -use crate::FsError; use crate::{ - config::{DEFAULT_HOST, DEFAULT_NFS_PORT}, - utils::path::MFS_DIR_SUFFIX, - FsResult, + config::{DEFAULT_HOST, DEFAULT_MFSRUN_BIN_PATH, DEFAULT_NFS_PORT}, + management::{db, find, FS_DB_MIGRATOR}, + utils::{ + path::{BLOCKS_SUBDIR, FS_DB_FILENAME, LOG_SUBDIR, MFS_DIR_SUFFIX, MFS_LINK_FILENAME}, + MFSRUN_BIN_PATH_ENV_VAR, + }, + FsError, FsResult, +}; +use nix::{ + sys::signal::{self, Signal}, + unistd::Pid, }; -use nix::sys::signal::{self, Signal}; -use nix::unistd::Pid; use sqlx::Row; use std::path::{Path, PathBuf}; -use tokio::net::TcpStream; -use tokio::time; -use tokio::time::Instant; -use tokio::{fs, process::Command}; +use tokio::{fs, net::TcpStream, process::Command, time, time::Instant}; //-------------------------------------------------------------------------------------------------- // Functions diff --git a/monofs/lib/runtime/monitor.rs b/monofs/lib/runtime/monitor.rs index 39ae5c6..94144eb 100644 --- a/monofs/lib/runtime/monitor.rs +++ b/monofs/lib/runtime/monitor.rs @@ -1,15 +1,18 @@ -use std::io::Write; -use std::path::{Path, PathBuf}; -use std::time::{SystemTime, UNIX_EPOCH}; +use std::{ + io::Write, + path::{Path, PathBuf}, + time::{SystemTime, UNIX_EPOCH}, +}; use async_trait::async_trait; use monoutils::{MonoutilsError, MonoutilsResult, ProcessMonitor, RotatingLog, LOG_SUFFIX}; use sqlx::{Pool, Sqlite}; -use tokio::io::AsyncReadExt; -use tokio::process::{ChildStderr, ChildStdout}; +use tokio::{ + io::AsyncReadExt, + process::{ChildStderr, ChildStdout}, +}; -use crate::utils::MFSRUN_LOG_PREFIX; -use crate::{management, FsResult}; +use crate::{management, utils::MFSRUN_LOG_PREFIX, FsResult}; //-------------------------------------------------------------------------------------------------- // Types diff --git a/monofs/lib/server/nfs.rs b/monofs/lib/server/nfs.rs index 1e1d62c..df0f546 100644 --- a/monofs/lib/server/nfs.rs +++ b/monofs/lib/server/nfs.rs @@ -1,27 +1,34 @@ -use std::collections::HashMap; -use std::str; -use std::sync::atomic::{AtomicU64, Ordering}; -use std::sync::Arc; +use std::{ + collections::HashMap, + str, + sync::{ + atomic::{AtomicU64, Ordering}, + Arc, + }, +}; use async_trait::async_trait; use chrono::{TimeZone, Utc}; use getset::Getters; use intaglio::{Symbol, SymbolTable}; -use monoutils_store::ipld::ipld::Ipld; -use monoutils_store::{IpldStore, IpldStoreSeekable, MemoryStore, Storable}; -use nfsserve::nfs::{ - fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, nfstime3, sattr3, set_atime, set_gid3, - set_mode3, set_mtime, set_size3, set_uid3, specdata3, +use ipldstore::{ipld::ipld::Ipld, IpldStore, IpldStoreSeekable, MemoryStore, Storable}; +use nfsserve::{ + nfs::{ + fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, nfstime3, sattr3, set_atime, + set_gid3, set_mode3, set_mtime, set_size3, set_uid3, specdata3, + }, + vfs::{DirEntry, NFSFileSystem, ReadDirResult, VFSCapabilities}, }; -use nfsserve::vfs::{DirEntry, NFSFileSystem, ReadDirResult, VFSCapabilities}; use tokio::sync::Mutex; -use crate::filesystem::{ - Dir, Entity, EntityType, File, Metadata, SymPathLink, UNIX_ATIME_KEY, UNIX_GID_KEY, - UNIX_MODE_KEY, UNIX_UID_KEY, +use crate::{ + filesystem::{ + Dir, Entity, EntityType, File, Metadata, SymPathLink, UNIX_ATIME_KEY, UNIX_GID_KEY, + UNIX_MODE_KEY, UNIX_UID_KEY, + }, + store::FlatFsStore, + FsError, }; -use crate::store::FlatFsStore; -use crate::FsError; //-------------------------------------------------------------------------------------------------- // Constants @@ -80,7 +87,7 @@ pub type DiskMonofsNFS = MonofsNFS; /// /// ```no_run /// use monofs::server::{MemoryMonofsNFS, MonofsNFS}; -/// use monoutils_store::MemoryStore; +/// use ipldstore::MemoryStore; /// /// // Create an in-memory server for testing /// let memory_server = MemoryMonofsNFS::new(MemoryStore::default()); @@ -113,7 +120,7 @@ where /// ## Example /// ```rust /// use monofs::server::MemoryMonofsNFS; - /// use monoutils_store::MemoryStore; + /// use ipldstore::MemoryStore; /// /// let server = MemoryMonofsNFS::new(MemoryStore::default()); /// ``` diff --git a/monofs/lib/store/flatfsstore.rs b/monofs/lib/store/flatfsstore.rs index 0a3c501..47edd95 100644 --- a/monofs/lib/store/flatfsstore.rs +++ b/monofs/lib/store/flatfsstore.rs @@ -1,22 +1,22 @@ -use std::sync::Arc; -use std::{collections::HashSet, path::PathBuf, pin::Pin}; +use std::{collections::HashSet, path::PathBuf, pin::Pin, sync::Arc}; use async_trait::async_trait; use bytes::Bytes; use futures::StreamExt; use getset::Getters; -use monoutils::SeekableReader; -use monoutils_store::ipld::codec::Links; -use monoutils_store::{ipld::cid::Cid, FastCDCChunker, FixedSizeChunker}; -use monoutils_store::{ - Chunker, Codec, FlatLayout, IpldReferences, IpldStore, IpldStoreSeekable, Layout, - LayoutSeekable, RawStore, StoreError, StoreResult, DEFAULT_MAX_NODE_BLOCK_SIZE, +use ipldstore::{ + ipld::{cid::Cid, codec::Links}, + Chunker, Codec, FastCDCChunker, FixedSizeChunker, FlatLayout, IpldReferences, IpldStore, + IpldStoreSeekable, Layout, LayoutSeekable, RawStore, StoreError, StoreResult, + DEFAULT_MAX_NODE_BLOCK_SIZE, }; +use monoutils::SeekableReader; use serde::{de::DeserializeOwned, Serialize}; use serde_ipld_dagcbor::codec::DagCborCodec; -use tokio::fs::{self, File}; -use tokio::io::AsyncRead; -use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom}; +use tokio::{ + fs::{self, File}, + io::{AsyncRead, AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom}, +}; use typed_builder::TypedBuilder; //-------------------------------------------------------------------------------------------------- @@ -340,7 +340,7 @@ where } // Create CID and store the block - let cid = monoutils_store::generate_cid(Codec::DagCbor, &bytes); + let cid = ipldstore::generate_cid(Codec::DagCbor, &bytes); let block_path = self.get_block_path(&cid); if !block_path.exists() { @@ -615,7 +615,7 @@ where } } - let cid = monoutils_store::generate_cid(Codec::Raw, bytes.as_ref()); + let cid = ipldstore::generate_cid(Codec::Raw, bytes.as_ref()); let block_path = self.get_block_path(&cid); if !block_path.exists() { @@ -667,13 +667,17 @@ where #[cfg(test)] mod tests { - use monoutils_store::codetable::{Code, MultihashDigest}; - use monoutils_store::{DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_NODE_BLOCK_SIZE}; + use ipldstore::{ + codetable::{Code, MultihashDigest}, + DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_NODE_BLOCK_SIZE, + }; use tempfile::TempDir; use tokio::fs; - use super::fixtures::{self, TestNode}; - use super::*; + use super::{ + fixtures::{self, TestNode}, + *, + }; #[tokio::test] async fn test_flatfsstore_raw_block() -> anyhow::Result<()> { diff --git a/monofs/lib/store/layeredfsstore.rs b/monofs/lib/store/layeredfsstore.rs index 6ac3ad7..444c4f9 100644 --- a/monofs/lib/store/layeredfsstore.rs +++ b/monofs/lib/store/layeredfsstore.rs @@ -2,7 +2,7 @@ use std::{collections::HashSet, path::PathBuf, pin::Pin}; use async_trait::async_trait; use bytes::Bytes; -use monoutils_store::{ +use ipldstore::{ ipld::cid::Cid, Codec, DualStore, DualStoreConfig, IpldReferences, IpldStore, RawStore, StoreResult, }; @@ -29,7 +29,7 @@ use super::FlatFsStore; /// 2. If not found, falls back to checking the base layer /// 3. Returns the data from whichever layer it was found in first /// - /// ## Write Behavior +/// ## Write Behavior /// - All writes are directed exclusively to the write layer /// - The base layer remains completely immutable /// - Reference counting is only enabled in the write layer diff --git a/monofs/lib/store/membufferstore.rs b/monofs/lib/store/membufferstore.rs index e782d2e..8ce6737 100644 --- a/monofs/lib/store/membufferstore.rs +++ b/monofs/lib/store/membufferstore.rs @@ -2,7 +2,7 @@ use std::{collections::HashSet, pin::Pin}; use async_trait::async_trait; use bytes::Bytes; -use monoutils_store::{ +use ipldstore::{ ipld::{cid::Cid, ipld::Ipld}, Codec, DualStore, DualStoreConfig, IpldReferences, IpldStore, MemoryStore, RawStore, StoreError, StoreResult, @@ -235,7 +235,7 @@ where #[cfg(test)] mod tests { use super::*; - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use super::helper::TestNode; diff --git a/monofs/lib/store/mod.rs b/monofs/lib/store/mod.rs index 85f9a94..1b4107d 100644 --- a/monofs/lib/store/mod.rs +++ b/monofs/lib/store/mod.rs @@ -1,14 +1,13 @@ //! Stores for the filesystem. mod flatfsstore; -mod membufferstore; mod layeredfsstore; +mod membufferstore; //-------------------------------------------------------------------------------------------------- // Exports //-------------------------------------------------------------------------------------------------- pub use flatfsstore::*; -pub use membufferstore::*; pub use layeredfsstore::*; - +pub use membufferstore::*; diff --git a/monofs/lib/utils/dir.rs b/monofs/lib/utils/dir.rs index 06f48af..875802f 100644 --- a/monofs/lib/utils/dir.rs +++ b/monofs/lib/utils/dir.rs @@ -4,7 +4,7 @@ //! including functions for displaying directory structures in a tree-like format. use async_recursion::async_recursion; -use monoutils_store::IpldStore; +use ipldstore::IpldStore; use crate::{filesystem::Dir, FsResult}; @@ -44,7 +44,7 @@ const LEAF: &str = "└──"; /// /// ``` /// use monofs::{filesystem::Dir, utils}; -/// use monoutils_store::MemoryStore; +/// use ipldstore::MemoryStore; /// /// # #[tokio::main] /// # async fn main() -> anyhow::Result<()> { @@ -163,7 +163,7 @@ fn build_prefix(parts: &[bool]) -> String { #[cfg(test)] mod tests { - use monoutils_store::MemoryStore; + use ipldstore::MemoryStore; use tokio::io::AsyncWriteExt; use crate::filesystem::File; diff --git a/monoutils-ucan/Cargo.toml b/monoutils-ucan/Cargo.toml deleted file mode 100644 index e1d431b..0000000 --- a/monoutils-ucan/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "monoutils-ucan" -version = "0.1.0" -description = "`monoutils-ucan` is a library for capabilities-based security using User Controlled Authorization Networks (UCANs)." -license.workspace = true -repository.workspace = true -authors.workspace = true -edition.workspace = true - -[lib] -name = "monoutils_ucan" -path = "lib/lib.rs" - -[dependencies] diff --git a/monoutils-ucan/README.md b/monoutils-ucan/README.md deleted file mode 100644 index e59bf8b..0000000 --- a/monoutils-ucan/README.md +++ /dev/null @@ -1 +0,0 @@ -# monoutils-ucan diff --git a/monoutils-ucan/lib/lib.rs b/monoutils-ucan/lib/lib.rs deleted file mode 100644 index 3da97e5..0000000 --- a/monoutils-ucan/lib/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! `monoutils-ucan` is a library for capabilities-based security using User Controlled Authorization Networks (UCANs). - -#![warn(missing_docs)] -#![allow(clippy::module_inception)] - -//-------------------------------------------------------------------------------------------------- -// Exports -//-------------------------------------------------------------------------------------------------- diff --git a/monoutils/lib/error.rs b/monoutils/lib/error.rs index 448ea11..b1e453a 100644 --- a/monoutils/lib/error.rs +++ b/monoutils/lib/error.rs @@ -1,7 +1,9 @@ //! `monoutils::error` is a module containing error utilities for the monocore project. -use std::error::Error; -use std::fmt::{self, Display}; +use std::{ + error::Error, + fmt::{self, Display}, +}; use thiserror::Error; diff --git a/monoutils/lib/lib.rs b/monoutils/lib/lib.rs index fd9613b..66f93b4 100644 --- a/monoutils/lib/lib.rs +++ b/monoutils/lib/lib.rs @@ -7,8 +7,8 @@ pub mod config; pub mod error; pub mod log; pub mod path; -pub mod seekable; pub mod runtime; +pub mod seekable; //-------------------------------------------------------------------------------------------------- // Exports @@ -18,5 +18,5 @@ pub use config::*; pub use error::*; pub use log::*; pub use path::*; -pub use seekable::*; pub use runtime::*; +pub use seekable::*; diff --git a/monoutils/lib/runtime/mod.rs b/monoutils/lib/runtime/mod.rs index 6b51085..292f203 100644 --- a/monoutils/lib/runtime/mod.rs +++ b/monoutils/lib/runtime/mod.rs @@ -1,11 +1,11 @@ //! `monoutils::runtime` is a module containing runtime utilities for the monocore project. -mod supervisor; mod monitor; +mod supervisor; //-------------------------------------------------------------------------------------------------- // Exports //-------------------------------------------------------------------------------------------------- -pub use supervisor::*; pub use monitor::*; +pub use supervisor::*; diff --git a/monoutils/lib/runtime/monitor.rs b/monoutils/lib/runtime/monitor.rs index 965c662..8657562 100644 --- a/monoutils/lib/runtime/monitor.rs +++ b/monoutils/lib/runtime/monitor.rs @@ -1,6 +1,5 @@ use async_trait::async_trait; -use tokio::process::ChildStderr; -use tokio::process::ChildStdout; +use tokio::process::{ChildStderr, ChildStdout}; use crate::MonoutilsResult; diff --git a/monoutils/lib/runtime/supervisor.rs b/monoutils/lib/runtime/supervisor.rs index 8558242..947376c 100644 --- a/monoutils/lib/runtime/supervisor.rs +++ b/monoutils/lib/runtime/supervisor.rs @@ -1,12 +1,12 @@ use nix::unistd::Pid; -use std::path::PathBuf; -use std::process::Stdio; -use tokio::fs::create_dir_all; -use tokio::process::Command; -use tokio::signal::unix::{signal, SignalKind}; - -use crate::path::SUPERVISOR_LOG_FILENAME; -use crate::{MonoutilsResult, ProcessMonitor, RotatingLog}; +use std::{path::PathBuf, process::Stdio}; +use tokio::{ + fs::create_dir_all, + process::Command, + signal::unix::{signal, SignalKind}, +}; + +use crate::{path::SUPERVISOR_LOG_FILENAME, MonoutilsResult, ProcessMonitor, RotatingLog}; //-------------------------------------------------------------------------------------------------- // Types