Perform recovery on a database.
template< class Hasher, class File = native_file, class... Args> void recover( path_type const& dat_path, path_type const& key_path, path_type const& log_path, error_code& ec, Args&&... args);
This implements the recovery algorithm by rolling back any partially committed data. If no log file is present, the function does nothing.
During the commit phase of a NuDB database, a log file is generated with
information that may be used to roll back the results of a partial commit.
This function checks for the presence of a log file. If present, the log
file is replayed on the key and data files belonging to the database, restoring
the database to its state before the partial commit. When recover
is successful, it erases
the log file.
It is normally not necessary to call this function directly, it is called
automatically when a database is opened in a call to basic_store::open
. Callers may use this function
to implement auxiliary tools for manipulating the database.
The hash function to use. This type must meet the requirements of Hasher. The hash function must be the same as that used to create the database, or else an error is returned.
The type of file to use. Use the default of native_file
unless customizing
the file behavior.
The path to the data file.
The path to the key file.
The path to the log file.
Optional parameters passed to File constructors.
Set to the error, if any occurred.
Header: nudb/recover.hpp