|
| CacheDBM (int64_t cap_rec_num=-1, int64_t cap_mem_size=-1) |
| Default constructor.
|
|
| CacheDBM (std::unique_ptr< File > file, int64_t cap_rec_num=-1, int64_t cap_mem_size=-1) |
| Constructor with a file object.
|
|
| ~CacheDBM () |
| Destructor.
|
|
| CacheDBM (const CacheDBM &rhs)=delete |
| Copy and assignment are disabled.
|
|
CacheDBM & | operator= (const CacheDBM &rhs)=delete |
|
Status | Open (const std::string &path, bool writable, int32_t options=File::OPEN_DEFAULT) override |
| Opens a database file.
|
|
Status | Close () override |
| Closes the database file.
|
|
Status | Process (std::string_view key, RecordProcessor *proc, bool writable) override |
| Processes a record with a processor.
|
|
Status | ProcessMulti (const std::vector< std::pair< std::string_view, DBM::RecordProcessor * > > &key_proc_pairs, bool writable) override |
| Processes multiple records with processors.
|
|
Status | ProcessFirst (RecordProcessor *proc, bool writable) override |
| Processes the first record with a processor.
|
|
Status | ProcessEach (RecordProcessor *proc, bool writable) override |
| Processes each and every record in the database with a processor.
|
|
Status | Count (int64_t *count) override |
| Gets the number of records.
|
|
Status | GetFileSize (int64_t *size) override |
| Gets the current file size of the database.
|
|
Status | GetFilePath (std::string *path) override |
| Gets the path of the database file.
|
|
Status | GetTimestamp (double *timestamp) override |
| Gets the timestamp in seconds of the last modified time.
|
|
Status | Clear () override |
| Removes all records.
|
|
Status | Rebuild () override |
| Rebuilds the entire database.
|
|
Status | RebuildAdvanced (int64_t cap_rec_num=-1, int64_t cap_mem_size=-1) |
| Rebuilds the entire database, in an advanced way.
|
|
Status | ShouldBeRebuilt (bool *tobe) override |
| Checks whether the database should be rebuilt.
|
|
Status | Synchronize (bool hard, FileProcessor *proc=nullptr) override |
| Synchronizes the content of the database to the file system.
|
|
std::vector< std::pair< std::string, std::string > > | Inspect () override |
| Inspects the database.
|
|
bool | IsOpen () const override |
| Checks whether the database is open.
|
|
bool | IsWritable () const override |
| Checks whether the database is writable.
|
|
bool | IsHealthy () const override |
| Checks whether the database condition is healthy.
|
|
bool | IsOrdered () const override |
| Checks whether ordered operations are supported.
|
|
std::unique_ptr< DBM::Iterator > | MakeIterator () override |
| Makes an iterator for each record.
|
|
std::unique_ptr< DBM > | MakeDBM () const override |
| Makes a new DBM object of the same concrete class.
|
|
UpdateLogger * | GetUpdateLogger () const override |
| Gets the logger to write all update operations.
|
|
void | SetUpdateLogger (UpdateLogger *update_logger) override |
| Sets the logger to write all update operations.
|
|
File * | GetInternalFile () const |
| Gets the pointer to the internal file object.
|
|
int64_t | GetEffectiveDataSize () |
| Gets the effective data size.
|
|
int64_t | GetMemoryUsage () |
| Gets the current memory usage.
|
|
virtual | ~DBM ()=default |
| Destructor.
|
|
virtual Status | Process (std::string_view key, RecordLambdaType rec_lambda, bool writable) |
| Processes a record with a lambda function.
|
|
virtual Status | Get (std::string_view key, std::string *value=nullptr) |
| Gets the value of a record of a key.
|
|
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.
|
|
virtual Status | GetMulti (const std::vector< std::string_view > &keys, std::map< std::string, std::string > *records) |
| Gets the values of multiple records of keys, with a string view vector.
|
|
virtual Status | GetMulti (const std::initializer_list< std::string_view > &keys, std::map< std::string, std::string > *records) |
| Gets the values of multiple records of keys, with an initializer list.
|
|
virtual Status | GetMulti (const std::vector< std::string > &keys, std::map< std::string, std::string > *records) |
| Gets the values of multiple records of keys, with a string vector.
|
|
virtual Status | Set (std::string_view key, std::string_view value, bool overwrite=true, std::string *old_value=nullptr) |
| Sets a record of a key and a value.
|
|
virtual Status | SetMulti (const std::map< std::string_view, std::string_view > &records, bool overwrite=true) |
| Sets multiple records, with a map of string views.
|
|
virtual Status | SetMulti (const std::initializer_list< std::pair< std::string_view, std::string_view > > &records, bool overwrite=true) |
| Sets multiple records, with an initializer list.
|
|
virtual Status | SetMulti (const std::map< std::string, std::string > &records, bool overwrite=true) |
| Sets multiple records, with a map of strings.
|
|
virtual Status | Remove (std::string_view key, std::string *old_value=nullptr) |
| Removes a record of a key.
|
|
virtual Status | RemoveMulti (const std::vector< std::string_view > &keys) |
| Removes records of keys, with a string view vector.
|
|
virtual Status | RemoveMulti (const std::initializer_list< std::string_view > &keys) |
| Removes records of keys, with an initializer list.
|
|
virtual Status | RemoveMulti (const std::vector< std::string > &keys) |
| Removes records of keys, with a string vector.
|
|
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.
|
|
virtual Status | AppendMulti (const std::map< std::string_view, std::string_view > &records, std::string_view delim="") |
| Appends data to multiple records, with a map of string views.
|
|
virtual Status | AppendMulti (const std::initializer_list< std::pair< std::string_view, std::string_view > > &records, std::string_view delim="") |
| Appends data to multiple records, with an initializer list.
|
|
virtual Status | AppendMulti (const std::map< std::string, std::string > &records, std::string_view delim="") |
| Appends data to multiple records, with a map of strings.
|
|
virtual Status | CompareExchange (std::string_view key, std::string_view expected, std::string_view desired, std::string *actual=nullptr, bool *found=nullptr) |
| Compares the value of a record and exchanges if the condition meets.
|
|
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.
|
|
virtual 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.
|
|
virtual Status | ProcessMulti (const std::vector< std::pair< std::string_view, RecordProcessor * > > &key_proc_pairs, bool writable)=0 |
| Processes multiple records with processors.
|
|
virtual Status | ProcessMulti (const std::vector< std::pair< std::string_view, RecordLambdaType > > &key_lambda_pairs, bool writable) |
| Processes multiple records with lambda functions.
|
|
virtual Status | CompareExchangeMulti (const std::vector< std::pair< std::string_view, std::string_view > > &expected, const std::vector< std::pair< std::string_view, std::string_view > > &desired) |
| Compares the values of records and exchanges if the condition meets.
|
|
virtual Status | Rekey (std::string_view old_key, std::string_view new_key, bool overwrite=true, bool copying=false, std::string *value=nullptr) |
| Changes the key of a record.
|
|
virtual Status | ProcessFirst (RecordLambdaType rec_lambda, bool writable) |
| Processes the first record with a lambda function.
|
|
virtual Status | PopFirst (std::string *key=nullptr, std::string *value=nullptr) |
| Gets the first record and removes it.
|
|
virtual Status | PushLast (std::string_view value, double wtime=-1, std::string *key=nullptr) |
| Adds a record with a key of the current timestamp.
|
|
virtual Status | ProcessEach (RecordLambdaType rec_lambda, bool writable) |
| Processes each and every record in the database with a lambda function.
|
|
virtual int64_t | CountSimple () |
| Gets the number of records, in a simple way.
|
|
virtual int64_t | GetFileSizeSimple () |
| Gets the current file size of the database, in a simple way.
|
|
virtual std::string | GetFilePathSimple () |
| Gets the path of the database file, in a simple way.
|
|
virtual double | GetTimestampSimple () |
| Gets the timestamp of the last modified time, in a simple way.
|
|
virtual bool | ShouldBeRebuiltSimple () |
| Checks whether the database should be rebuilt, in a simple way.
|
|
virtual Status | CopyFileData (const std::string &dest_path, bool sync_hard=false) |
| Copies the content of the database file to another file.
|
|
virtual Status | Export (DBM *dest_dbm) |
| Exports all records to another database.
|
|
const std::type_info & | GetType () const |
| Gets the type information of the actual class.
|
|
On-memory database manager implementation with LRU deletion.
All operations are thread-safe; Multiple threads can access the same database concurrently.