opendal icon indicating copy to clipboard operation
opendal copied to clipboard

Add CapabilityCheckLayer

Open Xuanwo opened this issue 1 year ago • 3 comments

          Hi, this PR suggests that we consider introducing a layer to handle unsupported behaviors. Not all users and use cases are concerned about whether services support versioning; they might simply want to write code consistently and return it as is if not supported.

We have similar code here: https://github.com/apache/opendal/blob/d479ac39efa9a88e10448ad81e47292b3b4ed688/core/src/layers/complete.rs#L132-L140

I think we can create a new layer called CapabilityCheckLayer. By default, opendal will not perform any capability checks. Users can enable CapabilityCheckLayer to ensure the features they use are supported and behave as expected.

CapabilityCheckLayer may have different modes:

  • Default: just bypass all checks, like the opendal default behavior.
  • Correctness: only check capability that affected correctness, for example, write with if none match, read with version.
  • All: check all capabilities.

Originally posted by @Xuanwo in https://github.com/apache/opendal/pull/5145#discussion_r1778959423

Xuanwo avatar Oct 21 '24 09:10 Xuanwo

Hello, @meteorgan, are you interested in helping with the implementation? I believe we should transfer most of the check code to the new layer instead.

Xuanwo avatar Oct 21 '24 09:10 Xuanwo

Hello, @meteorgan, are you interested in helping with the implementation? I believe we should transfer most of the check code to the new layer instead.

Yes, I'd love to. I'm still working on other projects, but I can start this one later this week.

meteorgan avatar Oct 22 '24 09:10 meteorgan

Yes, I'd love to. I'm still working on other projects, but I can start this one later this week.

Greatly appreciated. Thank you in advance.

Xuanwo avatar Oct 22 '24 09:10 Xuanwo