OperatorInfo should be stored inside Operator to avoid calling metadata
OperatorInfo will never be changed after Operator been built, we can store it inside an Arc inside Operator to avoid extra cost.
If my understanding is right, it just wrap OperatorInfo in Arc<T>.
And if it is better to use OnceCell<T> for lazy init of OperatorInfo and change pub fn info(&self) -> OperatorInfo to pub fn info(&self) -> &OperatorInfo?
Hi, @Lzzzzzt. Thanks for joining the discussion and starting https://github.com/apache/opendal/pull/4883.
After some consideration, I think it would be better to modify Access::info() to return Arc<AccessInfo>, similiar to what you suggested in https://github.com/apache/opendal/pull/4883#issuecomment-2224328372. This will allow all our layers to avid extra copy.
With this change, OperatorInfo could hold an Arc<AccessInfo>, allowing the user API to remain unchanged.
Hi, @Lzzzzzt. Thanks for joining the discussion and starting #4883.
After some consideration, I think it would be better to modify
Access::info()to returnArc<AccessInfo>, similiar to what you suggested in #4883 (comment). This will allow all our layers to avid extra copy.With this change,
OperatorInfocould hold anArc<AccessInfo>, allowing the user API to remain unchanged.
Ok, got it
Hi, @Lzzzzzt. Thanks for joining the discussion and starting #4883.
After some consideration, I think it would be better to modify
Access::info()to returnArc<AccessInfo>, similiar to what you suggested in #4883 (comment). This will allow all our layers to avid extra copy.With this change,
OperatorInfocould hold anArc<AccessInfo>, allowing the user API to remain unchanged.
It seems need to change a lot, if modify Access::info() to return Arc<AccessInfo>
It seems need to change a lot, if modify
Access::info()to returnArc<AccessInfo>
Yes. If we do need API breaking changes, I prefer change opendal::raw API instead of opendal's public API.
It seems need to change a lot, if modify
Access::info()to returnArc<AccessInfo>Yes. If we do need API breaking changes, I prefer change
opendal::rawAPI instead ofopendal's public API.
if modify Access::info() to return Arc<AccessInfo>, a lot of struct will need a extra field to store the info, is that right?
https://github.com/apache/opendal/blob/740928efffc761a22fdf4bb3300e25ab790616b2/core/src/services/fs/backend.rs#L184-L210
if modify Access::info() to return Arc, a lot of struct will need a extra field to store the info, is that right?
We can start by simply adding an into() and refactor them later based on our feedback.
some layers need a mutable AccessorInfo, so Arc<T> may not work
https://github.com/apache/opendal/blob/740928efffc761a22fdf4bb3300e25ab790616b2/core/src/layers/blocking.rs#L168-L185
some layers need a mutable
AccessorInfo, soArc<T>may not work
Those layers can build a new AccessorInfo with changed value.
some layers need a mutable
AccessorInfo, soArc<T>may not workThose layers can build a new
AccessorInfowith changed value.
ok
I change the signature of Access::info and AccessDyn::info and related layers implement, and fs service.
PTAL
Has been implemented, closing.