template< class Hasher, class File = native_file, class... Args> void create( path_type const& dat_path, path_type const& key_path, path_type const& log_path, std::uint64_t appnum, std::uint64_t salt, nsize_t key_size, nsize_t blockSize, float load_factor, error_code& ec, Args&&... args);
This function creates a set of new database files with the given parameters. The files must not already exist or else an error is returned.
If an error occurs while the files are being created, the function attempts to remove the files before returning.
error_code ec; create<xxhasher>( "db.dat", "db.key", "db.log", 1, make_salt(), 8, 4096, 0.5f, ec);
The hash function to use. This type must meet the requirements of Hasher. The same hash function must be used every time the database is opened, or else an error is returned. The provided |3|xxhasher is a suitable general purpose hash function.
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.
A caller-defined value stored in the file headers. When opening the database, the same value is preserved and returned to the caller.
A random unsigned integer used to permute the hash function to make
it unpredictable. The return value of make_salt
returns a suitable
value.
The number of bytes in each key.
The size of a key file block. Larger blocks hold more keys but require
more I/O cycles per operation. The ideal block size the largest size
that may be read in a single I/O cycle, and device dependent. The return
value of block_size
returns a suitable value for the volume of a given path.
A number between zero and one representing the average bucket occupancy (number of items). A value of 0.5 is perfect. Lower numbers waste space, and higher numbers produce negligible savings at the cost of increased I/O cycles.
Set to the error, if any occurred.
Optional arguments passed to File constructors.
Header: nudb/create.hpp