| Elektra 0.11.0

Public Member Functions | List of all members
kdb::tools::merging::MergingKDB Class Reference

Provides a merging wrapper around a KDB instance. More...

`#include <mergingkdb.hpp>`

Inheritance diagram for kdb::tools::merging::MergingKDB:

## Public Member Functions
int | get (KeySet &returned, std::string const &keyname) override
| Behaves like the KDB get function.
int | get (KeySet &returned, Key &parentKey) override
| Behaves like the KDB get function.
virtual int | synchronize (KeySet &returned, std::string const &keyname, ThreeWayMerge &merger)
| Synchronizes the file with the supplied KeySet.
virtual int | synchronize (KeySet &returned, Key &parentKey, ThreeWayMerge &merger)
| If a conflict occurs during set, the supplied merger is used to resolve the conflict.
Public Member Functions inherited from kdb::KDB
| KDB ()
| Constructs a class KDB.
| KDB (Key &errorKey)
| Constructs a class KDB.
| KDB (KeySet &contract)
| Constructs a class KDB.
| KDB (KeySet &contract, Key &errorKey)
| Constructs a class KDB.
virtual void | open (Key &errorKey)
| Open the database.
virtual void | open (KeySet &contract, Key &errorKey)
| Open the database.
virtual void | close () throw ()
| Close the database.
virtual void | close (Key &errorKey) throw ()
| Close the database.
virtual int | get (KeySet &returned, std::string const &keyname)
| Get all keys below keyname inside returned.
virtual int | get (KeySet &returned, Key &parentKey)
| Get all keys below parentKey inside returned.
virtual int | set (KeySet &returned, std::string const &keyname)
| Set all keys below keyname.
virtual int | set (KeySet &returned, Key &parentKey)
| Set all keys below parentKey.
virtual ElektraDiff | calculateChanges (KeySet &changedKeySet, std::string const &parentKeyName)
| Calculates the changes between the provided KeySet and the current state of the KDB.
virtual ElektraDiff | calculateChanges (KeySet &changedKeySet, Key &parentKey)
| Calculates the changes between the provided KeySet and the current state of the KDB.
ckdb::KDB * | getKdb () const
| Passes out the raw kdb pointer.
ckdb::KDB * | operator* () const
| Is an abbreviation for getKdb.

## Detailed Description

Provides a merging wrapper around a KDB instance.

The wrapper allows to pass a three way merger instance that is used to resolve conflicts during KDB set.

## Member Function Documentation

## ◆ get() [1/2]

int kdb::tools::merging::MergingKDB::get | ( | KeySet & | returned,
|  | Key & | parentKey
| ) |  |
| override virtual

Behaves like the KDB get function.

See also
  KDB

Reimplemented from kdb::KDB.

## ◆ get() [2/2]

int kdb::tools::merging::MergingKDB::get | ( | KeySet & | returned,
|  | std::string const & | keyname
| ) |  |
| override virtual

Behaves like the KDB get function.

See also
  KDB

Reimplemented from kdb::KDB.

## ◆ synchronize() [1/2]

int kdb::tools::merging::MergingKDB::synchronize | ( | KeySet & | returned,
|  | Key & | parentKey,
|  | ThreeWayMerge & | merger
| ) |  |
| virtual

If a conflict occurs during set, the supplied merger is used to resolve the conflict.

If the conflict cannot be solved, an exception is thrown. If the KeySet was successfully written (either by merging or due the absence of a conflict) the supplied KeySet is updated with the new content of the file.

See also
  KDB

Exceptions

  MergingKDBException |

## ◆ synchronize() [2/2]

int kdb::tools::merging::MergingKDB::synchronize | ( | KeySet & | returned,
|  | std::string const & | keyname,
|  | ThreeWayMerge & | merger
| ) |  |
| virtual

Synchronizes the file with the supplied KeySet.

If a conflict occurs during set, the supplied merger is used to resolve the conflict. If the conflict cannot be solved, an exception is thrown. If the KeySet was successfully written (either by merging or due the absence of a conflict) the supplied KeySet is updated with the new content of the file.

See also
  KDB

Exceptions

  MergingKDBException |

The documentation for this class was generated from the following files:

- mergingkdb.hpp
- mergingkdb.cpp