Skip to content

Comments

feat: allow using object_store as opendal's backend#6283

Merged
Xuanwo merged 62 commits intoapache:mainfrom
flaneur2020:add-objstore
Aug 26, 2025
Merged

feat: allow using object_store as opendal's backend#6283
Xuanwo merged 62 commits intoapache:mainfrom
flaneur2020:add-objstore

Conversation

@flaneur2020
Copy link
Contributor

@flaneur2020 flaneur2020 commented Jun 11, 2025

Which issue does this PR close?

Closes #6171.

Rationale for this change

with allowing object_store as opendal's backend, we can leverage opendal's advanced operation like parallel fetching, chunking, caching for users object_store.

What changes are included in this PR?

New Backend Implementation: Added complete object_store backend in src/backend/ with full CRUD operations.

Are there any user-facing changes?

  • New APIs: ObjectStoreBackend and ObjectStoreBuilder for creating object_store-based OpenDAL operators
  • New Feature: services-object-store feature flag to enable the backend
let store: Arc<dyn ObjectStore> = Arc::new(InMemory::new());
let operator = Operator::new(ObjectStore::default().store(store))?.finish();

@Xuanwo
Copy link
Member

Xuanwo commented Jun 11, 2025

Thanks a lot for building this, but I think it's better to be part of opendal's object_store integration instead of in opendal core.

@flaneur2020
Copy link
Contributor Author

Thanks a lot for building this, but I think it's better to be part of opendal's object_store integration instead of in opendal core.

thank you for the feedback, let me move it there

@Xuanwo Xuanwo requested a review from Copilot July 4, 2025 10:27
@Xuanwo
Copy link
Member

Xuanwo commented Jul 4, 2025

Give Github Copilot a chance.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates object_store as a custom backend for opendal, enabling users to leverage object_store’s advanced features (parallel fetching, chunking, caching) through the opendal interface.

  • Introduce a new backend module with ObjectStoreBuilder and ObjectStoreBackend.
  • Implement reader, writer, lister, deleter adapters and unified error mapping.
  • Update core/Cargo.toml to add the services-object-store feature and optional object_store dependency.

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
integrations/object_store/src/lib.rs Expose backend module and re-export builder & backend
integrations/object_store/src/backend/writer.rs Add ObjectStoreWriter and parse_write_args
integrations/object_store/src/backend/reader.rs Add ObjectStoreReader and parse_read_args
integrations/object_store/src/backend/lister.rs Add ObjectStoreLister
integrations/object_store/src/backend/deleter.rs Add ObjectStoreDeleter
integrations/object_store/src/backend/error.rs Map object_store::Error variants to opendal::Error
integrations/object_store/src/backend/mod.rs Wire up Builder and Access implementation
core/Cargo.toml Register services-object-store and optional object_store dependency
Comments suppressed due to low confidence (2)

integrations/object_store/src/backend/writer.rs:77

  • There are no unit tests covering parse_write_args. Consider adding tests to verify mapping of OpWrite options (content_type, content_disposition, cache_control, user_metadata) into PutOptions.
pub(crate) fn parse_write_args(args: &OpWrite) -> Result<PutOptions> {

integrations/object_store/src/backend/reader.rs:70

  • The parse_read_args function isn't covered by tests. Adding unit tests for version, conditional headers, and range options would help ensure correct behavior across scenarios.
fn parse_read_args(args: &OpRead) -> Result<object_store::GetOptions> {

@flaneur2020 flaneur2020 marked this pull request as ready for review July 20, 2025 14:36
@flaneur2020 flaneur2020 requested a review from Xuanwo as a code owner July 20, 2025 14:36
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jul 20, 2025
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, I believe are are very close now!

stat_with_if_match: true,
stat_with_if_unmodified_since: true,
read: true,
write: true,
Copy link
Member

Choose a reason for hiding this comment

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

object_store should support many memtadata, but it's fine to leave them in next PR.

let writer = ObjectStoreWriter::new(self.store.clone(), path, args);
Ok((
RpWrite::default(),
MultipartWriter::new(self.info(), writer, 10),
Copy link
Member

Choose a reason for hiding this comment

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

We could make concurrent configurable; that might be a nice improvement for the next PR.

}

#[cfg(test)]
mod tests {
Copy link
Member

Choose a reason for hiding this comment

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

I wish we could integrate with opendal's test suites, but so far I haven't figured out how to make it work. It might be worth opening an issue.


// Generate a proper ETag for the part based on its content
// This follows the pattern used by many object stores where ETags are MD5 hashes
let etag = calculate_part_etag(&bytes, part_number);
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to do this, and it might be incorrect. Let's just return an empty string since it not used anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in dd71f57

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Aug 6, 2025
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 16, 2025
@flaneur2020 flaneur2020 requested a review from Xuanwo August 16, 2025 04:57
@flaneur2020
Copy link
Contributor Author

flaneur2020 commented Aug 16, 2025

@Xuanwo sorry for the late response. i updated the PR with following the feedbacks. please take another look when you have time at your convenience qwq

there're still some follow ups that might be in future prs:

  1. make it integrated with opendal's existing test suites
  2. enhance the metadata handling
  3. make concurrent configurable in writer

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 for working on this!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 26, 2025
@Xuanwo Xuanwo merged commit f00fd1c into apache:main Aug 26, 2025
36 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/feat The PR implements a new feature or has a title that begins with "feat" size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new feature: Implement raw::Access for ObjectStore in object_store_opendal

2 participants