-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update value linked relationship to support parent side auto connect #1125
Conversation
production/tools/gaia_db_extract/tests/test_gaia_db_extract.cpp
Outdated
Show resolved
Hide resolved
41ddb32
to
6bf534f
Compare
* (parent)-[first_child_offset]->(child) | ||
* (child)-[next_child_offset]->(child) | ||
* (child)-[parent_offset]->(parent) | ||
* A reference anchor chain will look like the following graph. |
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.
I'm missing something. I understand the need to the anchor node, but why do we now have previous_node link as well?
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.
Otherwise, deleting a child node can take O(n), as is the case right now. I have created an item to replace all chain with the anchor chain.
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.
So, in the future, all chains will be of the second type, or is there still a use case for this original approach?
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.
There are some trade-offs. I summarized in the JIRA item: https://gaiaplatform.atlassian.net/browse/GAIAPLAT-1769
Tengiz suggested to keep one chain (of the second type) from code maintenance point of view. I don't think he is firm on this. If we find good use cases of the first type, we can still make it available.
d04ff22
to
01d1c44
Compare
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.
I'm not the expert in all parts of this change, but I don't see any issues in the code I do understand. :)
gaia_type_t child_type, | ||
gaia_id_t* child_references, | ||
const uint8_t* child_payload) | ||
void gaia_ptr_t::auto_connect( |
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 method is quite large. Is there no opportunity here for pulling some of this code into some helper functions?
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.
I have divided the method into two: parent side and child side.
01d1c44
to
cd81bba
Compare
cd81bba
to
430bbc5
Compare
This change completes value linked relationship with parent side auto connection support. The reference chain structures are updated to support efficient connection and disconnection on both sides of a relationship. We added a middle node (called anchor node) between child linked list and their parent node. We also added a back link to each child node. This allows us to efficiently connect/disconnect parent node to a list of child nodes, as well as efficiently remove a single child from the list.
Previous manual connection methods like
connect
,disconnect
,insert
, anderase
are not available on the new reference chain as intended. I disabled some tests due to this.