-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose conditional puts in the FileIO interface #1
Conversation
@@ -344,6 +344,16 @@ impl OutputFile { | |||
writer.close().await | |||
} | |||
|
|||
/// Create a new output file with given bytes. | |||
/// Error out if the file already exists | |||
pub async fn write_exclusive(&self, bs: Bytes) -> crate::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming suggestions for this method are welcome. I named it write_exclusive after O_EXCL in the Linux/Unix API which has equivalent functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Might be useful if OutputFile::op
was exposed upstream eventually, then we'd be able to do the same without the custom change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Maybe I could simplify this PR to just add a getter for OutputFile::op
. That could be easier to get merged upstream.
@@ -344,6 +344,16 @@ impl OutputFile { | |||
writer.close().await | |||
} | |||
|
|||
/// Create a new output file with given bytes. | |||
/// Error out if the file already exists | |||
pub async fn write_exclusive(&self, bs: Bytes) -> crate::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Might be useful if OutputFile::op
was exposed upstream eventually, then we'd be able to do the same without the custom change.
e66ef22
to
9eaff9b
Compare
FileIo changes to support splitgraph/lakehouse-loader#12