fix: actually remove objects on rescan
This commit is contained in:
parent
5a6390e8f3
commit
3b4378dfed
2 changed files with 13 additions and 3 deletions
|
@ -49,3 +49,9 @@ pub struct NewFile {
|
||||||
pub size: i64,
|
pub size: i64,
|
||||||
pub mtime: Option<NaiveDateTime>,
|
pub mtime: Option<NaiveDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<File> for crate::addressing::Address {
|
||||||
|
fn from(file: File) -> Self {
|
||||||
|
crate::addressing::Address::Hash(file.hash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ use chrono::prelude::*;
|
||||||
use diesel::r2d2::{self, ConnectionManager};
|
use diesel::r2d2::{self, ConnectionManager};
|
||||||
use diesel::ExpressionMethods;
|
use diesel::ExpressionMethods;
|
||||||
use diesel::{Connection, QueryDsl, RunQueryDsl, SqliteConnection};
|
use diesel::{Connection, QueryDsl, RunQueryDsl, SqliteConnection};
|
||||||
use log::{debug, error, info, warn, trace};
|
use log::{debug, error, info, trace, warn};
|
||||||
use lru::LruCache;
|
use lru::LruCache;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
@ -216,7 +216,7 @@ impl FsStore {
|
||||||
let cleanup_results = existing_files.iter().filter(|f| f.valid).map(|file| {
|
let cleanup_results = existing_files.iter().filter(|f| f.valid).map(|file| {
|
||||||
let trans_result = upconnection.transaction::<_, Error, _>(|| {
|
let trans_result = upconnection.transaction::<_, Error, _>(|| {
|
||||||
self.file_set_valid(file.id, false)?;
|
self.file_set_valid(file.id, false)?;
|
||||||
// remove_object(&connection, )?
|
upconnection.remove_object(Address::from(file.clone()))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -682,7 +682,11 @@ impl UpStore for FsStore {
|
||||||
mut job_container: JobContainer,
|
mut job_container: JobContainer,
|
||||||
initial: bool,
|
initial: bool,
|
||||||
) -> Result<Vec<UpdatePathOutcome>, StoreError> {
|
) -> Result<Vec<UpdatePathOutcome>, StoreError> {
|
||||||
trace!("Running a vault update of {:?}, initial = {}.", self.path, initial);
|
trace!(
|
||||||
|
"Running a vault update of {:?}, initial = {}.",
|
||||||
|
self.path,
|
||||||
|
initial
|
||||||
|
);
|
||||||
let job_result = job_container.add_job("REIMPORT", "Scaning vault directory...");
|
let job_result = job_container.add_job("REIMPORT", "Scaning vault directory...");
|
||||||
|
|
||||||
match job_result {
|
match job_result {
|
||||||
|
|
Loading…
Reference in a new issue