Skip to content

Commit 5568d85

Browse files
committed
f Remove per-write tmp files
1 parent df0dc34 commit 5568d85

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lightning-storage/src/fs_store.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use std::sync::{Arc, Mutex, RwLock};
1313
#[cfg(not(target_os = "windows"))]
1414
use std::os::unix::io::AsRawFd;
1515

16-
use rand::distributions::Alphanumeric;
17-
use rand::{thread_rng, Rng};
18-
1916
#[cfg(target_os = "windows")]
2017
use {std::ffi::OsStr, std::os::windows::ffi::OsStrExt};
2118

@@ -104,10 +101,7 @@ impl KVStore for FilesystemStore {
104101
// The way to atomically write a file on Unix platforms is:
105102
// open(tmpname), write(tmpfile), fsync(tmpfile), close(tmpfile), rename(), fsync(dir)
106103
let mut tmp_file_path = dest_file_path.clone();
107-
let mut rng = thread_rng();
108-
let rand_str: String = (0..7).map(|_| rng.sample(Alphanumeric) as char).collect();
109-
let ext = format!("{}.tmp", rand_str);
110-
tmp_file_path.set_extension(ext);
104+
tmp_file_path.set_extension("tmp");
111105

112106
{
113107
let mut tmp_file = fs::File::create(&tmp_file_path)?;

0 commit comments

Comments
 (0)