Skip to content

Commit

Permalink
Operator getter
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeiPatiakin committed Dec 4, 2024
1 parent 9eaff9b commit e66ef22
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions crates/iceberg/src/io/file_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ impl OutputFile {
&self.path
}

/// Underlying OpenDAL operator.
pub fn operator(&self) -> &Operator {
&self.op
}

/// Checks if file exists.
pub async fn exists(&self) -> crate::Result<bool> {
Ok(self.op.exists(&self.path[self.relative_path_pos..]).await?)
Expand All @@ -344,16 +349,6 @@ 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<()> {
self.op
.write_with(&self.path[self.relative_path_pos..], bs)
.if_none_match("*")
.await?;
Ok(())
}

/// Creates output file for continues writing.
///
/// # Notes
Expand Down

0 comments on commit e66ef22

Please sign in to comment.