cleanups: avoid compiler warnings
This commit is contained in:
parent
6c20a13d3c
commit
eae8aa3aa9
@ -17,7 +17,7 @@ pub struct ChunkStore {
|
||||
chunk_dir: PathBuf,
|
||||
hasher: Sha512Trunc256,
|
||||
mutex: Mutex<bool>,
|
||||
lockfile: File,
|
||||
_lockfile: File,
|
||||
}
|
||||
|
||||
const HEX_CHARS: &'static [u8; 16] = b"0123456789abcdef";
|
||||
@ -108,7 +108,7 @@ impl ChunkStore {
|
||||
base,
|
||||
chunk_dir,
|
||||
hasher: Sha512Trunc256::new(),
|
||||
lockfile,
|
||||
_lockfile: lockfile,
|
||||
mutex: Mutex::new(false)
|
||||
})
|
||||
}
|
||||
@ -133,10 +133,16 @@ impl ChunkStore {
|
||||
let now = unsafe { libc::time(std::ptr::null_mut()) };
|
||||
|
||||
for entry in handle.iter() {
|
||||
match entry {
|
||||
Ok(entry) => {
|
||||
if let Some(file_type) = entry.file_type() {
|
||||
if file_type == nix::dir::Type::File {
|
||||
let entry = match entry {
|
||||
Ok(entry) => entry,
|
||||
Err(_) => continue /* ignore */,
|
||||
};
|
||||
let file_type = match entry.file_type() {
|
||||
Some(file_type) => file_type,
|
||||
None => continue,
|
||||
};
|
||||
if file_type != nix::dir::Type::File { continue; }
|
||||
|
||||
let filename = entry.file_name();
|
||||
if let Ok(stat) = nix::sys::stat::fstatat(rawfd, filename, nix::fcntl::AtFlags::AT_SYMLINK_NOFOLLOW) {
|
||||
let age = now - stat.st_atime;
|
||||
@ -148,14 +154,6 @@ impl ChunkStore {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
// fixme ??
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub fn sweep_used_chunks(&mut self) -> Result<(), Error> {
|
||||
|
||||
@ -163,7 +161,7 @@ impl ChunkStore {
|
||||
use nix::sys::stat::Mode;
|
||||
use nix::dir::Dir;
|
||||
|
||||
let mut base_handle = match Dir::open(
|
||||
let base_handle = match Dir::open(
|
||||
&self.chunk_dir, OFlag::O_RDONLY, Mode::empty()) {
|
||||
Ok(h) => h,
|
||||
Err(err) => bail!("unable to open base chunk dir {:?} - {}", self.chunk_dir, err),
|
||||
|
@ -7,12 +7,12 @@ use apitest::tools;
|
||||
use apitest::cli::command::*;
|
||||
use apitest::api::schema::*;
|
||||
use apitest::api::router::*;
|
||||
use apitest::backup::chunk_store::*;
|
||||
use apitest::backup::image_index::*;
|
||||
//use apitest::backup::chunk_store::*;
|
||||
//use apitest::backup::image_index::*;
|
||||
//use apitest::config::datastore;
|
||||
use apitest::backup::datastore::*;
|
||||
use serde_json::{Value};
|
||||
|
||||
use apitest::config::datastore;
|
||||
|
||||
fn required_string_param<'a>(param: &'a Value, name: &str) -> &'a str {
|
||||
param[name].as_str().expect(&format!("missing parameter '{}'", name))
|
||||
|
@ -9,7 +9,7 @@ use std::io::Read;
|
||||
use std::io::ErrorKind;
|
||||
use std::time::Duration;
|
||||
|
||||
use std::os::unix::io::{RawFd, AsRawFd};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
|
||||
pub mod timer;
|
||||
|
||||
@ -173,5 +173,4 @@ pub fn file_chunker<C, R>(
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user