Skip to content

feat(raw/oio): Use Buffer as cache in OneshotWrite - #4477

Merged
Xuanwo merged 5 commits into
apache:mainfrom
reswqa:one_shot_write
Apr 13, 2024
Merged

Xuanwo merged 5 commits into
apache:mainfrom
reswqa:one_shot_write

Conversation

@reswqa

@reswqa reswqa commented Apr 12, 2024 •

Copy link
Copy Markdown
Member

This closes #4456.

@github-actions
github-actions Bot requested review from Xuanwo and xyjixyjixyji April 12, 2024 14:40
@github-actions github-actions Bot added the releases-note/feat The PR implements a new feature or has a title that begins with "feat" label Apr 12, 2024
@reswqa

reswqa commented Apr 12, 2024

Copy link
Copy Markdown
Member Author

Oops, too many impl should also be changed. Give me a minute 😉

@Xuanwo

Xuanwo commented Apr 12, 2024 •

Copy link
Copy Markdown
Member

Oops, too many impl should also be changed. Give me a minute 😉

Thank you!

let req = self.core.dbfs_create_file_request(&self.path, bs)?;
let req = self
.core
.dbfs_create_file_request(&self.path, bs.to_bytes())?;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function would call BASE64_STANDARD.encode(body), which require a AsRef[u8], this is not implements for Buffer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add a helper function that uses base64::write::EncoderWriter. But I believe it's out of the scope of current PR, maybe worth a new one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracked at #4483

Comment thread core/src/services/github/core.rs Resolved
self.write_simple(bs).await?;
} else {
self.write_chunked(bs).await?;
self.write_chunked(bs.to_bytes()).await?;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write_chunked splits continuous data in chunks. The migration to Buffer should not be trivial. WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do want to refactor OneDrive entirely. Its implementation doesn't fit well with our current design.

@reswqa
reswqa marked this pull request as ready for review April 12, 2024 15:56

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

@Xuanwo
Xuanwo merged commit 275224d into apache:main Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Buffer as cache in OneshotWrite

2 participants