-
Notifications
You must be signed in to change notification settings - Fork 197
fix: refactor forest-cli snapshot command #7252
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
base: main
Are you sure you want to change the base?
Changes from all commits
52594de
63adf1c
29bbd0c
2e1bffd
0ba9a6b
bc627d6
6b9d6f1
f22e428
7272c20
941f6c3
14449bd
6117343
aae3f19
c61d596
bc7eb69
95be6ed
7553351
4bb38c2
48429ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ use integer_encoding::VarIntReader; | |
| use nunny::Vec as NonEmpty; | ||
| use positioned_io::{Cursor, ReadAt, Size as _, SizeCursor}; | ||
| use std::io::{self, Read, Seek, SeekFrom, Write}; | ||
| use std::path::Path; | ||
| use std::path::{Path, PathBuf}; | ||
| use std::sync::OnceLock; | ||
| use std::task::Poll; | ||
| use std::time::Duration; | ||
|
|
@@ -508,6 +508,18 @@ pub fn new_forest_car_temp_path_in( | |
| .into_temp_path()) | ||
| } | ||
|
|
||
| pub fn tmp_exporting_forest_car_path(output_path: &Path) -> PathBuf { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: let's add a simple test here. The code is kind of obvious but obvious things managed to bite us in the past. Plus, we want coverage to be high. |
||
| let mut p = output_path.to_owned(); | ||
| p.add_extension("tmp"); | ||
| p | ||
| } | ||
|
|
||
| pub fn forest_car_sha256sum_path(output_path: &Path) -> PathBuf { | ||
| let mut p = output_path.to_owned(); | ||
| p.add_extension("sha256sum"); | ||
| p | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,10 @@ impl ChainExportGuard { | |
|
|
||
| impl Drop for ChainExportGuard { | ||
| fn drop(&mut self) { | ||
| // In case some tasks are waiting on this token | ||
| if !self.cancellation_token.is_cancelled() { | ||
| self.cancellation_token.cancel(); | ||
| } | ||
|
Comment on lines
+90
to
+92
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to check if it's cancelled? Might be a TOCTOU issue |
||
| end_export() | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.