|
| StdHashDBM (int64_t num_buckets=-1) |
| Default constructor. More...
|
|
| StdHashDBM (std::unique_ptr< File > file, int64_t num_buckets=-1) |
| Constructor with a file object. More...
|
|
virtual | ~StdHashDBM () |
| Destructor. More...
|
|
| StdHashDBM (const StdHashDBM &rhs)=delete |
| Copy and assignment are disabled. More...
|
|
StdHashDBM & | operator= (const StdHashDBM &rhs)=delete |
|
Status | Open (const std::string &path, bool writable, int32_t options=File::OPEN_DEFAULT) override |
| Opens a database file. More...
|
|
Status | Close () override |
| Closes the database file. More...
|
|
Status | Process (std::string_view key, RecordProcessor *proc, bool writable) override |
| Processes a record with a processor. More...
|
|
Status | ProcessEach (RecordProcessor *proc, bool writable) override |
| Processes each and every record in the database with a processor. More...
|
|
Status | Count (int64_t *count) override |
| Gets the number of records. More...
|
|
Status | GetFileSize (int64_t *size) override |
| Gets the current file size of the database. More...
|
|
Status | GetFilePath (std::string *path) override |
| Gets the path of the database file. More...
|
|
Status | Clear () override |
| Removes all records. More...
|
|
Status | Rebuild () override |
| Rebuilds the entire database. More...
|
|
Status | ShouldBeRebuilt (bool *tobe) override |
| Checks whether the database should be rebuilt. More...
|
|
Status | Synchronize (bool hard, FileProcessor *proc=nullptr) override |
| Synchronizes the content of the database to the file system. More...
|
|
std::vector< std::pair< std::string, std::string > > | Inspect () override |
| Inspects the database. More...
|
|
bool | IsOpen () const override |
| Checks whether the database is open. More...
|
|
bool | IsWritable () const override |
| Checks whether the database is writable. More...
|
|
bool | IsHealthy () const override |
| Checks whether the database condition is healthy. More...
|
|
bool | IsOrdered () const override |
| Checks whether ordered operations are supported. More...
|
|
std::unique_ptr< DBM::Iterator > | MakeIterator () override |
| Makes an iterator for each record. More...
|
|
std::unique_ptr< DBM > | MakeDBM () const override |
| Makes a new DBM object of the same concrete class. More...
|
|
virtual | ~DBM ()=default |
| Destructor. More...
|
|
virtual Status | Get (std::string_view key, std::string *value=nullptr) |
| Gets the value of a record of a key. More...
|
|
virtual std::string | GetSimple (std::string_view key, std::string_view default_value="") |
| Gets the value of a record of a key, in a simple way. More...
|
|
virtual std::map< std::string, std::string > | GetMulti (const std::initializer_list< std::string > &keys) |
| Gets the values of multiple records of keys. More...
|
|
virtual std::map< std::string, std::string > | GetMulti (const std::vector< std::string > &keys) |
| Gets the values of multiple records of keys, with a vector. More...
|
|
virtual Status | Set (std::string_view key, std::string_view value, bool overwrite=true) |
| Sets a record of a key and a value. More...
|
|
virtual Status | SetMulti (const std::initializer_list< std::pair< std::string, std::string >> &records, bool overwrite=true) |
| Sets multiple records. More...
|
|
virtual Status | SetMulti (const std::map< std::string, std::string > &records, bool overwrite=true) |
| Sets multiple records, with a map of strings. More...
|
|
virtual Status | Remove (std::string_view key) |
| Removes a record of a key. More...
|
|
virtual Status | Append (std::string_view key, std::string_view value, std::string_view delim="") |
| Appends data at the end of a record of a key. More...
|
|
virtual Status | CompareExchange (std::string_view key, std::string_view expected, std::string_view desired, std::string *actual=nullptr) |
| Compares the value of a record and exchanges if the condition meets. More...
|
|
virtual Status | Increment (std::string_view key, int64_t increment=1, int64_t *current=nullptr, int64_t initial=0) |
| Increments the numeric value of a record. More...
|
|
int64_t | IncrementSimple (std::string_view key, int64_t increment=1, int64_t initial=0) |
| Increments the numeric value of a record, in a simple way. More...
|
|
virtual int64_t | CountSimple () |
| Gets the number of records, in a simple way. More...
|
|
virtual int64_t | GetFileSizeSimple () |
| Gets the current file size of the database, in a simple way. More...
|
|
virtual std::string | GetFilePathSimple () |
| Gets the path of the database file, in a simple way. More...
|
|
virtual bool | ShouldBeRebuiltSimple () |
| Checks whether the database should be rebuilt, in a simple way. More...
|
|
virtual Status | CopyFile (const std::string &dest_path) |
| Copies the content of the database file to another file. More...
|
|
virtual Status | Export (DBM *dbm) |
| Exports all records to another database. More...
|
|
On-memory database manager implemented with std::unordered_map.
All operations are thread-safe; Multiple threads can access the same database concurrently.