![]() |
Visit each key/data pair in a data file.
template< class Callback, class Progress> void visit( path_type const& path, Callback&& callback, Progress&& progress, error_code& ec);
This function will open and iterate the contents of a data file, invoking the callback for each key/value pair found. Only a data file is necessary, the key file may be omitted.
|
Name |
Description |
|---|---|
|
|
The path to the data file. |
|
|
A function which will be called with each item found in the data file. The equivalent signature of the callback must be: void callback( void const* key, // A pointer to the item key std::size_t key_size, // The size of the key (always the same) void const* data, // A pointer to the item data std::size_t data_size, // The size of the item data error_code& ec // Indicates an error (out parameter) ); If the callback sets ec to an error, the visit is terminated. |
|
|
A function which will be called periodically as the algorithm proceeds. The equivalent signature of the progress function must be: void progress( std::uint64_t amount, // Amount of work done so far std::uint64_t total // Total amount of work to do ); |
|
|
Set to the error, if any occurred. |
#include <nudb/visit.hpp>