diqiu50 commented on code in PR #6280:
URL: https://github.com/apache/gravitino/pull/6280#discussion_r1926493380


##########
clients/filesystem-fuse/src/open_dal_filesystem.rs:
##########
@@ -210,19 +227,44 @@ impl FileReader for FileReaderImpl {
 
 struct FileWriterImpl {
     writer: opendal::Writer,
+    buffer: Vec<u8>,
+}
+
+impl FileWriterImpl {
+    fn new(writer: opendal::Writer) -> Self {
+        Self {
+            writer,
+            buffer: Vec::with_capacity(OpenDalFileSystem::WRITE_BUFFER_SIZE + 
4096),
+        }
+    }
 }
 
 #[async_trait]
 impl FileWriter for FileWriterImpl {
     async fn write(&mut self, _offset: u64, data: &[u8]) -> Result<u32> {
-        self.writer
-            .write(data.to_vec())
-            .await
-            .map_err(opendal_error_to_errno)?;
+        if self.buffer.len() > OpenDalFileSystem::WRITE_BUFFER_SIZE {
+            let mut new_buffer: Vec<u8> =
+                Vec::with_capacity(OpenDalFileSystem::WRITE_BUFFER_SIZE + 
4096);
+            new_buffer.append(&mut self.buffer);

Review Comment:
   Yes, the `self.buffer` is cleared after the append operation.



-- 
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-unsubscr...@gravitino.apache.org

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

Reply via email to