Skip to content
This repository has been archived by the owner on Feb 16, 2025. It is now read-only.

[VeryOld] Keyname overhaul #3115

Closed
wants to merge 116 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
22ff913
core: first attempt at keyname overhaul
kodebach Oct 25, 2019
d853d7f
core: more work on keyname overhaul
kodebach Oct 27, 2019
af8ea1f
core: remove unused static functions
kodebach Nov 3, 2019
3516bc4
core: some fixes related to metakeys
kodebach Nov 3, 2019
927d764
core: fix test_plugin
kodebach Nov 3, 2019
7b5b172
core: fix ksLookup
kodebach Nov 3, 2019
9d04d20
core: fix ksCut
kodebach Nov 3, 2019
5836dcb
core: update keyNew (namespace only keys)
kodebach Nov 3, 2019
769d6d7
core: update keySetName (namespace only keys)
kodebach Nov 3, 2019
02f5f69
core: replace keyNew (0) with keyNew ("/", KEY_END)
kodebach Nov 3, 2019
ad30678
core: fix keyIsBelow et al
kodebach Nov 3, 2019
5a18297
core: fix testtool_backend
kodebach Nov 3, 2019
85fdd4b
core: fix ksCut (cascading)
kodebach Nov 3, 2019
66da220
core: remove tests for deprecated functions
kodebach Nov 3, 2019
f8b8207
core: fixes based on test_keyname
kodebach Nov 3, 2019
c269613
core: remove tests using deprecated features
kodebach Nov 3, 2019
b2f46e4
core: replace keyNew ("", ...) with keyNew ("/", ...)
kodebach Nov 3, 2019
0fc61d0
core: start work on colon after namespace
kodebach Nov 3, 2019
33b2c7a
core: update some tests
kodebach Nov 3, 2019
069ce7a
core: update more tests
kodebach Nov 3, 2019
9790ae3
core: update even more tests
kodebach Nov 3, 2019
6e3728d
libs: add colon after namespace in keynames
kodebach Nov 5, 2019
4a9cb9e
tests: add colon after namespace in keynames
kodebach Nov 5, 2019
b048e72
tests: restore test_trie
kodebach Nov 5, 2019
271729b
tests: fix test_internal
kodebach Nov 5, 2019
00edb24
tests: rename ease keyname test
kodebach Nov 6, 2019
a17aab8
core: re-implement elektraKeyNameValidate and update callers
kodebach Nov 6, 2019
a873729
tests: add tests for elektraKeyNameValidate and co and fix bugs
kodebach Nov 7, 2019
a50aa79
tests: add tests for elektraKeyNameEscapePart and fix bugs in related…
kodebach Nov 7, 2019
9b036aa
tests: fix other tests and some bugs
kodebach Nov 7, 2019
9aa2cd5
tests: add more tests for elektraKeyNameValidate
kodebach Nov 8, 2019
dc28e84
tests: re-implement elektraKeyNameValidate again, this time with work…
kodebach Nov 8, 2019
4e761b4
core: add default namespace (not implemented everywhere yet)
kodebach Nov 8, 2019
97884af
core: fix uinit condition problems
kodebach Nov 8, 2019
a71e594
core: fix bugs in elektraKeyNameValidate
kodebach Nov 8, 2019
44b46c7
test: fix various tests
kodebach Nov 8, 2019
48e11e6
core: allow metaName with and without namespace in keyGetMeta and key…
kodebach Nov 8, 2019
2f60067
opts: make libopts compatible with new meta namespace
kodebach Nov 8, 2019
dac433b
include: update keynames
kodebach Nov 8, 2019
73234db
bindings: update keynames (not validated)
kodebach Nov 8, 2019
97c9d1f
tools: update key names (not validated)
kodebach Nov 8, 2019
c85a49e
plugins: update key names (not validated)
kodebach Nov 8, 2019
56b89f3
various: update more key names (not validated)
kodebach Nov 8, 2019
c177e91
all: reformat
kodebach Nov 8, 2019
d194425
all: fix after rebase
kodebach Nov 8, 2019
8417605
core: change trie to not use Keys
kodebach Nov 10, 2019
d325204
core: document meta:/ prefixing in keyGetMeta and keySetMeta
kodebach Nov 10, 2019
b590233
core: fix key name locking
kodebach Nov 10, 2019
82eef06
tests: add new trie test
kodebach Nov 10, 2019
2bc1fe6
core: assert that keyNew succeeds
kodebach Nov 10, 2019
f833b8a
core: fix lookup by spec links
kodebach Nov 10, 2019
053dcca
cmake: fix keynames in generate_readme
kodebach Nov 10, 2019
1a29f53
various: fix more keynames
kodebach Nov 10, 2019
1c48851
core: fix memory problems
kodebach Nov 10, 2019
2daa5d9
ini: fix metadata keynames
kodebach Nov 10, 2019
d58a1b8
quickdump: fix metadata keynames
kodebach Nov 10, 2019
ff21336
core: also canonicalize in reverse because of .. parts
kodebach Nov 10, 2019
c0ed92d
core: fix bug in elektraKeyNameValidate
kodebach Nov 10, 2019
8f90964
resolver: fix tests
kodebach Nov 10, 2019
9e95fcc
core: replace assert with warning for invalid keynames
kodebach Nov 10, 2019
4184c8a
hosts: fix meta namespace
kodebach Nov 10, 2019
cc4f3fd
specload: fix meta namespace
kodebach Nov 10, 2019
b2bc97d
type: fix new key names
kodebach Nov 10, 2019
0d8b7a4
core: fix keyIsBelow
kodebach Nov 10, 2019
aa01cca
spec: update and fix
kodebach Nov 10, 2019
d2bf776
core: fix default lookup
kodebach Nov 10, 2019
d3a09c7
tests: update keynames in data
kodebach Nov 12, 2019
1628cb6
various: fix more key name problems
kodebach Nov 12, 2019
dca4842
core: fix error specification key names
kodebach Nov 12, 2019
6a84f88
various: try to fix some more key name related stuff
kodebach Nov 12, 2019
399badf
all: fix c++ printError functions
kodebach Nov 12, 2019
0a59175
mmapstorage: fix keyname in testmod
kodebach Nov 12, 2019
00e76ea
testabi: update key names
kodebach Nov 12, 2019
728e86a
cpp: fix binding and tests
kodebach Nov 13, 2019
eb0c334
ccode: fix namespaces
kodebach Nov 13, 2019
3c4cdbb
dbus: fix namespaces
kodebach Nov 13, 2019
38bcc51
xmltool: fix namespaces
kodebach Nov 13, 2019
c0d6246
list: fix key names
kodebach Nov 13, 2019
31dadc0
various: fix more key name problems
kodebach Nov 13, 2019
b3bd303
cache: delete mysterious files
kodebach Nov 13, 2019
7633b4c
resolver: fix key names
kodebach Nov 13, 2019
0580674
tests: fix some abi tests
kodebach Nov 14, 2019
7083319
all: fix key names
kodebach Nov 14, 2019
f0e7c0f
cpp: fix keyMeta double free
kodebach Nov 14, 2019
42b0ace
change FIXME to TODO
kodebach Nov 14, 2019
110913c
tests: fix abi tests
kodebach Nov 15, 2019
3eb4206
core: fix problem with complex escapes in key name validate/canonicalize
kodebach Nov 15, 2019
2974fef
tests: fix some cpp tests
kodebach Nov 15, 2019
60c9e0f
core: allow keynames starting with %
kodebach Nov 15, 2019
327b02d
tools: fix key name related stuff
kodebach Nov 15, 2019
ad49128
all: add KEY_NS_DEFAULT to various switch statements
kodebach Nov 16, 2019
db0f63b
all: update key names in docu and shell scripts etc
kodebach Nov 16, 2019
0f67a6f
all: fix more key names
kodebach Nov 16, 2019
3d42ea5
all: fix most remaining tests
kodebach Nov 17, 2019
0823d13
all: fix even more tests
kodebach Nov 17, 2019
0d59bf3
Apply suggestions from code review
kodebach Nov 18, 2019
befa39b
kdb: fix double slash in kdb complete
kodebach Nov 20, 2019
e4e6164
core: fix cache
kodebach Nov 20, 2019
fb7f3ca
cpp: fix contextual values
kodebach Nov 20, 2019
87b85ba
add proposal for key names
kodebach Nov 24, 2019
506dfb5
keynames proposal: add proofs
kodebach Nov 25, 2019
89689e3
core: fix elektraFindBaseNamePtr escape handling
kodebach Nov 25, 2019
2111ff7
all: remove deprecated stuff and fix key name stuff
kodebach Nov 27, 2019
21a2056
fix formatting
kodebach Nov 27, 2019
f5aa4e6
yamlcpp: fix more key name problems
kodebach Nov 27, 2019
f5c1525
yajl: fix more keyname stuff
kodebach Nov 27, 2019
27babaa
glib: remove deprecated function
kodebach Nov 27, 2019
91bc9fe
all: fix after rebase
kodebach Nov 27, 2019
0f98b83
fix spelling
kodebach Nov 28, 2019
30841c1
xerces: fix meta names
kodebach Nov 28, 2019
ee2b5b1
rust: fixes for key name changes
kodebach Nov 28, 2019
6fee0ab
python: fix tests for new key names
kodebach Nov 28, 2019
65c67fd
ruby: fix tests for new key names
kodebach Nov 28, 2019
07db370
lua: fix for new key names
kodebach Nov 28, 2019
3a7c4ee
glib: fix for new key names
kodebach Nov 28, 2019
3645f79
kdb: fix cache for default mountpoint
kodebach Nov 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ Please provide a step by step guide on how to reproduce the problem here. If pos
syntax:

```sh
kdb set user/tests/hello world
#> Create a new key user/tests/hello with string "world"
kdb set user:/tests/hello world
#> Create a new key user:/tests/hello with string "world"

kdb get user/tests/hello
kdb get user:/tests/hello
#> world

kdb get user/does/not/exist
kdb get user:/does/not/exist
# RET: 11
# STDERR: [Dd]id not find key 'user/does/not/exist'
# STDERR: [Dd]id not find key 'user:/does/not/exist'

kdb rm user/tests/hello
kdb rm user:/tests/hello
```

If your key database (KDB) might influence the outcome, please use `kdb stash`
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ KeySet * generateKeySet (const size_t size, int32_t * seed, KeySetShape * shape)
}
for (size_t i = 0; i < root->numberofChildren; ++i)
{
Key * key = keyNew ("", KEY_END);
Key * key = keyNew ("/", KEY_END);
if (!key)
{
printExit ("generateKeySet: Can not create Key");
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <time.h>

#define KEY_ROOT "user/benchmark"
#define KEY_ROOT "user:/benchmark"

#define KEY_NAME_LENGTH 1000
#define NUM_DIR 200
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/kdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main (void)
fprintf (stdout, "%s;%s;%s\n", "plugin", "operation", "microseconds");
{
KeySet * returned = ksNew (0, KS_END);
Key * parentKey = keyNew ("user", KEY_END);
Key * parentKey = keyNew ("user:/", KEY_END);

timeInit ();
KDB * handle = kdbOpen (parentKey);
Expand All @@ -49,7 +49,7 @@ int main (void)
for (size_t i = 0; i < NUM_RUNS; ++i)
{
timeInit ();
Key * parentKey = keyNew ("user/benchmark", KEY_END);
Key * parentKey = keyNew ("user:/benchmark", KEY_END);
KDB * handle = kdbOpen (parentKey);
fprintf (stdout, CSV_STR_FMT, "core", "kdbOpen", timeGetDiffMicroseconds ());

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/memoryleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main (void)
KDB * handles[NUM_RUNS];
KeySet * keysets[NUM_RUNS];

Key * parentKey = keyNew ("user", KEY_END);
Key * parentKey = keyNew ("user:/", KEY_END);

for (size_t i = 0; i < NUM_RUNS; ++i)
{
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/opmphm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,7 @@ static void shapefCommonStartEnd (const size_t initSize ELEKTRA_UNUSED, size_t s
}
}
/**
* modules, level 1 keys same, one level 2 key stores the modules. Like system/elektra.
* modules, level 1 keys same, one level 2 key stores the modules. Like system:/elektra.
*/
static void * shapeModulesInit (void)
{
Expand Down Expand Up @@ -2496,13 +2496,13 @@ static void shapefModules (const size_t initSize, size_t size ELEKTRA_UNUSED, si
uint8_t * assign = &d[3];
if (level == 1)
{
// common start, simulates elektra in system/elektra
// common start, simulates elektra in system:/elektra
ret->subKeys = 1;
ret->label = 0;
}
else if (level == 2)
{
// common name, simulates modules in system/elektra/modules
// common name, simulates modules in system:/elektra/modules
// calculates how many modules have space
ret->subKeys = 0;
ssize_t remainingSize = initSize;
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/plugingetset.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main (int argc, char ** argv)
KeySet * conf = ksNew (0, KS_END);
KeySet * modules = ksNew (0, KS_END);
elektraModulesInit (modules, 0);
Key * errorKey = keyNew ("", KEY_END);
Key * errorKey = keyNew ("/", KEY_END);
Plugin * plugin = elektraPluginOpen (pluginname, modules, conf, errorKey);
keyDel (errorKey);

Expand All @@ -69,7 +69,7 @@ int main (int argc, char ** argv)
KeySet * conf = ksNew (0, KS_END);
KeySet * modules = ksNew (0, KS_END);
elektraModulesInit (modules, 0);
Key * errorKey = keyNew ("", KEY_END);
Key * errorKey = keyNew ("/", KEY_END);
Plugin * plugin = elektraPluginOpen (pluginname, modules, conf, errorKey);
keyDel (errorKey);
plugin->kdbSet (plugin, ks, setKey);
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static int benchmarkOpenPlugins (void)
modules[i] = ksNew (0, KS_END);
elektraModulesInit (modules[i], 0);
KeySet * conf = ksNew (0, KS_END);
Key * errorKey = keyNew ("", KEY_END);
Key * errorKey = keyNew ("/", KEY_END);
Plugin * plugin = elektraPluginOpen (pluginNames[i], modules[i], conf, errorKey);

const Key * metaWarnings = keyGetMeta (errorKey, "warnings");
Expand Down Expand Up @@ -104,7 +104,7 @@ int main (int argc, char ** argv)
init (argc, argv);

Plugin * plugin = plugins[i];
Key * parentKey = keyNew ("user/benchmarks/storage", KEY_VALUE, tmpfilename, KEY_END);
Key * parentKey = keyNew ("user:/benchmarks/storage", KEY_VALUE, tmpfilename, KEY_END);

for (size_t run = 0; run < NUM_RUNS; ++run)
{
Expand Down
2 changes: 1 addition & 1 deletion doc/METADATA.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ example=internal/ini/parent could be the name for internal parent
status= idea
description= states where a key comes from if it is not from an ordinary
persistent configuration. E.g. hardware (queries)
e.g. system/sw/xorg/current/monitor might have "source" metadata if it
e.g. system:/sw/xorg/current/monitor might have "source" metadata if it
is queried from hardware and not from configuration file.

[dependency/control]
Expand Down
14 changes: 7 additions & 7 deletions doc/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ You have some options to avoid running them as root:

```sh
kdb mount-info
echo `kdb sget system/info/elektra/constants/cmake/CMAKE_INSTALL_PREFIX .`/`kdb sget system/info/elektra/constants/cmake/KDB_DB_SPEC .`
echo `kdb sget system/info/elektra/constants/cmake/KDB_DB_SYSTEM .`
echo `kdb sget system:/info/elektra/constants/cmake/CMAKE_INSTALL_PREFIX .`/`kdb sget system:/info/elektra/constants/cmake/KDB_DB_SPEC .`
echo `kdb sget system:/info/elektra/constants/cmake/KDB_DB_SYSTEM .`
```

Then change the permissions:

```sh
chown -R `whoami` `kdb sget system/info/elektra/constants/cmake/CMAKE_INSTALL_PREFIX .`/`kdb sget system/info/elektra/constants/cmake/KDB_DB_SPEC .`
chown -R `whoami` `kdb sget system/info/elektra/constants/cmake/KDB_DB_SYSTEM .`
chown -R `whoami` `kdb sget system:/info/elektra/constants/cmake/CMAKE_INSTALL_PREFIX .`/`kdb sget system:/info/elektra/constants/cmake/KDB_DB_SPEC .`
chown -R `whoami` `kdb sget system:/info/elektra/constants/cmake/KDB_DB_SYSTEM .`
```

After that all test cases should run successfully as described above.
Expand Down Expand Up @@ -195,7 +195,7 @@ are expected to be in the README.md of the plugin.
- should not run, if `ENABLE_KDB_TESTING` is OFF.
- should only write below
- `/tests/<testname>` (e.g. `/tests/ruby`) and
- `system/elektra` (e.g. for mounts or globalplugins).
- `system:/elektra` (e.g. for mounts or globalplugins).
- Before executing tests, no keys must be present below `/tests`.
The test cases need to clean up everything they wrote.
(Including temporary files)
Expand Down Expand Up @@ -323,13 +323,13 @@ cp ~e/src/plugins/ini/ini/* testcase_dir
Fewer files is better. Then run, for example:

```sh
LD_LIBRARY_PATH=`pwd`/lib /usr/src/afl/afl-2.52b/afl-fuzz -i testcase_dir -o findings_dir bin/kdb import user/tests ini
LD_LIBRARY_PATH=`pwd`/lib /usr/src/afl/afl-2.52b/afl-fuzz -i testcase_dir -o findings_dir bin/kdb import user:/tests ini
```

Check if something is happening with:

```sh
watch kdb export user/tests
watch kdb export user:/tests
```

### ASAN
Expand Down
8 changes: 4 additions & 4 deletions doc/VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ information.
The same information can be retrieved at run-time using

```
system/elektra/version/constants/KDB_VERSION
system/elektra/version/constants/KDB_VERSION_MAJOR
system/elektra/version/constants/KDB_VERSION_MICRO
system/elektra/version/constants/KDB_VERSION_MINOR
system:/elektra/version/constants/KDB_VERSION
system:/elektra/version/constants/KDB_VERSION_MAJOR
system:/elektra/version/constants/KDB_VERSION_MICRO
system:/elektra/version/constants/KDB_VERSION_MINOR
```

This is the API to programs using Elektra. Its interface
Expand Down
28 changes: 14 additions & 14 deletions doc/VISION.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ as desired.
Either by either invoking [command-line tools](/doc/help/kdb.md):

```sh
kdb set system/sw/samba/#0/current/global/workgroup MYGROUP
kdb set system:/sw/samba/#0/current/global/workgroup MYGROUP
```

Also by importing an INI file with the information:

```ini
kdb import system/sw/samba/#0/current ini << HERE
kdb import system:/sw/samba/#0/current ini << HERE
[global]
workgroup=MYGROUP
HERE
Expand All @@ -49,7 +49,7 @@ with neither code generation nor error handling):
int main ()
{
ElektraError* error;
Elektra * elektra = elektraOpen ("system/sw/samba/#0/current", 0, &error);
Elektra * elektra = elektraOpen ("system:/sw/samba/#0/current", 0, &error);
elektraSetString (elektra, "global/workgroup", "MYGROUP", &error);
elektraClose (elektra);
}
Expand All @@ -62,7 +62,7 @@ Or using some interpreted language like Python
import kdb
k = kdb.KDB()
ks = kdb.KeySet()
s = "system/sw/samba/#0/current"
s = "system:/sw/samba/#0/current"
k.get (ks, s)
ks.append(kdb.Key(s+"/global/workgroup", kdb.KEY_VALUE, "MYGROUP"))
k.set (ks, s)
Expand All @@ -75,7 +75,7 @@ change a configuration value.
Key-value access in [puppet-libelektra](https://puppet.libelektra.org):

```
kdbkey {'system/sw/samba/#0/current/global/workgroup':
kdbkey {'system:/sw/samba/#0/current/global/workgroup':
ensure => 'present',
value => 'MYGROUP'
}
Expand All @@ -84,7 +84,7 @@ kdbkey {'system/sw/samba/#0/current/global/workgroup':
Key-value access in Chef:

```
kdbset 'system/sw/samba/#0/current/global/workgroup' do
kdbset 'system:/sw/samba/#0/current/global/workgroup' do
value 'MYGROUP'
action :create
end
Expand All @@ -99,12 +99,12 @@ Key-value access in Ansible:
tasks:
- name: set workgroup
elektra:
key: "system/sw/samba/#0/current/global/workgroup"
key: "system:/sw/samba/#0/current/global/workgroup"
value: "MYGROUP"
```

In all these examples, we have set
`system/sw/samba/#0/current/global/workgroup` to `MYGROUP`.
`system:/sw/samba/#0/current/global/workgroup` to `MYGROUP`.

## Application Integration

Expand Down Expand Up @@ -148,7 +148,7 @@ shown above can be used. To make mounting more simple, we introduced an
extra tool:

```sh
kdb mount /etc/samba/smb.conf system/sw/samba/#0/current ini
kdb mount /etc/samba/smb.conf system:/sw/samba/#0/current ini
```

Mounting can also be done via configuration management
Expand All @@ -157,12 +157,12 @@ tools.
Mounting in puppet-libelektra:

```
kdbmount {'system/sw/samba/#0/current':
kdbmount {'system:/sw/samba/#0/current':
ensure => 'present',
file => '/etc/samba/smb.conf',
plugins => 'ini'
}
kdbkey {'system/sw/samba/global/log level':
kdbkey {'system:/sw/samba/global/log level':
ensure => 'absent'
}
```
Expand All @@ -176,7 +176,7 @@ Mounting in Ansible:
tasks:
- name: set workgroup
elektra:
mountpoint: system/sw/samba
mountpoint: system:/sw/samba
file: /etc/samba/smb.conf
plugins: ini
```
Expand Down Expand Up @@ -209,7 +209,7 @@ kdb set-meta /sw/samba/#0/current/global/workgroup description "This controls wh
Key-value specifications in [puppet-libelektra](https://puppet.libelektra.org):

```
kdbkey {'system/sw/samba/#0/current/global/workgroup':
kdbkey {'system:/sw/samba/#0/current/global/workgroup':
ensure => 'present',
check => {
'type' => 'string',
Expand All @@ -224,7 +224,7 @@ kdbkey {'system/sw/samba/#0/current/global/workgroup':
```

Note, that the specification (in both examples above) actually lands up in
`spec/sw/samba/#0/current/global/workgroup`. The unique path to the
`spec:/sw/samba/#0/current/global/workgroup`. The unique path to the
configuration setting is `/sw/samba/#0/current/global/workgroup`, but
the specification gets written to the [namespace](/doc/tutorials/namespaces.md)
`spec`, while the system-configuration gets written to the namespace `system`.
Expand Down
13 changes: 5 additions & 8 deletions doc/decisions/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Currently the default backend (default.ecf) will also be used for bootstrapping. There are two problems with this approach:

1. Thus the default backend first will be read with parentKey `system/elektra` and later with parentKey `system`, it needs to store absolute paths and thus won't work with the current INI plugin
1. Thus the default backend first will be read with parentKey `system:/elektra` and later with parentKey `system:/`, it needs to store absolute paths and thus won't work with most of the plugins (except dump).
2. When `system` is large without mount points, everything is reread twice during bootstrapping.

## Constraints
Expand All @@ -19,7 +19,7 @@ Currently the default backend (default.ecf) will also be used for bootstrapping.

## Considered Alternatives

- Implement a hack so that `system/elektra` is actually read as `system`. (Will not solve problem 2.)
- Implement a hack so that `system:/elektra` is actually read as `system:/`. (Will not solve problem 2.)
- Its a hack.
- Its confusing and does not play well with persistent data with relative key names.
- Split up without compatibility mode: would need to migrate all mount points by exporting (with old version!) and then importing (with new version!)
Expand All @@ -33,10 +33,8 @@ The default backend reading `default.ecf` is only relevant as long as no root ba

Algorithm:

1. try to get system/elektra using the file elektra.ecf (KDB_DB_INIT)
2. if it works, mount the init backend to system/elektra (non-fallback mode)
3. if it fails (== 0 or == -1), try default.ecf as fallback
4. if the fallback works (i.e. keys are present in system/elektra), mount the default backend to system/elektra (fallback mode)
1. try to get system:/elektra using the file elektra.ecf (KDB_DB_INIT)
2. if it works, mount the init backend to system:/elektra

## Rationale

Expand All @@ -46,7 +44,6 @@ Algorithm:

## Implications

- Fallback mode should be removed with 1.0
- added scripts/upgrade-bootstrap

## Related Decisions
Expand All @@ -56,4 +53,4 @@ Algorithm:
to upgrade to new system, either:

- touch /etc/kdb/elektra.ecf (loses old mount points)
- or do kdb export system/elektra/mountpoints, kdb rm -r system/elektra/mountpoints, kdb import system/elektra/mountpoints
- or do kdb export system:/elektra/mountpoints, kdb rm -r system:/elektra/mountpoints, kdb import system:/elektra/mountpoints
8 changes: 4 additions & 4 deletions doc/decisions/global_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Configuration will be in arrays below the keys:

```
system/elektra/globalplugins
system:/elektra/globalplugins
/prerollback
/rollback
/postrollback
Expand Down Expand Up @@ -199,7 +199,7 @@ getresolver/after/once
Its useful to have some important global plugins, e.g. locking by default.
See #690.

Internal list to be used when no system/elektra/global_mountpoints/ exists.
Internal list to be used when no system:/elektra/global_mountpoints/ exists.

State diagrams of plugins need to be redrawn to also include global plugin
states.
Expand All @@ -215,9 +215,9 @@ states.
## Implementation Hints

- add `Plugin *globalPlugins [NR_OF_PLUGINS]` to `_KDB`
- during `kdbOpen`, `system/elektra/globalplugins/` is read and plugins are constructed and placed into `globalPlugins`.
- during `kdbOpen`, `system:/elektra/globalplugins/` is read and plugins are constructed and placed into `globalPlugins`.
- In kdbGet and kdbSet hooks execute one of these plugins
- by default
- the plugins are all the same `list` plugins, and their subplugins are executed, when `system/elektra/globalplugins/_` states they should be executed
- the plugins are all the same `list` plugins, and their subplugins are executed, when `system:/elektra/globalplugins/_` states they should be executed
- a `lock` plugin that executes at begin and end of kdbGet and kdbSet, respective, i.e. postrollback preget postget preset postcommit
- the `lock` plugin contains the code currently found in resolver
Loading