Skip to content

feat(services/smb): add smb service#7374

Draft
suyanhanx wants to merge 2 commits intoapache:mainfrom
suyanhanx:feat/smb-service
Draft

feat(services/smb): add smb service#7374
suyanhanx wants to merge 2 commits intoapache:mainfrom
suyanhanx:feat/smb-service

Conversation

@suyanhanx
Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #7369.

Rationale for this change

OpenDAL does not have first-class SMB support today. This change adds an SMB service backed by smb-rs so Operator::from_uri and the service registry can open SMB shares via smb://host/share/root.

This draft is intentionally split from the dependency fix path. OpenDAL is not carrying a local fork of smb-rs; the upstream async-read fix is proposed separately in afiffon/smb-rs#167.

What changes are included in this PR?

  • add a new core/services/smb service crate
  • wire services-smb into the workspace feature list and registry exports
  • support create_dir, stat, read, write, delete, and list
  • parse SMB URIs as smb://host/share/root and add matching .env.example entries
  • keep OpenDAL-style slash paths internally and only convert to SMB separators at the UncPath boundary
  • explicitly close SMB resources in stat/list/create/delete flows to avoid async destructor issues
  • treat transient DELETE_PENDING / not-found races during list and delete as skips instead of hard failures

This draft does not enable copy or rename yet.

Are there any user-facing changes?

Yes. Users get a new services-smb feature and can configure SMB tests via:

  • OPENDAL_SMB_ENDPOINT
  • OPENDAL_SMB_SHARE
  • OPENDAL_SMB_ROOT
  • OPENDAL_SMB_USER
  • OPENDAL_SMB_PASSWORD

Validation run on this branch:

  • cargo test -p opendal-service-smb
  • cargo check -p opendal --features services-smb
  • cargo clippy -p opendal-service-smb --all-targets -- -D warnings
  • cargo clippy -p opendal --all-targets --features services-smb -- -D warnings
  • OPENDAL_TEST=smb OPENDAL_SMB_ENDPOINT=127.0.0.1:1445 OPENDAL_SMB_SHARE=MyShare OPENDAL_SMB_ROOT=/ OPENDAL_SMB_USER=alice OPENDAL_SMB_PASSWORD=alipass cargo test -p opendal --features tests,services-smb behavior

One dependency caveat remains: with crates.io smb = 0.11.1, large reads can still log Async command is not allowed in this context before OpenDAL retries them successfully. That fix is under review upstream in afiffon/smb-rs#167.

AI Usage Statement

Built with Codex / GPT-5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add smb support in OpenDAL via smb-rs

1 participant