Skip to content

Commit 3cedfe1

Browse files
committed
rename to delete_prefix
1 parent b5ae637 commit 3cedfe1

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

crates/iceberg/src/io/file_io.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ impl FileIO {
106106
/// - If the path is a file or not exist, this function will be no-op.
107107
/// - If the path is a empty directory, this function will remove the directory itself.
108108
/// - If the path is a non-empty directory, this function will remove the directory and all nested files and directories.
109-
pub async fn remove_dir_all(&self, path: impl AsRef<str>) -> Result<()> {
110-
self.inner.remove_dir_all(path.as_ref()).await
109+
pub async fn delete_prefix(&self, path: impl AsRef<str>) -> Result<()> {
110+
self.inner.delete_prefix(path.as_ref()).await
111111
}
112112

113113
/// Check file exists.
@@ -594,7 +594,7 @@ mod tests {
594594
Ok(())
595595
}
596596

597-
async fn remove_dir_all(&self, _path: &str) -> Result<()> {
597+
async fn delete_prefix(&self, _path: &str) -> Result<()> {
598598
Ok(())
599599
}
600600

@@ -692,14 +692,14 @@ mod tests {
692692
assert!(file_io.exists(&a_path).await.unwrap());
693693

694694
// Remove a file should be no-op.
695-
file_io.remove_dir_all(&a_path).await.unwrap();
695+
file_io.delete_prefix(&a_path).await.unwrap();
696696
assert!(file_io.exists(&a_path).await.unwrap());
697697

698698
// Remove a not exist dir should be no-op.
699-
file_io.remove_dir_all("not_exists/").await.unwrap();
699+
file_io.delete_prefix("not_exists/").await.unwrap();
700700

701701
// Remove a dir should remove all files in it.
702-
file_io.remove_dir_all(&sub_dir_path).await.unwrap();
702+
file_io.delete_prefix(&sub_dir_path).await.unwrap();
703703
assert!(!file_io.exists(&b_path).await.unwrap());
704704
assert!(!file_io.exists(&c_path).await.unwrap());
705705
assert!(file_io.exists(&a_path).await.unwrap());
@@ -718,7 +718,7 @@ mod tests {
718718
let file_io = create_local_file_io();
719719
assert!(!file_io.exists(&full_path).await.unwrap());
720720
assert!(file_io.delete(&full_path).await.is_ok());
721-
assert!(file_io.remove_dir_all(&full_path).await.is_ok());
721+
assert!(file_io.delete_prefix(&full_path).await.is_ok());
722722
}
723723

724724
#[tokio::test]

crates/iceberg/src/io/storage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ pub trait Storage: Debug + Send + Sync {
7777
/// Delete a file at the given path
7878
async fn delete(&self, path: &str) -> Result<()>;
7979

80-
/// Remove a directory and all its contents recursively
81-
async fn remove_dir_all(&self, path: &str) -> Result<()>;
80+
/// Delete all files with the given prefix
81+
async fn delete_prefix(&self, path: &str) -> Result<()>;
8282

8383
/// Create a new input file for reading
8484
fn new_input(&self, path: &str) -> Result<InputFile>;

crates/iceberg/src/io/storage_azdls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ impl Storage for OpenDALAzdlsStorage {
668668
Ok(op.delete(relative_path).await?)
669669
}
670670

671-
async fn remove_dir_all(&self, path: &str) -> Result<()> {
671+
async fn delete_prefix(&self, path: &str) -> Result<()> {
672672
let (op, relative_path) = self.create_operator(path)?;
673673
let path = if relative_path.ends_with('/') {
674674
relative_path.to_string()

crates/iceberg/src/io/storage_fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl Storage for OpenDALFsStorage {
102102
Ok(op.delete(relative_path).await?)
103103
}
104104

105-
async fn remove_dir_all(&self, path: &str) -> Result<()> {
105+
async fn delete_prefix(&self, path: &str) -> Result<()> {
106106
let relative_path = self.extract_relative_path(path);
107107
let op = fs_config_build()?;
108108
let path = if relative_path.ends_with('/') {

crates/iceberg/src/io/storage_gcs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl Storage for OpenDALGcsStorage {
180180
Ok(op.delete(relative_path).await?)
181181
}
182182

183-
async fn remove_dir_all(&self, path: &str) -> Result<()> {
183+
async fn delete_prefix(&self, path: &str) -> Result<()> {
184184
let (op, relative_path) = self.create_operator(path)?;
185185
let path = if relative_path.ends_with('/') {
186186
relative_path.to_string()

crates/iceberg/src/io/storage_memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl Storage for OpenDALMemoryStorage {
120120
Ok(op.delete(relative_path).await?)
121121
}
122122

123-
async fn remove_dir_all(&self, path: &str) -> Result<()> {
123+
async fn delete_prefix(&self, path: &str) -> Result<()> {
124124
let op = self.get_operator()?;
125125
let relative_path = self.extract_relative_path(path);
126126
let path = if relative_path.ends_with('/') {

crates/iceberg/src/io/storage_oss.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl Storage for OpenDALOssStorage {
140140
Ok(op.delete(relative_path).await?)
141141
}
142142

143-
async fn remove_dir_all(&self, path: &str) -> Result<()> {
143+
async fn delete_prefix(&self, path: &str) -> Result<()> {
144144
let (op, relative_path) = self.create_operator(path)?;
145145
let path = if relative_path.ends_with('/') {
146146
relative_path.to_string()

crates/iceberg/src/io/storage_s3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl Storage for OpenDALS3Storage {
308308
Ok(op.delete(relative_path).await?)
309309
}
310310

311-
async fn remove_dir_all(&self, path: &str) -> Result<()> {
311+
async fn delete_prefix(&self, path: &str) -> Result<()> {
312312
let (op, relative_path) = self.create_operator(path)?;
313313
let path = if relative_path.ends_with('/') {
314314
relative_path.to_string()

0 commit comments

Comments
 (0)