You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "WenyXu (via GitHub)" <gi...@apache.org> on 2024/01/05 13:35:01 UTC

[PR] feat: implement concurrent `RangeWriter` [incubator-opendal]

WenyXu opened a new pull request, #3923:
URL: https://github.com/apache/incubator-opendal/pull/3923

   ### Related
   #3899


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: implement concurrent `RangeWriter` [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on code in PR #3923:
URL: https://github.com/apache/incubator-opendal/pull/3923#discussion_r1443144576


##########
core/src/raw/oio/write/range_write.rs:
##########
@@ -82,105 +86,123 @@ pub trait RangeWrite: Send + Sync + Unpin + 'static {
     async fn abort_range(&self, location: &str) -> Result<()>;
 }
 
+struct WriteRangeFuture(BoxedFuture<Result<u64>>);
+
+/// # Safety
+///
+/// wasm32 is a special target that we only have one event-loop for this WriteRangeFuture.
+unsafe impl Send for WriteRangeFuture {}
+
+/// # Safety
+///
+/// We will only take `&mut Self` reference for WriteRangeFuture.
+unsafe impl Sync for WriteRangeFuture {}
+
+impl Future for WriteRangeFuture {
+    type Output = Result<u64>;
+    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
+        self.get_mut().0.poll_unpin(cx)
+    }
+}
+
 /// RangeWriter will implements [`Write`] based on range write.
 pub struct RangeWriter<W: RangeWrite> {
     location: Option<String>,
     written: u64,

Review Comment:
   The name `written` is no longer suitable as it doesn't reflect the actual process. Perhaps we should rename it to `next_offset`? We might also change the `written` in our trait to `offset` instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat: implement concurrent `RangeWriter` [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo merged PR #3923:
URL: https://github.com/apache/incubator-opendal/pull/3923


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org