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: add --diff flag to archive export #3284

Merged
merged 14 commits into from
Jul 31, 2023
Merged

feat: add --diff flag to archive export #3284

merged 14 commits into from
Jul 31, 2023

Conversation

lemmih
Copy link
Contributor

@lemmih lemmih commented Jul 27, 2023

Summary of changes

Changes introduced in this pull request:

  • add --diff flag for exporting the set difference of two snapshots.

Reference issue to close (if applicable)

Closes #3204

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@lemmih lemmih marked this pull request as ready for review July 31, 2023 05:32
@lemmih lemmih requested a review from a team as a code owner July 31, 2023 05:32
@lemmih lemmih requested review from hanabi1224 and aatifsyed and removed request for a team July 31, 2023 05:32
}
}

pub fn stream_graph<DB: Blockstore, T: Iterator<Item = Tipset> + Unpin>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Any way to indicate fail_on_dead_links: false in the function name or doc? e.g. stream_graph_unstrict

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've updated the documentation of both stream_graph and stream_chain.

@@ -69,6 +72,9 @@ pub enum ArchiveCommands {
/// How many state-roots to include. Lower limit is 900 for `calibnet` and `mainnet`.
#[arg(short, long, default_value_t = 2000)]
depth: ChainEpochDelta,
/// Do not include any values reachable from this epoch
#[arg(short, long)]
diff: Option<ChainEpochDelta>,
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit confusing, doc says epoch while code says epoch delta

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to epoch-diff.

.context("diff epoch must be smaller than target epoch")?;
let diff_ts: &Tipset = &diff_ts;
let mut stream = stream_graph(&store, diff_ts.clone().chain(&store));
while stream.try_next().await?.is_some() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to warn in into_seen when the stream is not fully consumed or move stream consuming logic into into_seen?

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 don't always want to consume the entire stream.

@lemmih lemmih added this pull request to the merge queue Jul 31, 2023
Merged via the queue into main with commit 25be5be Jul 31, 2023
20 checks passed
@lemmih lemmih deleted the lemmih/export-diff-car branch July 31, 2023 08:23
sudo-shashank pushed a commit that referenced this pull request Aug 3, 2023
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.

forest-cli archive export --epoch=X --diff=Y
3 participants