Revert to removing only tmp-
This commit is contained in:
parent
20b53eb4b4
commit
a5d144b00f
|
@ -44,7 +44,6 @@ const MAX_SNAPSHOT_DATA_FILE_SIZE: u64 = 32 * 1024 * 1024 * 1024; // 32 GiB
|
||||||
const VERSION_STRING_V1_2_0: &str = "1.2.0";
|
const VERSION_STRING_V1_2_0: &str = "1.2.0";
|
||||||
const DEFAULT_SNAPSHOT_VERSION: SnapshotVersion = SnapshotVersion::V1_2_0;
|
const DEFAULT_SNAPSHOT_VERSION: SnapshotVersion = SnapshotVersion::V1_2_0;
|
||||||
const TMP_SNAPSHOT_PREFIX: &str = "tmp-snapshot-";
|
const TMP_SNAPSHOT_PREFIX: &str = "tmp-snapshot-";
|
||||||
const TMP_SNAPSHOT_EXTENSION: &str = ".tmp"; // when downloading
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||||
pub enum SnapshotVersion {
|
pub enum SnapshotVersion {
|
||||||
|
@ -207,12 +206,11 @@ fn get_archive_ext(archive_format: ArchiveFormat) -> &'static str {
|
||||||
pub fn remove_tmp_snapshot_archives(snapshot_path: &Path) {
|
pub fn remove_tmp_snapshot_archives(snapshot_path: &Path) {
|
||||||
if let Ok(entries) = fs::read_dir(&snapshot_path) {
|
if let Ok(entries) = fs::read_dir(&snapshot_path) {
|
||||||
for entry in entries.filter_map(|entry| entry.ok()) {
|
for entry in entries.filter_map(|entry| entry.ok()) {
|
||||||
let filename = entry
|
if entry
|
||||||
.file_name()
|
.file_name()
|
||||||
.into_string()
|
.into_string()
|
||||||
.unwrap_or_else(|_| String::new());
|
.unwrap_or_else(|_| String::new())
|
||||||
if filename.starts_with(TMP_SNAPSHOT_PREFIX)
|
.starts_with(TMP_SNAPSHOT_PREFIX)
|
||||||
| filename.ends_with(TMP_SNAPSHOT_EXTENSION)
|
|
||||||
{
|
{
|
||||||
if entry.path().is_file() {
|
if entry.path().is_file() {
|
||||||
fs::remove_file(entry.path())
|
fs::remove_file(entry.path())
|
||||||
|
|
Loading…
Reference in New Issue