$darkmode
Elektra 0.11.0
|
Elektra provides developers of applications and plugins a way to determine changes made to a KeySet
relative to the last known state of the key database. This can be useful if you are writing a plugin that works with changes of the configuration.
The two headers you have to use are kdbchangetracking.h
and kdbdiff.h
. Those declare the elektraChangeTracking*
and elektraDiff*
functions.
The two main data structures you will encounter are ChangeTrackingContext
and ElektraDiff
.
If all you want to do is get the difference between two in-memory KeySet
objects, use the function elektraDiffCalculate
.
If you are writing a plugin, you can use elektraChangeTrackingGetContextFromPlugin
to get the current ChangeTrackingContext
. Then, use elektraChangeTrackingCalculateDiff
to calculate the changes to the KDB.
If you are elektrifying your app, you can use elektraChangeTrackingGetContextFromKdb
to get the current ChangeTrackingContext
for your KDB instance. Then, use elektraChangeTrackingCalculateDiff
to calculate the changes to the KDB.
Congratulations! You've got your diff! Now what? Elektra provides you with different functions to determine added, removed and modified keys, as well as added, removed and modified metadata.
You can use the following methods to reason about changes to the keyset as a whole:
Use these methods to get information about single keys: