Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Remove Link #780

Merged
merged 180 commits into from
Feb 12, 2019
Merged

Remove Link #780

merged 180 commits into from
Feb 12, 2019

Conversation

StaticallyTypedAnxiety
Copy link
Contributor

@StaticallyTypedAnxiety StaticallyTypedAnxiety commented Dec 19, 2018

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!

@@ -90,6 +90,24 @@ impl EavFileStorage {
Ok(())
}

fn delete_file(
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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

@Connoropolous
Copy link
Collaborator

@AshantiMutinta for my documentation work, I'm trying to make sense of
https://github.com/holochain/holochain-rust/blob/develop/core_types/src/link/link_add.rs
would you take a look at it, in relation to the work that you're doing? And let me know if you can make sense of how they relate?
It looks like LinkAdd has an action_kind, which doesn't make sense to me

.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());
Copy link
Contributor

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()

)
.expect("dht_meta_data should be EntryWithHader");
thread::spawn(move || {
match context.block_on(remove_link_workflow(&entry_with_header, &context.clone())) {
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Collaborator

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...

Copy link
Contributor Author

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

Copy link
Collaborator

@lucksus lucksus left a 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...

app_spec/test/test.js Outdated Show resolved Hide resolved
Ok(filtered
.into_iter()
.filter(|eav| eav.attribute().starts_with("link__"))
.collect())
Copy link
Collaborator

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]>
Copy link
Member

@zippy zippy left a 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.

new_store.actions_mut().insert(
action_wrapper.clone(),
Err(HolochainError::ErrorGeneric(String::from(
"Base for link not found for remov",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets fix this typo!

core/src/nucleus/ribosome/api/mod.rs Show resolved Hide resolved
@StaticallyTypedAnxiety
Copy link
Contributor Author

e 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.

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

@StaticallyTypedAnxiety StaticallyTypedAnxiety merged commit 574724e into develop Feb 12, 2019
@maackle maackle mentioned this pull request Feb 16, 2019
1 task
@zippy zippy deleted the remove_link branch July 4, 2019 19:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants