Skip to content
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

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

SergeiPatiakin
Copy link
Collaborator

FileIo changes to support splitgraph/lakehouse-loader#12

@SergeiPatiakin SergeiPatiakin changed the title Expose conditional puts in the FileIo interface Expose conditional puts in the FileIO interface Dec 4, 2024
@@ -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<()> {
Copy link
Collaborator Author

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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<()> {
Copy link
Collaborator

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.

@SergeiPatiakin SergeiPatiakin merged commit e7008f3 into main Dec 4, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants