Skip to content

Commit

Permalink
update docs with new opt parameters
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Oct 7, 2024
1 parent c8707e6 commit 2c73041
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
2 changes: 2 additions & 0 deletions crates/core/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ pub struct CheckOptions {
/// # Arguments
///
/// * `repo` - The repository to check
/// * `opts` - The check options to use
/// * `trees` - The trees to check
///
/// # Errors
///
Expand Down
27 changes: 15 additions & 12 deletions crates/core/src/commands/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ pub struct KeyOptions {
///
/// # Type Parameters
///
/// * `P` - The progress bar type.
/// * `S` - The state the repository is in.
/// * `P` - The progress bar type
/// * `S` - The state the repository is in
///
/// # Arguments
///
/// * `repo` - The repository to add the key to.
/// * `pass` - The password to encrypt the key with.
/// * `repo` - The repository to add the key to
/// * `opts` - The key options to use
/// * `pass` - The password to encrypt the key with
///
/// # Errors
///
/// * [`CommandErrorKind::FromJsonError`] - If the key could not be serialized.
/// * [`CommandErrorKind::FromJsonError`] - If the key could not be serialized
///
/// # Returns
///
Expand All @@ -62,13 +63,14 @@ pub(crate) fn add_current_key_to_repo<P, S: Open>(
///
/// # Type Parameters
///
/// * `P` - The progress bar type.
/// * `S` - The state the repository is in.
/// * `P` - The progress bar type
/// * `S` - The state the repository is in
///
/// # Arguments
///
/// * `repo` - The repository to add the key to.
/// * `pass` - The password to encrypt the key with.
/// * `repo` - The repository to add the key to
/// * `opts` - The key options to use
/// * `pass` - The password to encrypt the key with
///
/// # Returns
///
Expand All @@ -87,9 +89,10 @@ pub(crate) fn init_key<P, S>(
///
/// # Arguments
///
/// * `repo` - The repository to add the key to.
/// * `pass` - The password to encrypt the key with.
/// * `key` - The key to add.
/// * `repo` - The repository to add the key to
/// * `opts` - The key options to use
/// * `pass` - The password to encrypt the key with
/// * `key` - The key to add
///
/// # Errors
///
Expand Down
8 changes: 5 additions & 3 deletions crates/core/src/commands/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,13 @@ impl PrunePlan {
///
/// # Type Parameters
///
/// * `P` - The progress bar type.
/// * `S` - The state the repository is in.
/// * `P` - The progress bar type
/// * `S` - The state the repository is in
///
/// # Arguments
///
/// * `repo` - The repository to get the `PrunePlan` for.
/// * `repo` - The repository to get the `PrunePlan` for
/// * `opts` - The `PruneOptions` to use
///
/// # Errors
///
Expand Down Expand Up @@ -1165,6 +1166,7 @@ impl PrunePlan {
///
/// * `repo` - The repository to prune
/// * `opts` - The options for the pruning
/// * `prune_plan` - The plan for the pruning
///
/// # Errors
///
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/commands/repair/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ pub(crate) struct RepairState {
/// # Arguments
///
/// * `repo` - The repository to repair
/// * `opts` - The repair options to use
/// * `snapshots` - The snapshots to repair
/// * `dry_run` - Whether to actually modify the repository or just print what would be done
pub(crate) fn repair_snapshots<P: ProgressBars, S: IndexedFull>(
Expand Down Expand Up @@ -179,6 +180,7 @@ pub(crate) fn repair_snapshots<P: ProgressBars, S: IndexedFull>(
/// # Arguments
///
/// * `be` - The backend to use
/// * `opts` - The repair options to use
/// * `packer` - The packer to use
/// * `id` - The id of the tree to repair
/// * `replaced` - A map of already replaced trees
Expand Down
33 changes: 18 additions & 15 deletions crates/core/src/commands/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ pub struct RestoreStats {
///
/// # Type Parameters
///
/// * `P` - The progress bar type.
/// * `S` - The type of the indexed tree.
/// * `P` - The progress bar type
/// * `S` - The type of the indexed tree
///
/// # Arguments
///
/// * `file_infos` - The restore information.
/// * `repo` - The repository to restore.
/// * `node_streamer` - The node streamer to use.
/// * `dest` - The destination to restore to.
/// * `file_infos` - The restore information
/// * `repo` - The repository to restore
/// * `opts` - The restore options
/// * `node_streamer` - The node streamer to use
/// * `dest` - The destination to restore to
///
/// # Errors
///
Expand Down Expand Up @@ -329,8 +330,9 @@ pub(crate) fn collect_and_prepare<P: ProgressBars, S: IndexedFull>(
///
/// # Arguments
///
/// * `node_streamer` - The node streamer to use.
/// * `dest` - The destination to restore to.
/// * `node_streamer` - The node streamer to use
/// * `opts` - The restore options to use
/// * `dest` - The destination to restore to
///
/// # Errors
///
Expand All @@ -350,18 +352,18 @@ fn restore_metadata(
break;
}
let (path, node) = dir_stack.pop().unwrap();
set_metadata(opts, dest, &path, &node);
set_metadata(dest, opts, &path, &node);
}
// push current path to the stack
dir_stack.push((path, node));
}
_ => set_metadata(opts, dest, &path, &node),
_ => set_metadata(dest, opts, &path, &node),
}
}

// empty dir stack and set metadata
for (path, node) in dir_stack.into_iter().rev() {
set_metadata(opts, dest, &path, &node);
set_metadata(dest, opts, &path, &node);
}

Ok(())
Expand All @@ -371,17 +373,18 @@ fn restore_metadata(
///
/// # Arguments
///
/// * `dest` - The destination to restore to.
/// * `path` - The path of the file or directory.
/// * `node` - The node information of the file or directory.
/// * `dest` - The destination to restore to
/// * `opts` - The restore options to use
/// * `path` - The path of the file or directory
/// * `node` - The node information of the file or directory
///
/// # Errors
///
/// If the metadata could not be set.
// TODO: Return a result here, introduce errors and get rid of logging.
pub(crate) fn set_metadata(
opts: RestoreOptions,
dest: &LocalDestination,
opts: RestoreOptions,
path: &PathBuf,
node: &Node,
) {
Expand Down

0 comments on commit 2c73041

Please sign in to comment.