Tkrzw
Namespaces | Functions
tkrzw_dbm_common_impl.h File Reference

Common implementation components for database managers. More...

#include <string>
#include <string_view>
#include <cinttypes>
#include <cstdarg>
#include "tkrzw_dbm.h"
#include "tkrzw_hash_util.h"
#include "tkrzw_file.h"
#include "tkrzw_lib_common.h"

Namespaces

 tkrzw
 Common namespace of Tkrzw.
 

Functions

uint64_t tkrzw::PrimaryHash (std::string_view data, uint64_t num_buckets)
 Primary hash function for the hash database. More...
 
uint64_t tkrzw::SecondaryHash (std::string_view data, uint64_t num_shards)
 Secondary hash function for sharding. More...
 
uint64_t tkrzw::IsPrimeNumber (uint64_t num)
 Returns true if an integer is a prime number. More...
 
int64_t tkrzw::GetHashBucketSize (int64_t min_size)
 Gets a proper bucket size for hashing. More...
 
Status tkrzw::SearchDBM (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0, bool(*matcher)(std::string_view, std::string_view)=StrContains)
 Searches a database and get keys which match a pattern. More...
 
Status tkrzw::SearchDBMLambda (DBM *dbm, std::function< bool(std::string_view)> matcher, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which match a lambda function. More...
 
Status tkrzw::SearchDBMOrder (DBM *dbm, std::string_view pattern, bool upper, bool inclusive, std::vector< std::string > *matched, size_t capacity=0)
 Searches an ordered database and get keys which match a boundary condition. More...
 
Status tkrzw::SearchDBMForwardMatch (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which begin with a pattern. More...
 
Status tkrzw::SearchDBMRegex (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which match a regular expression. More...
 
Status tkrzw::SearchDBMEditDistance (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys whose edit distance with a UTF-8 pattern is the least. More...
 
Status tkrzw::SearchDBMEditDistanceBinary (DBM *dbm, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys whose edit distance with a binary pattern is the least. More...
 
Status tkrzw::SearchDBMModal (DBM *dbm, std::string_view mode, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a database and get keys which match a pattern, according to a mode expression. More...
 
Status tkrzw::ExportDBMToFlatRecords (DBM *dbm, File *dest_file)
 Exports all records of a database to a flat record file. More...
 
Status tkrzw::ImportDBMFromFlatRecords (DBM *dbm, File *src_file)
 Imports records to a database from a flat record file. More...
 
Status tkrzw::ExportDBMKeysToFlatRecords (DBM *dbm, File *dest_file)
 Exports the keys of all records of a database to a flat record file. More...
 
Status tkrzw::ExportDBMToTSV (DBM *dbm, File *dest_file, bool escape=false)
 Exports all records of a database to a TSV file. More...
 
Status tkrzw::ImportDBMFromTSV (DBM *dbm, File *dest_file, bool unescape=false)
 Imports records to a database from a TSV file. More...
 
Status tkrzw::ExportDBMKeysAsLines (DBM *dbm, File *dest_file)
 Exports the keys of all records of a database as lines to a text file. More...
 
Status tkrzw::SearchTextFile (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0, bool(*matcher)(std::string_view, std::string_view)=StrContains)
 Searches a text file and get lines which match a pattern. More...
 
Status tkrzw::SearchTextFileLambda (File *file, std::function< bool(std::string_view)> matcher, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines which match a lambda function. More...
 
Status tkrzw::SearchTextFileRegex (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines which match a regular expression. More...
 
Status tkrzw::SearchTextFileEditDistance (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines whose edit distance with a UTF-8 pattern is the least. More...
 
Status tkrzw::SearchTextFileEditDistanceBinary (File *file, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines whose edit distance with a binary pattern is the least. More...
 
Status tkrzw::SearchTextFileModal (File *file, std::string_view mode, std::string_view pattern, std::vector< std::string > *matched, size_t capacity=0)
 Searches a text file and get lines which match a pattern, according to a mode expression. More...
 

Detailed Description

Common implementation components for database managers.