This is an automated email from the ASF dual-hosted git repository.

koushiro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 2ee38aadb refactor: split monoiofs service into a separate crate 
(#7038)
2ee38aadb is described below

commit 2ee38aadbd9fb4f775f9cca1914a69bc9097eea4
Author: Mozammil Ali <[email protected]>
AuthorDate: Sat Dec 20 09:00:27 2025 +0530

    refactor: split monoiofs service into a separate crate (#7038)
    
    * Service: monoiofs #6829
    
    * chore: update dependencies in Cargo.lock
    
    * chore: fix toml formatting
    
    * chore: add license header and fix formatting
    
    * chore: update lockfile
    
    * chore: sync with main
    
    * fix: pin async-graphql components to version 7.0.11 to prevent breaking 
changes
    
    * fix(core): taplo formatting in manifests; ensure async-graphql pinned via 
surrealdb service
    
    * chore: taplo format core manifest
    
    * chore: revert unnecessary async-graphql pins and update lockfile
    
    * chore: revert unrelated changes in setup action
    
    * Update core/core/Cargo.toml
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    * Update core/core/src/services/mod.rs
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    * Update core/core/Cargo.toml
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    * fix: resolve ci issues (formatting, ocaml deps, lockfile)
    
    * ci: rerun checks
    
    * Update bindings/ocaml/Cargo.toml
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    * Update core/core/Cargo.toml
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    * Apply suggestions from code review
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    * chore: revert Cargo.lock to match main
    
    * style: remove trailing comma
    
    * chore: Reformat futures dependency features in Cargo.toml
    
    * style: format toml files
    
    * Revert Cargo.lock dependency changes
    
    * Revert unintended Cargo.lock dependency changes
    
    * revert changes in Cargo.lock
    
    * update monoiofs service
    
    ---------
    
    Co-authored-by: Qinxuan Chen <[email protected]>
---
 core/Cargo.lock                                    | 17 +++++++-
 core/Cargo.toml                                    |  3 +-
 core/core/Cargo.toml                               |  9 ----
 core/core/src/services/mod.rs                      |  5 ---
 core/services/monoiofs/Cargo.toml                  | 48 ++++++++++++++++++++++
 .../monoiofs => services/monoiofs/src}/backend.rs  |  4 +-
 .../monoiofs => services/monoiofs/src}/config.rs   | 14 +++----
 .../monoiofs => services/monoiofs/src}/core.rs     |  4 +-
 .../monoiofs => services/monoiofs/src}/deleter.rs  |  5 ++-
 .../monoiofs => services/monoiofs/src}/docs.md     |  4 +-
 .../mod.rs => services/monoiofs/src/lib.rs}        | 11 +++--
 .../monoiofs => services/monoiofs/src}/reader.rs   |  4 +-
 .../monoiofs => services/monoiofs/src}/writer.rs   |  4 +-
 core/src/lib.rs                                    |  2 +
 14 files changed, 94 insertions(+), 40 deletions(-)

diff --git a/core/Cargo.lock b/core/Cargo.lock
index c1863cdc0..d0bf60233 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -5587,6 +5587,7 @@ dependencies = [
  "opendal-service-memcached",
  "opendal-service-mini-moka",
  "opendal-service-moka",
+ "opendal-service-monoiofs",
  "opendal-service-mysql",
  "opendal-service-obs",
  "opendal-service-onedrive",
@@ -5659,7 +5660,6 @@ dependencies = [
  "bytes",
  "ctor",
  "fastpool",
- "flume",
  "futures",
  "getrandom 0.2.16",
  "http 1.4.0",
@@ -5671,7 +5671,6 @@ dependencies = [
  "moka",
  "mongodb",
  "mongodb-internal-macros",
- "monoio",
  "openssh",
  "openssh-sftp-client",
  "percent-encoding",
@@ -6412,6 +6411,20 @@ dependencies = [
  "tokio",
 ]
 
+[[package]]
+name = "opendal-service-monoiofs"
+version = "0.55.0"
+dependencies = [
+ "bytes",
+ "ctor",
+ "flume",
+ "futures",
+ "monoio",
+ "opendal-core",
+ "serde",
+ "tokio",
+]
+
 [[package]]
 name = "opendal-service-mysql"
 version = "0.55.0"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 559817cf5..a5c86bbfe 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -147,7 +147,7 @@ services-memory = ["opendal-core/services-memory"]
 services-mini-moka = ["dep:opendal-service-mini-moka"]
 services-moka = ["dep:opendal-service-moka"]
 services-mongodb = ["opendal-core/services-mongodb"]
-services-monoiofs = ["opendal-core/services-monoiofs"]
+services-monoiofs = ["dep:opendal-service-monoiofs"]
 services-mysql = ["dep:opendal-service-mysql"]
 services-obs = ["dep:opendal-service-obs"]
 services-onedrive = ["dep:opendal-service-onedrive"]
@@ -249,6 +249,7 @@ opendal-service-lakefs = { path = "services/lakefs", 
version = "0.55.0", optiona
 opendal-service-memcached = { path = "services/memcached", version = "0.55.0", 
optional = true, default-features = false }
 opendal-service-mini-moka = { path = "services/mini_moka", version = "0.55.0", 
optional = true, default-features = false }
 opendal-service-moka = { path = "services/moka", version = "0.55.0", optional 
= true, default-features = false }
+opendal-service-monoiofs = { path = "services/monoiofs", version = "0.55.0", 
optional = true, default-features = false }
 opendal-service-mysql = { path = "services/mysql", version = "0.55.0", 
optional = true, default-features = false }
 opendal-service-obs = { path = "services/obs", version = "0.55.0", optional = 
true, default-features = false }
 opendal-service-onedrive = { path = "services/onedrive", version = "0.55.0", 
optional = true, default-features = false }
diff --git a/core/core/Cargo.toml b/core/core/Cargo.toml
index d2037a313..3311d59d0 100644
--- a/core/core/Cargo.toml
+++ b/core/core/Cargo.toml
@@ -62,7 +62,6 @@ services-ipmfs = []
 services-lakefs = []
 services-memory = []
 services-mongodb = ["dep:mongodb", "dep:mongodb-internal-macros"]
-services-monoiofs = ["dep:monoio", "dep:flume"]
 services-redis = ["dep:redis", "dep:fastpool", "redis?/tokio-rustls-comp"]
 services-redis-native-tls = ["services-redis", "redis?/tokio-native-tls-comp"]
 services-rocksdb = ["dep:rocksdb", "internal-tokio-rt"]
@@ -127,14 +126,6 @@ redis = { version = "1.0", features = [
 ], optional = true }
 # for services-rocksdb
 rocksdb = { version = "0.21.0", default-features = false, optional = true }
-# for services-monoiofs
-flume = { version = "0.11", optional = true }
-monoio = { version = "0.2.4", optional = true, features = [
-  "sync",
-  "mkdirat",
-  "unlinkat",
-  "renameat",
-] }
 
 # Layers
 # for layers-dtrace
diff --git a/core/core/src/services/mod.rs b/core/core/src/services/mod.rs
index 05a0b7a3b..7a4adc065 100644
--- a/core/core/src/services/mod.rs
+++ b/core/core/src/services/mod.rs
@@ -34,11 +34,6 @@ mod mongodb;
 #[cfg(feature = "services-mongodb")]
 pub use self::mongodb::*;
 
-#[cfg(feature = "services-monoiofs")]
-mod monoiofs;
-#[cfg(feature = "services-monoiofs")]
-pub use monoiofs::*;
-
 #[cfg(feature = "services-redis")]
 mod redis;
 #[cfg(feature = "services-redis")]
diff --git a/core/services/monoiofs/Cargo.toml 
b/core/services/monoiofs/Cargo.toml
new file mode 100644
index 000000000..846c647c6
--- /dev/null
+++ b/core/services/monoiofs/Cargo.toml
@@ -0,0 +1,48 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[package]
+description = "Apache OpenDAL Monoiofs service implementation"
+name = "opendal-service-monoiofs"
+
+authors = { workspace = true }
+edition = { workspace = true }
+homepage = { workspace = true }
+license = { workspace = true }
+repository = { workspace = true }
+rust-version = { workspace = true }
+version = { workspace = true }
+
+[package.metadata.docs.rs]
+all-features = true
+
+[dependencies]
+bytes = { workspace = true }
+ctor = { workspace = true }
+flume = "0.11"
+futures = { workspace = true, features = ["std", "async-await"] }
+monoio = { version = "0.2.4", features = [
+  "sync",
+  "mkdirat",
+  "unlinkat",
+  "renameat",
+] }
+opendal-core = { path = "../../core", version = "0.55.0", default-features = 
false }
+serde = { workspace = true, features = ["derive"] }
+
+[dev-dependencies]
+tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
diff --git a/core/core/src/services/monoiofs/backend.rs 
b/core/services/monoiofs/src/backend.rs
similarity index 99%
rename from core/core/src/services/monoiofs/backend.rs
rename to core/services/monoiofs/src/backend.rs
index 67bfaf75d..59c802901 100644
--- a/core/core/src/services/monoiofs/backend.rs
+++ b/core/services/monoiofs/src/backend.rs
@@ -21,6 +21,8 @@ use std::path::PathBuf;
 use std::sync::Arc;
 
 use monoio::fs::OpenOptions;
+use opendal_core::raw::*;
+use opendal_core::*;
 
 use super::config::MonoiofsConfig;
 use super::core::BUFFER_SIZE;
@@ -28,8 +30,6 @@ use super::core::MonoiofsCore;
 use super::deleter::MonoiofsDeleter;
 use super::reader::MonoiofsReader;
 use super::writer::MonoiofsWriter;
-use crate::raw::*;
-use crate::*;
 
 /// File system support via [`monoio`].
 #[doc = include_str!("docs.md")]
diff --git a/core/core/src/services/monoiofs/config.rs 
b/core/services/monoiofs/src/config.rs
similarity index 85%
rename from core/core/src/services/monoiofs/config.rs
rename to core/services/monoiofs/src/config.rs
index 08e925850..c38da95b8 100644
--- a/core/core/src/services/monoiofs/config.rs
+++ b/core/services/monoiofs/src/config.rs
@@ -15,6 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
+use opendal_core::*;
 use serde::Deserialize;
 use serde::Serialize;
 
@@ -33,10 +34,10 @@ pub struct MonoiofsConfig {
     pub root: Option<String>,
 }
 
-impl crate::Configurator for MonoiofsConfig {
+impl Configurator for MonoiofsConfig {
     type Builder = MonoiofsBuilder;
 
-    fn from_uri(uri: &crate::types::OperatorUri) -> crate::Result<Self> {
+    fn from_uri(uri: &OperatorUri) -> Result<Self> {
         let mut map = uri.options().clone();
 
         if let Some(root) = uri.root() {
@@ -56,14 +57,13 @@ impl crate::Configurator for MonoiofsConfig {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::Configurator;
-    use crate::types::OperatorUri;
 
     #[test]
-    fn from_uri_sets_root() {
-        let uri = OperatorUri::new("monoiofs:///tmp", Vec::<(String, 
String)>::new()).unwrap();
+    fn from_uri_sets_root() -> Result<()> {
+        let uri = OperatorUri::new("monoiofs:///tmp", Vec::<(String, 
String)>::new())?;
 
-        let cfg = MonoiofsConfig::from_uri(&uri).unwrap();
+        let cfg = MonoiofsConfig::from_uri(&uri)?;
         assert_eq!(cfg.root.as_deref(), Some("tmp"));
+        Ok(())
     }
 }
diff --git a/core/core/src/services/monoiofs/core.rs 
b/core/services/monoiofs/src/core.rs
similarity index 99%
rename from core/core/src/services/monoiofs/core.rs
rename to core/services/monoiofs/src/core.rs
index 009fbf2da..676566253 100644
--- a/core/core/src/services/monoiofs/core.rs
+++ b/core/services/monoiofs/src/core.rs
@@ -26,10 +26,10 @@ use futures::Future;
 use futures::channel::oneshot;
 use monoio::FusionDriver;
 use monoio::RuntimeBuilder;
+use opendal_core::raw::*;
+use opendal_core::*;
 
 use super::MONOIOFS_SCHEME;
-use crate::raw::*;
-use crate::*;
 
 pub const BUFFER_SIZE: usize = 2 * 1024 * 1024; // 2 MiB
 
diff --git a/core/core/src/services/monoiofs/deleter.rs 
b/core/services/monoiofs/src/deleter.rs
similarity index 97%
rename from core/core/src/services/monoiofs/deleter.rs
rename to core/services/monoiofs/src/deleter.rs
index b3811b7aa..e11b4e30a 100644
--- a/core/core/src/services/monoiofs/deleter.rs
+++ b/core/services/monoiofs/src/deleter.rs
@@ -17,9 +17,10 @@
 
 use std::sync::Arc;
 
+use opendal_core::raw::*;
+use opendal_core::*;
+
 use super::core::MonoiofsCore;
-use crate::raw::*;
-use crate::*;
 
 pub struct MonoiofsDeleter {
     core: Arc<MonoiofsCore>,
diff --git a/core/core/src/services/monoiofs/docs.md 
b/core/services/monoiofs/src/docs.md
similarity index 92%
rename from core/core/src/services/monoiofs/docs.md
rename to core/services/monoiofs/src/docs.md
index 753a896a0..53d20d54b 100644
--- a/core/core/src/services/monoiofs/docs.md
+++ b/core/services/monoiofs/src/docs.md
@@ -23,9 +23,9 @@ You can refer to [`MonoiofsBuilder`]'s docs for more 
information
 ### Via Builder
 
 ```rust,no_run
-use anyhow::Result;
-use opendal_core::services::Monoiofs;
 use opendal_core::Operator;
+use opendal_core::Result;
+use opendal_service_monoiofs::Monoiofs;
 
 #[tokio::main]
 async fn main() -> Result<()> {
diff --git a/core/core/src/services/monoiofs/mod.rs 
b/core/services/monoiofs/src/lib.rs
similarity index 84%
rename from core/core/src/services/monoiofs/mod.rs
rename to core/services/monoiofs/src/lib.rs
index 1915761d2..773ce1f88 100644
--- a/core/core/src/services/monoiofs/mod.rs
+++ b/core/services/monoiofs/src/lib.rs
@@ -15,10 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 
-/// Default scheme for monoiofs service.
-pub const MONOIOFS_SCHEME: &str = "monoiofs";
+//! MonoIOFS service implementation for Apache OpenDAL.
 
-use crate::types::DEFAULT_OPERATOR_REGISTRY;
+#![cfg_attr(docsrs, feature(doc_cfg))]
+#![deny(missing_docs)]
 
 mod backend;
 mod config;
@@ -30,7 +30,10 @@ mod writer;
 pub use backend::MonoiofsBuilder as Monoiofs;
 pub use config::MonoiofsConfig;
 
+/// Default scheme for monoiofs service.
+pub const MONOIOFS_SCHEME: &str = "monoiofs";
+
 #[ctor::ctor]
 fn register_monoiofs_service() {
-    DEFAULT_OPERATOR_REGISTRY.register::<Monoiofs>(MONOIOFS_SCHEME);
+    
opendal_core::DEFAULT_OPERATOR_REGISTRY.register::<Monoiofs>(MONOIOFS_SCHEME);
 }
diff --git a/core/core/src/services/monoiofs/reader.rs 
b/core/services/monoiofs/src/reader.rs
similarity index 99%
rename from core/core/src/services/monoiofs/reader.rs
rename to core/services/monoiofs/src/reader.rs
index 6580f4dda..aab2cb55c 100644
--- a/core/core/src/services/monoiofs/reader.rs
+++ b/core/services/monoiofs/src/reader.rs
@@ -24,11 +24,11 @@ use futures::StreamExt;
 use futures::channel::mpsc;
 use futures::channel::oneshot;
 use monoio::fs::OpenOptions;
+use opendal_core::raw::*;
+use opendal_core::*;
 
 use super::core::BUFFER_SIZE;
 use super::core::MonoiofsCore;
-use crate::raw::*;
-use crate::*;
 
 enum ReaderRequest {
     Read {
diff --git a/core/core/src/services/monoiofs/writer.rs 
b/core/services/monoiofs/src/writer.rs
similarity index 99%
rename from core/core/src/services/monoiofs/writer.rs
rename to core/services/monoiofs/src/writer.rs
index ab36e2701..6cfb8bd6a 100644
--- a/core/core/src/services/monoiofs/writer.rs
+++ b/core/services/monoiofs/src/writer.rs
@@ -25,10 +25,10 @@ use futures::StreamExt;
 use futures::channel::mpsc;
 use futures::channel::oneshot;
 use monoio::fs::OpenOptions;
+use opendal_core::raw::*;
+use opendal_core::*;
 
 use super::core::MonoiofsCore;
-use crate::raw::*;
-use crate::*;
 
 enum WriterRequest {
     Write {
diff --git a/core/src/lib.rs b/core/src/lib.rs
index ccc4d0b51..c6b596cbd 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -96,6 +96,8 @@ pub mod services {
     pub use opendal_service_mini_moka::*;
     #[cfg(feature = "services-moka")]
     pub use opendal_service_moka::*;
+    #[cfg(feature = "services-monoiofs")]
+    pub use opendal_service_monoiofs::*;
     #[cfg(feature = "services-mysql")]
     pub use opendal_service_mysql::*;
     #[cfg(feature = "services-obs")]

Reply via email to