.TH "md_src_plugins_dump_README" 3elektra "Sun May 29 2016" "Version 0.8.14" "Elektra" \" -*- nroff -*- .ad l .nh .SH NAME md_src_plugins_dump_README \- README .IP "\(bu" 2 infos = Information about dump plugin is in keys below .IP "\(bu" 2 infos/author = Markus Raab elektra@libelektra.org .IP "\(bu" 2 infos/licence = BSD .IP "\(bu" 2 infos/needs = .IP "\(bu" 2 infos/provides = storage .IP "\(bu" 2 infos/placements = getstorage setstorage .IP "\(bu" 2 infos/description = Dumps into a format tailored for complete KeySet semantics .PP .PP This plugin is a storage plugin that supports full Elektra semantics\&. Combined with a resolver plugin it already assembles a fully featured backend\&. No other plugins are needed\&. .PP .SS "Format" .PP The file format consists of a simple command language with arguments\&. When an argument is binary or string data the length needs to passed first\&. Because the size is known in advance, any binary dump is accepted\&. Terminating characters present no problem\&. The commands are assembled similar to the ones present in Elektra’s API\&. .PP The file starts with the magic word \fCkdbOpen\fP followed by a version number\&. Processing can be stopped immediately when it is not in Elektra’s dump format at all\&. A wrong version number most likely indicates that the version of the plugin is too old to recognise all commands in the file\&. The basic idea of the dump plugin is to write out the way that the KeySet needs to be constructed\&. The dump plugin interprets such a file\&. The file also looks similar to Ccode that would create the KeySet\&. Keys can contain any binary values and arbitrary metadata and are still stored and parsed correctly\&. The dump plugin can even reconstruct pointers to metadata to save memory\&. When a pointer to the same region of memory is found, a special command \fCkeyCopyMeta\fP is written out that is able to reconstruct the data structure the way it was before\&. The commands were designed to make parsing of the file an easy task\&. .PP .SS "Format Examples" .PP The serialised configuration can look like (0 bytes at end of strings are omitted): .PP .nf kdbOpen 1 ksNew 207 keyNew 27 1 system/elektra/mountpoints keyMeta 8 27 commentBelow are the mountpoints. keyEnd keyNew 32 19 system/elektra/mountpoints/dbusserialised Backend keyEnd keyNew 39 1 system/elektra/mountpoints/dbus/config keyMeta 8 72 commentThis is a configuration for a backend, see subkeys for more information keyEnd keyNew 53 1 system/elektra/mountpoints/fstab/config/struct/FStab keyCopyMeta 59 11 system/elektra/mountpoints/file systems/config/struct/FStabcheck/type keyEnd ksEnd .fi .PP .PP .SS "Examples" .PP Export a KeySet using \fCdump\fP: .PP .nf kdb export system/example dump > example.ecf .fi .PP .PP Import a KeySet using \fCdump\fP: .PP .nf cat example.ecf | kdb import system/example dump .fi .PP .PP Using grep/diff or other unix tools on the dump file\&. Make sure that you treat it as text file, e\&.g\&.: .PP .nf grep --text mountpoints example.ecf .fi .PP