Skip to content

Commit

Permalink
Merge branch 'no_last_slice'
Browse files Browse the repository at this point in the history
  • Loading branch information
Edrusb committed Jul 13, 2024
2 parents 09fcb50 + ab911aa commit 542f1e1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/build/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ from 2.7.x to 2.8.0
from 2.7.15 to 2.7.16
- fixed mask building of path exclusion (dar's -P option) when used with
regular expression (problem met while testing or merging a backup)
- adding support for progressive report to reparing operation at API level

from 2.7.14 to 2.7.15
- updating libdar about CURLINFO_CONTENT_LENGTH_DOWNLOAD symbol which is
Expand Down
6 changes: 4 additions & 2 deletions src/libdar/archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ namespace libdar
const path & chem_dst,
const string & basename_dst,
const string & extension_dst,
const archive_options_repair & options_repair)
const archive_options_repair & options_repair,
statistics * progressive_report)
{
NLS_SWAP_IN;
try
Expand All @@ -149,7 +150,8 @@ namespace libdar
chem_dst,
basename_dst,
extension_dst,
options_repair));
options_repair,
progressive_report));
if(!pimpl)
throw Ememory("archive::archive");
}
Expand Down
4 changes: 3 additions & 1 deletion src/libdar/archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ namespace libdar
/// \param[in] basename_dst the slices basename of the repaired archive
/// \param[in] extension_dst the slices extension of the repaired archive
/// \param[in] options_repair the set of option to use to write the repaired archive
/// \param[out] progressive_report statistics about the operation, considering the treated files (nullptr can be given if you don't want to use this feature)
/// \note the statistics fieds used are the same as the ones used for archive creation,
/// though no entry should be ignored as no file or path filtering exists for this
/// operation, and no skipped or tooold should increase as no comparison is performed to an existing
Expand All @@ -162,7 +163,8 @@ namespace libdar
const path & chem_dst,
const std::string & basename_dst,
const std::string & extension_dst,
const archive_options_repair & options_repair);
const archive_options_repair & options_repair,
statistics* progressive_report = nullptr); ///< nullptr given for backward compatibility


/// copy constructor (not implemented, throw an exception if called explicitely or implicitely)
Expand Down
6 changes: 3 additions & 3 deletions src/libdar/i_archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,11 +801,11 @@ namespace libdar
const path & chem_dst,
const string & basename_dst,
const string & extension_dst,
const archive_options_repair & options_repair): mem_ui(dialog)
const archive_options_repair & options_repair,
statistics* progressive_report): mem_ui(dialog)
{
archive_options_read my_options_read = options_read;
bool initial_pause = (*options_read.get_entrepot() == *options_repair.get_entrepot() && chem_src == chem_dst);
statistics not_filled;

////
// initializing object fields
Expand Down Expand Up @@ -930,7 +930,7 @@ namespace libdar
src.pimpl->ver.get_kdf_hash(),
delta_sig_block_size(), // sig block size is not used for repairing, build_delta_sig is set to false above
false, // this has not importance as we keep data compressed
&not_filled); // statistics
progressive_report); // statistics

// stealing src's catalogue, our's is still empty at this step
catalogue *tmp = cat;
Expand Down
17 changes: 9 additions & 8 deletions src/libdar/i_archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ namespace libdar
/// this constructor create a new archive from a damaged one [this is the "repair" constructor]

i_archive(const std::shared_ptr<user_interaction> & dialog,
const path & chem_src,
const std::string & basename_src,
const std::string & extension_src,
const archive_options_read & options_read,
const path & chem_dst,
const std::string & basename_dst,
const std::string & extension_dst,
const archive_options_repair & options_repair);
const path & chem_src,
const std::string & basename_src,
const std::string & extension_src,
const archive_options_read & options_read,
const path & chem_dst,
const std::string & basename_dst,
const std::string & extension_dst,
const archive_options_repair & options_repair,
statistics * progressive_report);

/// copy constructor (not implemented, throw an exception if called explicitely or implicitely)

Expand Down
32 changes: 31 additions & 1 deletion src/python/pybind11_libdar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,22 @@ PYBIND11_MODULE(libdar, mod)
const libdar::archive_options_merge & options):
libdar::archive(dialog, sauv_path, ref_arch1, filename, extension, options, nullptr) {};

// first repair with progressive report
py_archive(const std::shared_ptr<libdar::user_interaction> & dialog,
const libdar::path & chem_src,
const std::string & basename_src,
const std::string & extension_src,
const libdar::archive_options_read & options_read,
const libdar::path & chem_dst,
const std::string & basename_dst,
const std::string & extension_dst,
const libdar::archive_options_repair & options_repair,
std::shared_ptr<libdar::statistics> progressive_report):
libdar::archive(dialog, chem_src, basename_src, extension_src, options_read,
chem_dst, basename_dst, extension_dst, options_repair,
progressive_report.get()) {};

// second without progressive report
py_archive(const std::shared_ptr<libdar::user_interaction> & dialog,
const libdar::path & chem_src,
const std::string & basename_src,
Expand All @@ -1828,7 +1844,8 @@ PYBIND11_MODULE(libdar, mod)
const std::string & extension_dst,
const libdar::archive_options_repair & options_repair):
libdar::archive(dialog, chem_src, basename_src, extension_src, options_read,
chem_dst, basename_dst, extension_dst, options_repair) {};
chem_dst, basename_dst, extension_dst, options_repair,
nullptr) {};

libdar::statistics op_extract(const libdar::path & fs_root,
const libdar::archive_options_extract & options,
Expand Down Expand Up @@ -1910,6 +1927,19 @@ PYBIND11_MODULE(libdar, mod)
const std::string &,
const libdar::archive_options_repair &
>())
.def(pybind11::init<
const std::shared_ptr<libdar::user_interaction> &,
const libdar::path &,
const std::string &,
const std::string &,
const libdar::archive_options_read &,
const libdar::path &,
const std::string &,
const std::string &,
const libdar::archive_options_repair &,
std::shared_ptr<libdar::statistics>
>())


.def("op_extract", (libdar::statistics (py_archive::*)(const libdar::path &, const libdar::archive_options_extract &)) &py_archive::op_extract)
.def("op_extract", (libdar::statistics (py_archive::*)(const libdar::path &, const libdar::archive_options_extract &, std::shared_ptr<libdar::statistics>)) &py_archive::op_extract)
Expand Down

0 comments on commit 542f1e1

Please sign in to comment.