Conversation
bdb5021 to
4a3ffe9
Compare
fae7404 to
d2bfabc
Compare
|
I think the crux of the issue lies here, opendal/core/src/types/metadata.rs Lines 223 to 226 in 8c72db9 |
It's definitely a dirty workaround. We have this because some storage services, like fs, don't return |
| pub trait Read { | ||
| // Existing functions... | ||
|
|
||
| fn metadata(&self) -> Metadata; |
There was a problem hiding this comment.
Such API also changes the fact that all APIs for oio::Read takes &mut self. This can lead to oio::Read is not Sync anymore.
There was a problem hiding this comment.
This can lead to
oio::Readis notSyncanymore.
Hmmm, I don't understand this point of view.
There was a problem hiding this comment.
It's an interesting trick involving Rust's Send and Sync.
If a trait only provides &mut self APIs and there's no way to access the struct itself, we can safely declare it as Sync when it's Send by self because it cannot be accessed from multiple threads simultaneously. This can eliminate some unnecessary Mutex<T> instances when implementing oio::Read.
d2bfabc to
d6e018b
Compare
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you @meteorgan for this, looks nice!
|
Thanks for the review—it’s practically a whole new design. I’ve learned a ton from it! @Xuanwo |
Nice work! |
|
Oh, I recall an issue with the current design while sleeping last night. We are not calling |
I'm aware of this issue, and planning to call |
But we don't know the range to read 🤔 |
Oh, Got it. After digging a bit deeper, I've come up with a few more questions:
|
It looks like we need a bit of time to think through this issue. It might actually call for an API change, or add a new API returns both data and metadata ? |
|
The returned value like /// Result for a get request
#[derive(Debug)]
pub struct GetResult {
/// The [`GetResultPayload`]
pub payload: GetResultPayload,
/// The [`ObjectMeta`] for this object
pub meta: ObjectMeta,
/// The range of bytes returned by this request
///
/// Note this is not `usize` as `object_store` supports 32-bit architectures such as WASM
pub range: Range<u64>,
/// Additional object attributes
pub attributes: Attributes,
} |
|
Hi, @Xuanwo do any new ideas on these issues ? |
I'm guessing we need to start a new one. Returning |
How about these two issues ? Did i overlook anything ? or are there potential bugs in current implementation ? @Xuanwo |
Are you suggesting we open a new issue to dive into these issues ? |
Users who want to make sure to read the exact version should specify
Let's reopen the old issue. |
These issues don't tie into |
Which issue does this PR close?
Closes #5425.
Rationale for this change
What changes are included in this PR?
a new RFC
Are there any user-facing changes?