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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to