Skip to content
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

feat: dangling node detection for graph.Memory #652

Closed
wants to merge 4 commits into from

Conversation

wangxiaoxuan273
Copy link
Contributor

@wangxiaoxuan273 wangxiaoxuan273 commented Nov 29, 2023

Part of #472

This PR:

  1. Adds doc for fields of graph.Memory
  2. Makes graph.Memory.Remove() return dangling successors

This draft PR is followed by #653, which implements recursive GC on oci.Store.

Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (79a08b4) 75.23% compared to head (38fd16c) 75.32%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #652      +/-   ##
==========================================
+ Coverage   75.23%   75.32%   +0.08%     
==========================================
  Files          59       59              
  Lines        5480     5487       +7     
==========================================
+ Hits         4123     4133      +10     
+ Misses       1001      999       -2     
+ Partials      356      355       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Copy link
Contributor

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

Hi!

Thank you for this PR, I think this is a first good step toward "chain deleting".
I just have one minor comment, otherwise the code looks fine.

Best regards.

key := descriptor.FromOCI(desc)
_, existsInMemory := m.nodes[key]
_, existsInPredecessors := m.predecessors[key]
return existsInMemory && !existsInPredecessors
Copy link
Contributor

Choose a reason for hiding this comment

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

At a first glance, I missed the !.
I would add a comment stating: "a node is dangling if present in memory without any predecessor", e.g.:
A (root) -> B -> C
D -> E
D is dangling 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.

Good catch. Added the doc comment. A public function should always has doc comments.

Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
@wangxiaoxuan273
Copy link
Contributor Author

close this PR as its content is contained in #653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants