Disk ARchive  2.5.11
Full featured and portable backup and archiving tool
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
Public Member Functions | List of all members
libdar::database Class Reference

the database class defines the dar_manager database More...

#include <database.hpp>

Inherits libdar::on_pool.

Public Member Functions

 database ()
 this constructor build an empty database
 
 database (user_interaction &dialog, const std::string &base, const database_open_options &opt)
 this constructor reads database from a file More...
 
 ~database ()
 database destructor (no implicit file saving)
 
void dump (user_interaction &dialog, const std::string &filename, const database_dump_options &opt) const
 write the database to a file (see database_header first) More...
 
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 More...
 
void remove_archive (archive_num min, archive_num max, const database_remove_options &opt)
 remove an archive from a database More...
 
void set_permutation (archive_num src, archive_num dst)
 change order of archive within the database More...
 
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 More...
 
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 More...
 
void set_options (const std::vector< std::string > &opt)
 change the default options given to dar when performing restoration More...
 
void set_dar_path (const std::string &chemin)
 change the path to dar command More...
 
void show_contents (user_interaction &dialog) const
 show the list of archive used to build the database More...
 
std::vector< std::string > get_options () const
 return the options used with dar for restoration
 
std::string get_dar_path () const
 return the path for dar More...
 
void show_files (user_interaction &dialog, archive_num num, const database_used_options &opt) const
 list files which are present in a given archive More...
 
void show_version (user_interaction &dialog, path chemin) const
 list the archive where a give file is present More...
 
void show_most_recent_stats (user_interaction &dialog) const
 compute some statistics about the location of most recent file versions More...
 
void restore (user_interaction &dialog, const std::vector< std::string > &filename, const database_restore_options &opt)
 restore files calling dar on the appropriated archive More...
 
bool check_order (user_interaction &dialog) const
 check that all files's Data and EA are more recent when archive number grows within the database, only warn the user More...
 
- Public Member Functions inherited from libdar::on_pool
void * operator new (size_t n_byte)
 
void * operator new (size_t n_byte, const std::nothrow_t &nothrow_value)
 
void * operator new[] (size_t n_byte)
 
void * operator new[] (size_t n_byte, const std::nothrow_t &nothrow_value)
 
void * operator new (size_t n_byte, memory_pool *p)
 
void * operator new[] (size_t n_byte, memory_pool *p)
 
void operator delete (void *ptr, memory_pool *p)
 this operator is called by the compiler if an exception is throw from the constructor of the allocated object
 
void operator delete[] (void *ptr, memory_pool *p)
 this operator is called by the compiler if an exception is throw from the constructor of the allocated objects
 
void operator delete (void *ptr)
 this is the usual delete operator, modified to handle allocated objects allocated on a memory pool or not
 
void operator delete[] (void *ptr)
 this is the usual delete[] operator, modified to handle allocated objects allocated on a memory pool or not
 

Additional Inherited Members

- Protected Member Functions inherited from libdar::on_pool
memory_pool * get_pool () const
 
template<class T >
void meta_new (T *&ptr, size_t num)
 
template<class T >
void meta_delete (T *ptr)
 

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 49 of file database.hpp.

Constructor & Destructor Documentation

libdar::database::database ( user_interaction dialog,
const std::string &  base,
const database_open_options opt 
)

this constructor reads database from a file

Parameters
[in]dialogfor user interaction
[in]basedatabase filename
[in]optextendable list of options to use for this operation

Member Function Documentation

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]archis the archive to add to the database (may be a partial archive)
[in]cheminis the path to this archive to record in the database
[in]basenameis the archive's basename to record in the database
[in]optextendable list of options to use for this operation
Note
this method is not available with partially extracted databases.
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]numis the archive index to rename
[in]basenameis the new basename to give to that archive
[in]optoptional parameters for this operation
Note
this method is available with partially extracted databases, but with partial_read_only ones
bool libdar::database::check_order ( user_interaction dialog) const
inline

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

Parameters
[in,out]dialogfor user interaction
Returns
true if check succeeded, false if warning have been issued
Note
this method is not available with partially extracted databases.

Definition at line 189 of file database.hpp.

References libdar::data_dir::check_order().

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

write the database to a file (see database_header first)

Parameters
[in]dialogfor user interaction
[in]filenamename of file to save database to
[in]optextendable list of options to use for this operation
Note
this method is not available with partially extracted databases.
std::string libdar::database::get_dar_path ( ) const
inline

return 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

Definition at line 148 of file database.hpp.

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

remove an archive from a database

Parameters
[in]minfirst archive index to remove
[in]maxlast archive index to remove
[in]optextendable 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.
void libdar::database::restore ( user_interaction dialog,
const std::vector< std::string > &  filename,
const database_restore_options opt 
)

restore files calling dar on the appropriated archive

Parameters
[in,out]dialogwhere to have user interaction
[in]filenamelist of filename to restore
[in]optextendable list of options to use for this operation
Note
this method is not available with partially extracted databases.
void libdar::database::set_dar_path ( const std::string &  chemin)
inline

change the path to dar command

Parameters
[in]cheminis 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

Definition at line 131 of file database.hpp.

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

change the default options given to dar when performing restoration

Parameters
[in]optis 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

Definition at line 124 of file database.hpp.

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]numis the archive index who's path to change
[in]cheminis the new path to give to that archive
[in]optoptional parameters for this operation
Note
this method is available with partially extracted databases, but with partial_read_only ones
void libdar::database::set_permutation ( archive_num  src,
archive_num  dst 
)

change order of archive within the database

Parameters
[in]srcarchive index to move
[in]dstarchive index to move to
Note
this method is not available with partially extracted databases.
void libdar::database::show_contents ( user_interaction dialog) const

show the list of archive used to build the database

Parameters
[in,out]dialogis the user_interaction to use to report the listing
void libdar::database::show_files ( user_interaction dialog,
archive_num  num,
const database_used_options opt 
) const

list files which are present in a given archive

Parameters
[in,out]dialogwhere to display listing to
[in]numis the archive number to look at
[in]optoptional 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.
void libdar::database::show_most_recent_stats ( user_interaction dialog) const

compute some statistics about the location of most recent file versions

Parameters
[in]dialogwhere to display the listing to
Note
this method is not available with partially extracted databases.
void libdar::database::show_version ( user_interaction dialog,
path  chemin 
) const

list the archive where a give file is present

Parameters
[in,out]dialogwhere to display the listing to
[in]cheminpath to the file to look for
Note
this method is not available with partially extracted databases.

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