This repository was archived by the owner on Apr 17, 2025. It is now read-only.
Feat: Extensible config (snapshots, mounting directories, and more) #367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My goal of this PR is to add extensible config to be used when getting and removing snapshots. On starting it, I determined it would also be nice to add a third disk option if a machine has it available. When looking at formatting and mounting drives, I saw there was an interest in sorting by type so I did a very soft check of the drive name to determine if it is an NVMe or not, and created a prioritized disk array. Added a default snapshot flag to startup scripts when creating a new validator, which will make subsequent fetching and removing snapshots more straightforward.
In this PR:
ensureMountAndFilesnow includes command to format and mount a potential third drive (snapshots).getLargestDiskupdated to prioritize NVMe first sorted by size, followed by SATA sorted by size.createSnapshotadds specified directory for archives from config (/mnt/ledger as default).getCommandsdefaults to config specification for ledger and snapshots.cli/get/snapshotuses default ledger and snapshot values, and adds rpcUrl to snapshot fetch.mountDirsenables three disks for formatting and mounting.rmSnapshotnow uses configured snapshots path (defaults /mnt/ledger).setupV2adds comments, passes config values intogetSnapshot.setup/validator/indexpasses config into setup scripts.configdirectory adds defaults for a snapshots directory, as well as adds snapshots, ledger, and accounts directory variables into default config type. Enum is added for triple disk configuration.removeSnapshotandcreateSnapshotadded a config parametervalidatorStartupfunctions take in a config parameter and use them for snapshots flag in addition to ledger and accounts.I could still probably add something that updates an existing config that does not have the additional parameters, but I tried to ensure if they don't have the latest config, default values that are aligned are passed in. In the snapshot finder command I found it interesting that the path was
/mnt/ledger/:/mnt/ledger/snapshot, from my understanding the singularsnapshotdirectory is used on fastboot/cluster restarts, while the pluralsnapshotsdirectory is the subfolder which is created and leveraged during runtime.Please feel free to ask questions, add comments, or point any improvements or additions you would like to see in this PR.