ALIAS points to LBL, not directly to value (!)
This commit is contained in:
parent
4822069fdf
commit
6b9e534270
1 changed files with 19 additions and 10 deletions
|
@ -391,27 +391,29 @@ fn insert_file_with_metadata(
|
|||
mtime,
|
||||
};
|
||||
|
||||
let blob_address = Address::Hash(hash);
|
||||
|
||||
// Metadata
|
||||
let type_entry = Entry {
|
||||
entity: Address::Hash(hash.clone()),
|
||||
entity: blob_address.clone(),
|
||||
attribute: String::from(IS_OF_TYPE_ATTR),
|
||||
value: EntryValue::Address(BLOB_TYPE_ADDR.clone()),
|
||||
};
|
||||
|
||||
let size_entry = Entry {
|
||||
entity: Address::Hash(hash.clone()),
|
||||
entity: blob_address.clone(),
|
||||
attribute: FILE_SIZE_KEY.to_string(),
|
||||
value: EntryValue::Number(size as f64),
|
||||
};
|
||||
|
||||
let mime_entry = mime_type.map(|mime_type| Entry {
|
||||
entity: Address::Hash(hash.clone()),
|
||||
entity: blob_address.clone(),
|
||||
attribute: FILE_MIME_KEY.to_string(),
|
||||
value: EntryValue::String(mime_type),
|
||||
});
|
||||
|
||||
let added_entry = Entry {
|
||||
entity: Address::Hash(hash.clone()),
|
||||
entity: blob_address.clone(),
|
||||
attribute: "ADDED".to_string(),
|
||||
value: EntryValue::Number(
|
||||
SystemTime::now()
|
||||
|
@ -454,18 +456,25 @@ fn insert_file_with_metadata(
|
|||
let dir_has_entry = Entry {
|
||||
entity: parent_dir.clone(),
|
||||
attribute: HIER_HAS_ATTR.to_string(),
|
||||
value: EntryValue::Address(Address::Hash(hash.clone())),
|
||||
value: EntryValue::Address(blob_address.clone()),
|
||||
};
|
||||
let dir_has_entry_addr = connection.insert_entry(dir_has_entry)?;
|
||||
|
||||
let name_entry = Entry {
|
||||
entity: dir_has_entry_addr,
|
||||
attribute: ALIAS_KEY.to_string(),
|
||||
let label_entry = Entry {
|
||||
entity: blob_address.clone(),
|
||||
attribute: LABEL_ATTR.to_string(),
|
||||
value: EntryValue::String(filename.as_os_str().to_string_lossy().to_string()),
|
||||
};
|
||||
connection.insert_entry(name_entry)?;
|
||||
let label_entry_addr = connection.insert_entry(label_entry)?;
|
||||
|
||||
Ok(Address::Hash(hash.clone()))
|
||||
let alias_entry = Entry {
|
||||
entity: dir_has_entry_addr,
|
||||
attribute: ALIAS_KEY.to_string(),
|
||||
value: EntryValue::Address(label_entry_addr),
|
||||
};
|
||||
connection.insert_entry(alias_entry)?;
|
||||
|
||||
Ok(blob_address)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue