| Disk ARchive 2.8.3 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
libdar::database Class Reference
API

the database class defines the dar_manager database More...

`#include <database.hpp>`

## Classes
class | i_database
| the class i_database is the implementation of class database More...

## Public Member Functions
| database (const std::shared_ptr< user_interaction > &dialog)
| this constructor build an empty database
| database (const std::shared_ptr< user_interaction > &dialog, const std::string &base, const database_open_options &opt)
| this constructor reads database from a file
| database (const database &ref)=delete
| disabling copy constructor
| database (database &&ref) noexcept=delete
| disabling move constructor
database & | operator= (const database &ref)=delete
| disabling assignement operator
database & | operator= (database &&ref) noexcept=delete
| disabling move assignment operator
| ~database ()
| database destructor (no implicit file saving)
void | dump (const std::string &filename, const database_dump_options &opt) const
| write the database to a file (see database_header first)
void | add_archive (const archive &arch, const std::string &chemin, const std::string &basename, const database_add_options &opt)
| add an archive to the database
void | remove_archive (archive_num min, archive_num max, const database_remove_options &opt)
| remove an archive from a database
void | set_permutation (archive_num src, archive_num dst)
| change order of archive within the database
void | change_name (archive_num num, const std::string &basename, const database_change_basename_options &opt)
| change one's archive basename recorded in the database
void | set_path (archive_num num, const std::string &chemin, const database_change_path_options &opt)
| change one's archive path recorded in the database
void | set_options (const std::vector< std::string > &opt)
| change the default options given to dar when performing restoration
void | set_dar_path (const std::string &chemin)
| change the path to dar command
void | set_compression (compression algozip) const
| change compression to use when storing base in file
void | set_compression_level (U_I compr_level) const
| change the compression level to use when storing base in file
database_archives_list | get_contents () const
| provides the list of archive used to build the database
std::vector< std::string > | get_options () const
| return the options used with dar for restoration
std::string | get_dar_path () const
| returns the path for dar
compression | get_compression () const
| returns the compression algorithm used on filesystem
U_I | get_compression_level () const
| returns the compression level used on file
std::string | get_database_version () const
| return the database format version
void | get_files (database_listing_show_files_callback callback, void *context, archive_num num, const database_used_options &opt) const
| list files which are present in a given archive
void | get_version (database_listing_get_version_callback callback, void *context, path chemin) const
| list the archive where a give file is present
void | show_most_recent_stats (database_listing_statistics_callback callback, void *context) const
| compute some statistics about the location of most recent file versions
void | restore (const std::vector< std::string > &filename, const database_restore_options &opt)
| restore files calling dar on the appropriated archive
void | restore (const archive_options_read &read_options, const path &fs_root, const archive_options_extract &extract_options, const database_restore_options &opt, statistics *progressive_report)
| restore files without calling dar as a seperated process
bool | check_order () const
| check that all files's Data and EA are more recent when archive number grows within the database, only warn the user
| database (const std::shared_ptr< user_interaction > &dialog)
| this constructor build an empty database
| database (const std::shared_ptr< user_interaction > &dialog, const std::string &base, const database_open_options &opt)
| this constructor reads database from a file
| database (const database &ref)=delete
| disabling copy constructor
| database (database &&ref) noexcept=delete
| disabling move constructor
database & | operator= (const database &ref)=delete
| disabling assignement operator
database & | operator= (database &&ref) noexcept=delete
| disabling move assignment operator
| ~database ()
| database destructor (no implicit file saving)
void | dump (const std::string &filename, const database_dump_options &opt) const
| write the database to a file (see database_header first)
void | add_archive (const archive &arch, const std::string &chemin, const std::string &basename, const database_add_options &opt)
| add an archive to the database
void | remove_archive (archive_num min, archive_num max, const database_remove_options &opt)
| remove an archive from a database
void | set_permutation (archive_num src, archive_num dst)
| change order of archive within the database
void | change_name (archive_num num, const std::string &basename, const database_change_basename_options &opt)
| change one's archive basename recorded in the database
void | set_path (archive_num num, const std::string &chemin, const database_change_path_options &opt)
| change one's archive path recorded in the database
void | set_options (const std::vector< std::string > &opt)
| change the default options given to dar when performing restoration
void | set_dar_path (const std::string &chemin)
| change the path to dar command
void | set_compression (compression algozip) const
| change compression to use when storing base in file
void | set_compression_level (U_I compr_level) const
| change the compression level to use when storing base in file
database_archives_list | get_contents () const
| provides the list of archive used to build the database
std::vector< std::string > | get_options () const
| return the options used with dar for restoration
std::string | get_dar_path () const
| returns the path for dar
compression | get_compression () const
| returns the compression algorithm used on filesystem
U_I | get_compression_level () const
| returns the compression level used on file
std::string | get_database_version () const
| return the database format version
void | get_files (database_listing_show_files_callback callback, void *context, archive_num num, const database_used_options &opt) const
| list files which are present in a given archive
void | get_version (database_listing_get_version_callback callback, void *context, path chemin) const
| list the archive where a give file is present
void | show_most_recent_stats (database_listing_statistics_callback callback, void *context) const
| compute some statistics about the location of most recent file versions
void | restore (const std::vector< std::string > &filename, const database_restore_options &opt)
| restore files calling dar on the appropriated archive
void | restore (const archive_options_read &read_options, const path &fs_root, const archive_options_extract &extract_options, const database_restore_options &opt, statistics *progressive_report)
| restore files without calling dar as a seperated process
bool | check_order () const
| check that all files's Data and EA are more recent when archive number grows within the database, only warn the user

## Private Attributes
std::unique_ptr< i_database > | pimpl

## Detailed Description

the database class defines the dar_manager database

all operations for a dar_manager database are defines through the use of this class interface. This class also defines internally the data structure of the database.

Definition at line 51 of file dar64-2.8.3-win64/include/dar/database.hpp.

## Constructor & Destructor Documentation

## ◆ database() [1/2]

libdar::database::database | ( | const std::shared_ptr< user_interaction > & | dialog,
|  | const std::string & | base,
|  | const database_open_options & | opt )

this constructor reads database from a file

Parameters

  [in] | dialog | for user interaction
  [in] | base | database filename
  [in] | opt | extendable list of options to use for this operation

## ◆ database() [2/2]

libdar::database::database | ( | const std::shared_ptr< user_interaction > & | dialog,
|  | const std::string & | base,
|  | const database_open_options & | opt )

this constructor reads database from a file

Parameters

  [in] | dialog | for user interaction
  [in] | base | database filename
  [in] | opt | extendable list of options to use for this operation

## Member Function Documentation

## ◆ add_archive() [1/2]

void libdar::database::add_archive | ( | const archive & | arch,
|  | const std::string & | chemin,
|  | const std::string & | basename,
|  | const database_add_options & | opt )

add an archive to the database

Parameters

  [in] | arch | is the archive to add to the database (may be a partial archive)
  [in] | chemin | is the path to this archive to record in the database
  [in] | basename | is the archive's basename to record in the database
  [in] | opt | extendable list of options to use for this operation

Note
  this method is not available with partially extracted databases.

## ◆ add_archive() [2/2]

void libdar::database::add_archive | ( | const archive & | arch,
|  | const std::string & | chemin,
|  | const std::string & | basename,
|  | const database_add_options & | opt )

add an archive to the database

Parameters

  [in] | arch | is the archive to add to the database (may be a partial archive)
  [in] | chemin | is the path to this archive to record in the database
  [in] | basename | is the archive's basename to record in the database
  [in] | opt | extendable list of options to use for this operation

Note
  this method is not available with partially extracted databases.

## ◆ change_name() [1/2]

void libdar::database::change_name | ( | archive_num | num,
|  | const std::string & | basename,
|  | const database_change_basename_options & | opt )

change one's archive basename recorded in the database

Parameters

  [in] | num | is the archive index to rename
  [in] | basename | is the new basename to give to that archive
  [in] | opt | optional parameters for this operation

Note
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ change_name() [2/2]

void libdar::database::change_name | ( | archive_num | num,
|  | const std::string & | basename,
|  | const database_change_basename_options & | opt )

change one's archive basename recorded in the database

Parameters

  [in] | num | is the archive index to rename
  [in] | basename | is the new basename to give to that archive
  [in] | opt | optional parameters for this operation

Note
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ check_order() [1/2]

bool libdar::database::check_order | ( |  | ) | const

check that all files's Data and EA are more recent when archive number grows within the database, only warn the user

Returns
  true if check succeeded, false if warning have been issued

Note
  this method is not available with partially extracted databases.

## ◆ check_order() [2/2]

bool libdar::database::check_order | ( |  | ) | const

check that all files's Data and EA are more recent when archive number grows within the database, only warn the user

Returns
  true if check succeeded, false if warning have been issued

Note
  this method is not available with partially extracted databases.

## ◆ dump() [1/2]

void libdar::database::dump | ( | const std::string & | filename,
|  | const database_dump_options & | opt ) const

write the database to a file (see database_header first)

Parameters

  [in] | filename | name of file to save database to
  [in] | opt | extendable list of options to use for this operation

Note
  this method is not available with partially extracted databases.

## ◆ dump() [2/2]

void libdar::database::dump | ( | const std::string & | filename,
|  | const database_dump_options & | opt ) const

write the database to a file (see database_header first)

Parameters

  [in] | filename | name of file to save database to
  [in] | opt | extendable list of options to use for this operation

Note
  this method is not available with partially extracted databases.

## ◆ get_dar_path() [1/2]

std::string libdar::database::get_dar_path | ( |  | ) | const

returns the path for dar

Returns
  the path to dar used when restoring files

Note
  empty string means that dar is taken from the PATH variable

## ◆ get_dar_path() [2/2]

std::string libdar::database::get_dar_path | ( |  | ) | const

returns the path for dar

Returns
  the path to dar used when restoring files

Note
  empty string means that dar is taken from the PATH variable

## ◆ get_files() [1/2]

void libdar::database::get_files | ( | database_listing_show_files_callback | callback,
|  | void * | context,
|  | archive_num | num,
|  | const database_used_options & | opt ) const

list files which are present in a given archive

Parameters

  [in] | callback | is called to provide each entry in turn from the list
  [in] | context | is given as first argument of the callback as is provided here
  [in] | num | is the archive number to look at
  [in] | opt | optional parameters for this operation

Note
  if "num" is set to zero all archive contents is listed
  this method is not available with partially extracted databases.

## ◆ get_files() [2/2]

void libdar::database::get_files | ( | database_listing_show_files_callback | callback,
|  | void * | context,
|  | archive_num | num,
|  | const database_used_options & | opt ) const

list files which are present in a given archive

Parameters

  [in] | callback | is called to provide each entry in turn from the list
  [in] | context | is given as first argument of the callback as is provided here
  [in] | num | is the archive number to look at
  [in] | opt | optional parameters for this operation

Note
  if "num" is set to zero all archive contents is listed
  this method is not available with partially extracted databases.

## ◆ get_version() [1/2]

void libdar::database::get_version | ( | database_listing_get_version_callback | callback,
|  | void * | context,
|  | path | chemin ) const

list the archive where a give file is present

Parameters

  [in] | callback | is used to provide each entry in turn from the list
  [in] | context | is given as first argument of the callback as is provided here
  [in] | chemin | path to the file to look for

Note
  this method is not available with partially extracted databases.

## ◆ get_version() [2/2]

void libdar::database::get_version | ( | database_listing_get_version_callback | callback,
|  | void * | context,
|  | path | chemin ) const

list the archive where a give file is present

Parameters

  [in] | callback | is used to provide each entry in turn from the list
  [in] | context | is given as first argument of the callback as is provided here
  [in] | chemin | path to the file to look for

Note
  this method is not available with partially extracted databases.

## ◆ remove_archive() [1/2]

void libdar::database::remove_archive | ( | archive_num | min,
|  | archive_num | max,
|  | const database_remove_options & | opt )

remove an archive from a database

Parameters

  [in] | min | first archive index to remove
  [in] | max | last archive index to remove
  [in] | opt | extendable list of options to use for this operation

Note
  the archives which indexes are in the range [min-max] are removed. If you want to remove only one archive choose min equal to max.
  this method is not available with partially extracted databases.

## ◆ remove_archive() [2/2]

void libdar::database::remove_archive | ( | archive_num | min,
|  | archive_num | max,
|  | const database_remove_options & | opt )

remove an archive from a database

Parameters

  [in] | min | first archive index to remove
  [in] | max | last archive index to remove
  [in] | opt | extendable list of options to use for this operation

Note
  the archives which indexes are in the range [min-max] are removed. If you want to remove only one archive choose min equal to max.
  this method is not available with partially extracted databases.

## ◆ restore() [1/4]

void libdar::database::restore | ( | const archive_options_read & | read_options,
|  | const path & | fs_root,
|  | const archive_options_extract & | extract_options,
|  | const database_restore_options & | opt,
|  | statistics * | progressive_report )

restore files without calling dar as a seperated process

Parameters

  [in] | read_options | options to use to open archive for restoration
  [in] | fs_root | where to restore data
  [in] | extract_options | options to use to perform archive extraction
  [in] | opt | dar_manager relative info for this operation
  [in] | progressive_report | if not nullptr, will fill the progressive_report during the operation

Note
  opt fields that are taken into account here are:
  - set_date()
  - set_info_details() but only for database specific informations (see archive options else)
  - even_when_removed() The fiels/methods (set_early_release(), set_extra_options_for_dar(), set_ignore_dar_options_in_database() are ignored as they concern CLI format of options (not defined in libdar but in dar).

## ◆ restore() [2/4]

void libdar::database::restore | ( | const archive_options_read & | read_options,
|  | const path & | fs_root,
|  | const archive_options_extract & | extract_options,
|  | const database_restore_options & | opt,
|  | statistics * | progressive_report )

restore files without calling dar as a seperated process

Parameters

  [in] | read_options | options to use to open archive for restoration
  [in] | fs_root | where to restore data
  [in] | extract_options | options to use to perform archive extraction
  [in] | opt | dar_manager relative info for this operation
  [in] | progressive_report | if not nullptr, will fill the progressive_report during the operation

Note
  opt fields that are taken into account here are:
  - set_date()
  - set_info_details() but only for database specific informations (see archive options else)
  - even_when_removed() The fiels/methods (set_early_release(), set_extra_options_for_dar(), set_ignore_dar_options_in_database() are ignored as they concern CLI format of options (not defined in libdar but in dar).

## ◆ restore() [3/4]

void libdar::database::restore | ( | const std::vector< std::string > & | filename,
|  | const database_restore_options & | opt )

restore files calling dar on the appropriated archive

Parameters

  [in] | filename | list of filename to restore
  [in] | opt | extendable list of options to use for this operation

Note
  this method is not available with partially extracted databases.

## ◆ restore() [4/4]

void libdar::database::restore | ( | const std::vector< std::string > & | filename,
|  | const database_restore_options & | opt )

restore files calling dar on the appropriated archive

Parameters

  [in] | filename | list of filename to restore
  [in] | opt | extendable list of options to use for this operation

Note
  this method is not available with partially extracted databases.

## ◆ set_dar_path() [1/2]

void libdar::database::set_dar_path | ( | const std::string & | chemin | ) |

change the path to dar command

Parameters

  [in] | chemin | is the full path to dar (including dar filename) to use for restoration

Note
  if set to an empty string the dar command found from the PATH will be used (if any)
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ set_dar_path() [2/2]

void libdar::database::set_dar_path | ( | const std::string & | chemin | ) |

change the path to dar command

Parameters

  [in] | chemin | is the full path to dar (including dar filename) to use for restoration

Note
  if set to an empty string the dar command found from the PATH will be used (if any)
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ set_options() [1/2]

void libdar::database::set_options | ( | const std::vector< std::string > & | opt | ) |

change the default options given to dar when performing restoration

Parameters

  [in] | opt | is a vector a arguments.

Note
  Each element of the vector must match a single argument of the command line like for example "-R". Any leading or trailing space will make a different argument than the one without spaces (" -R" is different than "-R" for example).
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ set_options() [2/2]

void libdar::database::set_options | ( | const std::vector< std::string > & | opt | ) |

change the default options given to dar when performing restoration

Parameters

  [in] | opt | is a vector a arguments.

Note
  Each element of the vector must match a single argument of the command line like for example "-R". Any leading or trailing space will make a different argument than the one without spaces (" -R" is different than "-R" for example).
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ set_path() [1/2]

void libdar::database::set_path | ( | archive_num | num,
|  | const std::string & | chemin,
|  | const database_change_path_options & | opt )

change one's archive path recorded in the database

Parameters

  [in] | num | is the archive index who's path to change
  [in] | chemin | is the new path to give to that archive
  [in] | opt | optional parameters for this operation

Note
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ set_path() [2/2]

void libdar::database::set_path | ( | archive_num | num,
|  | const std::string & | chemin,
|  | const database_change_path_options & | opt )

change one's archive path recorded in the database

Parameters

  [in] | num | is the archive index who's path to change
  [in] | chemin | is the new path to give to that archive
  [in] | opt | optional parameters for this operation

Note
  this method is available with partially extracted databases, but with partial_read_only ones

## ◆ set_permutation() [1/2]

void libdar::database::set_permutation | ( | archive_num | src,
|  | archive_num | dst )

change order of archive within the database

Parameters

  [in] | src | archive index to move
  [in] | dst | archive index to move to

Note
  this method is not available with partially extracted databases.

## ◆ set_permutation() [2/2]

void libdar::database::set_permutation | ( | archive_num | src,
|  | archive_num | dst )

change order of archive within the database

Parameters

  [in] | src | archive index to move
  [in] | dst | archive index to move to

Note
  this method is not available with partially extracted databases.

## ◆ show_most_recent_stats() [1/2]

void libdar::database::show_most_recent_stats | ( | database_listing_statistics_callback | callback,
|  | void * | context ) const

compute some statistics about the location of most recent file versions

Parameters

  [in] | callback | is used to provide each entry in turn from the list
  [in] | context | is given as first argument of the callback as is provided here

Note
  this method is not available with partially extracted databases.

## ◆ show_most_recent_stats() [2/2]

void libdar::database::show_most_recent_stats | ( | database_listing_statistics_callback | callback,
|  | void * | context ) const

compute some statistics about the location of most recent file versions

Parameters

  [in] | callback | is used to provide each entry in turn from the list
  [in] | context | is given as first argument of the callback as is provided here

Note
  this method is not available with partially extracted databases.

## Member Data Documentation

## ◆ pimpl

std::unique_ptr< i_database > libdar::database::pimpl
| private

Definition at line 258 of file dar64-2.8.3-win64/include/dar/database.hpp.

The documentation for this class was generated from the following files:

- dar64-2.8.3-win64/include/dar/database.hpp
- src/libdar/database.hpp