-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
cas_implementations/src/eav/file.rs
Outdated
@@ -90,6 +90,24 @@ impl EavFileStorage { | |||
Ok(()) | |||
} | |||
|
|||
fn delete_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I incorrect in thinking that the EAV was append only?
@lucksus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already synced in heartbeat and currently implementing eavindexing before this can get in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I see. Sorry to interrupt!
Do you mean that you are currently switched to implementing indexing the EAV before proceeding further with this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! Yes :) Deleting will simply be changing the hash to a new one which does not contain the data! Working on that right now
@AshantiMutinta for my documentation work, I'm trying to make sense of |
core_types/src/eav.rs
Outdated
.unwrap_or_else(|| { | ||
let latest = get_latest(e.clone(), map.clone()) | ||
let latest = get_latest(e.clone(), map.clone(), index_query.clone()) | ||
.unwrap_or(EntityAttributeValueIndex::default()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just write unwrap_or_default()
core/src/network/handler/store.rs
Outdated
) | ||
.expect("dht_meta_data should be EntryWithHader"); | ||
thread::spawn(move || { | ||
match context.block_on(remove_link_workflow(&entry_with_header, &context.clone())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make this much cleaner by using an if let
expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! I think I found it structured like this and just added to it. In imo it would be a good candidate for a refactor since we are trying to get this story in for the closed alpha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then again it's not so hard to refactor a little as we go when we see easy improvements that would take almost no time...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, let me change that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, I think this is ready to be merged finally :)
Just a tiny suggestion.
I do think though we should add some more tests where a link gets added, removed, added, removed, ... by different (more than two) agents...
Ok(filtered | ||
.into_iter() | ||
.filter(|eav| eav.attribute().starts_with("link__")) | ||
.collect()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, we clarified this per voice-chat yesterday. So fetch_eavi
only returns the latest version of potentially multiple EAVs that match the query. With the prefixes set in line 61, all EAVs where the attribute matches either link__<tag>
or removed_link_<tag>
are considered the same. If we get the latest of these each, it will be either a link__<tag>
or removed_link_<tag>
, depending on if the last action (for this specific link!) was an add or removal. So yes, if remove all those links for which the latest action is a removal we get exactly what we want.
And, this could get more documented and tested :)
Co-Authored-By: AshantiMutinta <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I have it marked as approved, but @AshantiMutinta please do fix the one typo. And also I'm wondering why there are read/excecute changes for the various scripts/install/*.sh files in this PR. They really should be being changed.
core/src/dht/dht_reducers.rs
Outdated
new_store.actions_mut().insert( | ||
action_wrapper.clone(), | ||
Err(HolochainError::ErrorGeneric(String::from( | ||
"Base for link not found for remov", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets fix this typo!
Hello! I think I am having some trouble with cargo fmt issues with it affecting my line endings. I will use notepad to remove them, also thanks, typo has been fixed |
This pull request makes it able to remove link from local
The files changed are this number because my cargo fmt adds windows line endings, so error on my part. Should be harmless!