From 58b3115afa62f9b7e0934196b51080a3b58b10d6 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Tue, 12 Dec 2023 14:56:26 +0000 Subject: [PATCH] rename VirtualFile::open_with_options{_async,} --- pageserver/src/tenant/ephemeral_file.rs | 2 +- pageserver/src/tenant/storage_layer/delta_layer.rs | 2 +- pageserver/src/tenant/storage_layer/image_layer.rs | 4 ++-- pageserver/src/virtual_file.rs | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pageserver/src/tenant/ephemeral_file.rs b/pageserver/src/tenant/ephemeral_file.rs index 7bea496398..8834fafd5d 100644 --- a/pageserver/src/tenant/ephemeral_file.rs +++ b/pageserver/src/tenant/ephemeral_file.rs @@ -47,7 +47,7 @@ impl EphemeralFile { let file = { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.read(true).write(true).create(true); - VirtualFile::open_with_options_async(&filename, options).await? + VirtualFile::open_with_options(&filename, options).await? }; Ok(EphemeralFile { diff --git a/pageserver/src/tenant/storage_layer/delta_layer.rs b/pageserver/src/tenant/storage_layer/delta_layer.rs index 2d6e0e93cc..301e452a6a 100644 --- a/pageserver/src/tenant/storage_layer/delta_layer.rs +++ b/pageserver/src/tenant/storage_layer/delta_layer.rs @@ -650,7 +650,7 @@ impl DeltaLayer { let file = { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.read(true).write(true); - VirtualFile::open_with_options_async(path, options) + VirtualFile::open_with_options(path, options) .await .with_context(|| format!("Failed to open file '{}'", path))? }; diff --git a/pageserver/src/tenant/storage_layer/image_layer.rs b/pageserver/src/tenant/storage_layer/image_layer.rs index 30b2d12036..c9ec81ced9 100644 --- a/pageserver/src/tenant/storage_layer/image_layer.rs +++ b/pageserver/src/tenant/storage_layer/image_layer.rs @@ -328,7 +328,7 @@ impl ImageLayer { let file = { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.read(true).write(true); - VirtualFile::open_with_options_async(path, options) + VirtualFile::open_with_options(path, options) .await .with_context(|| format!("Failed to open file '{}'", path))? }; @@ -496,7 +496,7 @@ impl ImageLayerWriterInner { let mut file = { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.write(true).create_new(true); - VirtualFile::open_with_options_async(&path, options).await? + VirtualFile::open_with_options(&path, options).await? }; // make room for the header block file.seek(SeekFrom::Start(PAGE_SZ as u64)).await?; diff --git a/pageserver/src/virtual_file.rs b/pageserver/src/virtual_file.rs index 21ee1806eb..a58fb52ed7 100644 --- a/pageserver/src/virtual_file.rs +++ b/pageserver/src/virtual_file.rs @@ -316,7 +316,7 @@ impl VirtualFile { pub async fn open(path: &Utf8Path) -> Result { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.read(true); - Self::open_with_options_async(path, options).await + Self::open_with_options(path, options).await } /// Create a new file for writing. If the file exists, it will be truncated. @@ -324,7 +324,7 @@ impl VirtualFile { pub async fn create(path: &Utf8Path) -> Result { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.write(true).create(true).truncate(true); - Self::open_with_options_async(path, options).await + Self::open_with_options(path, options).await } /// Writes a file to the specified `final_path` in a crash safe fasion @@ -351,7 +351,7 @@ impl VirtualFile { // Use `create_new` so that, if we race with ourselves or something else, // we bail out instead of causing damage. .create_new(true); - Self::open_with_options_async(tmp_path, options).await? + Self::open_with_options(tmp_path, options).await? }; file.write_all(content).await?; file.sync_all().await?; @@ -366,7 +366,7 @@ impl VirtualFile { let final_parent_dirfd = { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.read(true); - Self::open_with_options_async(final_path_parent, options).await? + Self::open_with_options(final_path_parent, options).await? }; final_parent_dirfd.sync_all().await?; Ok(()) @@ -377,7 +377,7 @@ impl VirtualFile { /// Note: If any custom flags were set in 'open_options' through OpenOptionsExt, /// they will be applied also when the file is subsequently re-opened, not only /// on the first time. Make sure that's sane! - pub async fn open_with_options_async( + pub async fn open_with_options( path: &Utf8Path, open_options: tokio_epoll_uring::ops::open_at::OpenOptions, ) -> Result { @@ -944,7 +944,7 @@ mod tests { // native files, you will run out of file descriptors if the ulimit // is low enough.) test_files("virtual_files", |path, open_options| async move { - let vf = VirtualFile::open_with_options_async(&path, open_options).await?; + let vf = VirtualFile::open_with_options(&path, open_options).await?; Ok(MaybeVirtualFile::VirtualFile(vf)) }) .await @@ -1109,7 +1109,7 @@ mod tests { // Open the file many times. let mut files = Vec::new(); for _ in 0..VIRTUAL_FILES { - let f = VirtualFile::open_with_options_async(&test_file_path, { + let f = VirtualFile::open_with_options(&test_file_path, { let mut options = tokio_epoll_uring::ops::open_at::OpenOptions::new(); options.read(true); options