-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add capability check #2461
Conversation
Hi @Xuanwo, maybe we can have a quick review of the current design, so we can make sure the direction is good to follow when implementing the rest things. |
All those related tasks are handled at |
One question for this, how should we pass the strict mode flag to the |
We can store a boolean |
Should we expose the configuration to users? Like overriding it when building the operator. |
I'm a bit hesitant about this. Maybe we can provide a |
No worrying about this, we can implement the mandatory operation-level checks first. |
Just updated the PR, it's now much simpler :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good to me! Only a few minor changes.
Kv and TypedKv's blokcing cap is not set which results in our tests failed: https://github.com/apache/incubator-opendal/blob/main/core/src/raw/adapters/typed_kv/backend.rs#L65 Can you help fix it in this PR? |
Yep, bringing up the commits. |
There is still something wrong, I'm fixing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixed #1752.
In this PR, we will only implement the capability check at operation-level.
Implementation Notes
Static dispatchingwith_strict
method is added onOperatorBuilder
type to eliminate dynamic dispatching & extra heap allocations. That will make the builtOperator
be strict in its whole lifetime, thereforewith_strict
method is also added onOperator
for flexibility.Dedicated layer for checkingThe capability checking is performed inCapabilityCheckLayer
to guarantee the single responsibility principle. It's also hard to mix them with any existing layer while allowing the flexible controls.Manually checking against all ops
The capability metadata is defined separately from ops (in different modules). We have to enumerate all the cases when checking, and map them manually. Fortunately, this is simplified by an internal macro, which can avoid a large amount of redundant code.
Checklist
Expose APIs for users to enable the strict mode