-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move dump functionality to rustic_core
- Loading branch information
Showing
5 changed files
with
55 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod cat; | ||
pub mod check; | ||
pub mod dump; | ||
pub mod forget; | ||
pub mod prune; | ||
pub mod repoinfo; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::io::Write; | ||
|
||
use crate::{ | ||
error::CommandErrorKind, repository::IndexedRepository, BlobType, IndexedBackend, Node, | ||
NodeType, RusticResult, | ||
}; | ||
|
||
pub(crate) fn dump<P>( | ||
repo: &IndexedRepository<P>, | ||
node: &Node, | ||
w: &mut impl Write, | ||
) -> RusticResult<()> { | ||
if node.node_type != NodeType::File { | ||
return Err(CommandErrorKind::DumpNotSupported(node.node_type.clone()).into()); | ||
} | ||
|
||
for id in node.content.as_ref().unwrap() { | ||
// TODO: cache blobs which are needed later | ||
let data = repo.index.blob_from_backend(BlobType::Data, id)?; | ||
w.write_all(&data)?; | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters