-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Add default() to SnapshotConfig #19776
Add default() to SnapshotConfig #19776
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19776 +/- ##
=========================================
- Coverage 82.5% 82.5% -0.1%
=========================================
Files 472 472
Lines 132587 132583 -4
=========================================
- Hits 109511 109491 -20
- Misses 23076 23092 +16 |
snapshot_utils::DEFAULT_FULL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS, | ||
incremental_snapshot_archive_interval_slots: | ||
snapshot_utils::DEFAULT_INCREMENTAL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS, | ||
snapshot_archives_dir: PathBuf::default(), |
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.
is this == snapshot_archives_dir: PathBuf::from("/"),?
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.
Good catch! No, it's basically an empty string, like String::new()
, which ends up being basically Vec::new()
.
In the rpc_service test that sets snapshot_archive_dir and bank_snapshots_dir to PathBuf::from("/")
, the values don't matter at all, just that SnapshotConfig is Some
and not None
.
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.
lgtm
This reverts commit 47bf811.
Problem
SnapshotConfig is about to get more parameters, and updating all its uses can be cumbersome. Adding default() simplifies future PRs.
Summary of Changes
Add default() to SnapshotConfig and then update all its uses.