Skip to content

Comments

refactor(services/opfs): split opfs service into separate crate#7021

Merged
Xuanwo merged 5 commits intoapache:mainfrom
STRRL:reafactor/core-split-service-opfs
Dec 17, 2025
Merged

refactor(services/opfs): split opfs service into separate crate#7021
Xuanwo merged 5 commits intoapache:mainfrom
STRRL:reafactor/core-split-service-opfs

Conversation

@STRRL
Copy link
Contributor

@STRRL STRRL commented Dec 16, 2025

Summary

  • Extract core/src/services/opfs into a new crate core/services/opfs, crate name opendal-service-opfs
  • Keep the public surface (opendal::services::Opfs) unchanged
  • Preserve the existing feature flag: services-opfs

Changes

  • Created new opendal-service-opfs crate at core/services/opfs/
  • Moved all opfs source code to the new crate with updated imports
  • Updated core/Cargo.toml to use the new crate as optional dependency
  • Removed opfs feature and wasm dependencies from core/core/Cargo.toml
  • Added facade re-export in core/src/lib.rs

Test plan

  • cargo check passes
  • cargo check -p opendal-service-opfs --target wasm32-unknown-unknown passes
  • cargo fmt --check passes

Closes #6913

🤖 Generated with Claude Code

Move OPFS service from core/src/services/opfs to services/opfs as a
standalone crate. This follows the ongoing service extraction pattern
to improve modularity and reduce core dependencies.

Changes:
- Create new services/opfs crate with its own Cargo.toml
- Move all OPFS implementation files to services/opfs/src
- Remove OPFS-specific dependencies from core/Cargo.toml
- Update service feature flag to use opendal-service-opfs dependency
- Re-export opfs module in src/lib.rs

Co-Authored-By: Claude <[email protected]>
@STRRL STRRL requested a review from Xuanwo as a code owner December 16, 2025 05:41
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" labels Dec 16, 2025
core/src/lib.rs Outdated
pub use opendal_service_mysql::*;
#[cfg(feature = "services-obs")]
pub use opendal_service_obs::*;
#[cfg(feature = "services-opfs")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opfs is only available under wasm32, we need to add flags here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I found it

#[cfg(all(target_arch = "wasm32", feature = "services-opfs"))]
mod opfs;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated PTAL again ❤️ @Xuanwo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait CI failed after I update it, let me take a look.

STRRL and others added 2 commits December 16, 2025 16:31
Update opfs service export to use opendal_service_opfs crate with
appropriate target architecture constraints for wasm32.

Co-Authored-By: Claude <[email protected]>
…ction

The OPFS service only works in WebAssembly environments, so the
dependency is now correctly placed under the wasm32 target-specific
dependencies section instead of the main dependencies.

Co-Authored-By: Claude <[email protected]>
@STRRL
Copy link
Contributor Author

STRRL commented Dec 17, 2025

Updated, PTAL @Xuanwo

current changes in Cargo.toml is ugly, any suggestions?

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 17, 2025
@Xuanwo
Copy link
Member

Xuanwo commented Dec 17, 2025

current changes in Cargo.toml is ugly, any suggestions?

I think that's the cost we need to pay 🤣

@Xuanwo Xuanwo merged commit 4c2b68f into apache:main Dec 17, 2025
334 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[core split] Service: opfs

2 participants