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

Get links crud #1337

Merged
merged 78 commits into from
Jun 17, 2019
Merged

Get links crud #1337

merged 78 commits into from
Jun 17, 2019

Conversation

StaticallyTypedAnxiety
Copy link
Contributor

@StaticallyTypedAnxiety StaticallyTypedAnxiety commented Apr 26, 2019

PR summary

-This PR allows for obtaining crud information with the get_links. The crud information is implied from the link type and we can query this information based on LinkStatusRequestKind

  • a tuple of a link and crud_status was chosen for being able to reuse the crud_status as well as saving the space by also not serializing the name of the fields.

testing/benchmarking notes

Testing of this was implemented by modification and addition of app_spec and united tests.

followups

-One of the tests in the intergration suite uses a string which makes it hard to debug, we should switch to a struct.
-We should offset the querying of the link to the node end rather than the client. This would mean modifying some of the structs on the network side

Please check one of the following, relating to the CHANGELOG

  • [ x] this is a code change that effects some consumer (e.g. zome developers) of holochain core so there is an 'Unreleased' CHANGELOG item, with the format - summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)
  • this is not a code change, or doesn't effect anyone outside holochain core development

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.

Can you please check my comments below? I believe this code would return the headers of the link targets but not of the links, if I'm not mistaken.

core/src/workflows/get_link_result.rs Outdated Show resolved Hide resolved
core/src/workflows/get_link_result.rs Outdated Show resolved Hide resolved
core/src/workflows/get_link_result.rs Outdated Show resolved Hide resolved
@StaticallyTypedAnxiety StaticallyTypedAnxiety changed the title DONOTMERGE - Get links crud Get links crud Jun 13, 2019
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.

Cool!

@@ -150,7 +150,7 @@ pub enum Action {
/// Last string is the stringified process unique id of this `hdk::get_links` call.
GetLinks(GetLinksKey),
GetLinksTimeout(GetLinksKey),
RespondGetLinks((FetchMetaData, Vec<Address>)),
RespondGetLinks((FetchMetaData, Vec<(Address, CrudStatus)>)),
Copy link
Contributor

Choose a reason for hiding this comment

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

@AshantiMutinta Is a tuple future proof enough? Do you imagine other stuff getting associated with address here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for now it works because serialization will save space because no field name values. When it grows, should definitely use a struct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for now it works because serialization will save space because no field name values. When it grows, should definitely use a struct

use holochain_net::connection::json_protocol::{FetchMetaData, FetchMetaResultData, JsonProtocol};

/// Send back to network a HandleFetchMetaResult, no matter what.
/// Will return an empty content field if it actually doesn't have the data.
fn reduce_respond_get_links_inner(
network_state: &mut NetworkState,
get_dht_meta_data: &FetchMetaData,
links: &Vec<Address>,
links: &Vec<(Address, CrudStatus)>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to other comment, is a tuple good enough here for immediate future?

(links[0] == (entry_addresses[1].clone(), CrudStatus::Live)
|| links[0] == (entry_addresses[2].clone(), CrudStatus::Live))
&& (links[1] == (entry_addresses[1].clone(), CrudStatus::Live)
|| links[1] == (entry_addresses[2].clone(), CrudStatus::Live))
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is getting heavy. If it fails it would be probably be a pain to debug. I think it's outside the scope of your PR to fix it however.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it would be nice to break out in follow up pr

@StaticallyTypedAnxiety StaticallyTypedAnxiety merged commit 09d933b into develop Jun 17, 2019
@zippy zippy deleted the get-links-crud branch October 4, 2019 18:32
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.

4 participants