"ADDED" entry for files
parent
bb081057cf
commit
3cd3df27c0
|
@ -2,7 +2,7 @@ use std::borrow::Borrow;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::path::{Component, Path, PathBuf};
|
use std::path::{Component, Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
use std::time::{Instant, UNIX_EPOCH};
|
use std::time::{Instant, SystemTime, UNIX_EPOCH};
|
||||||
use std::{fs, iter};
|
use std::{fs, iter};
|
||||||
|
|
||||||
use crate::addressing::Address;
|
use crate::addressing::Address;
|
||||||
|
@ -410,6 +410,17 @@ fn insert_file_with_metadata(
|
||||||
value: EntryValue::String(mime_type),
|
value: EntryValue::String(mime_type),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let added_entry = Entry {
|
||||||
|
entity: Address::Hash(hash.clone()),
|
||||||
|
attribute: "ADDED".to_string(),
|
||||||
|
value: EntryValue::Number(
|
||||||
|
SystemTime::now()
|
||||||
|
.duration_since(UNIX_EPOCH)
|
||||||
|
.unwrap()
|
||||||
|
.as_secs() as f64,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
// Add the appropriate entries w/r/t virtual filesystem location
|
// Add the appropriate entries w/r/t virtual filesystem location
|
||||||
let components = normalized_path.components().collect::<Vec<Component>>();
|
let components = normalized_path.components().collect::<Vec<Component>>();
|
||||||
let (filename, dir_path) = components.split_last().unwrap();
|
let (filename, dir_path) = components.split_last().unwrap();
|
||||||
|
@ -433,6 +444,7 @@ fn insert_file_with_metadata(
|
||||||
|
|
||||||
connection.insert_entry_immutable(type_entry)?;
|
connection.insert_entry_immutable(type_entry)?;
|
||||||
connection.insert_entry_immutable(size_entry)?;
|
connection.insert_entry_immutable(size_entry)?;
|
||||||
|
connection.insert_entry_immutable(added_entry)?;
|
||||||
if let Some(mime_entry) = mime_entry {
|
if let Some(mime_entry) = mime_entry {
|
||||||
connection.insert_entry(mime_entry)?;
|
connection.insert_entry(mime_entry)?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue