backup/datastore.rs: use single lazy_static block

This commit is contained in:
Dietmar Maurer 2019-01-24 14:58:47 +01:00
parent e6ffeb918c
commit 784252dbc5

View File

@ -167,14 +167,10 @@ impl DataStore {
let mut list = vec![];
lazy_static! {
static ref BACKUP_TYPE_REGEX: regex::Regex = regex::Regex::new("^(host|vm|ct)$").unwrap();
}
lazy_static! {
static ref BACKUP_ID_REGEX: regex::Regex = regex::Regex::new("^[A-Za-z][A-Za-z0-9_-]+$").unwrap();
}
lazy_static! {
static ref BACKUP_TYPE_REGEX: regex::Regex = regex::Regex::new(r"^(host|vm|ct)$").unwrap();
static ref BACKUP_ID_REGEX: regex::Regex = regex::Regex::new(r"^[A-Za-z][A-Za-z0-9_-]+$").unwrap();
static ref BACKUP_DATE_REGEX: regex::Regex = regex::Regex::new(
"^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$").unwrap();
r"^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$").unwrap();
}
tools::scandir(libc::AT_FDCWD, &path, &BACKUP_TYPE_REGEX, |l0_fd, backup_type, file_type| {