Skip to content

Commit

Permalink
Merge pull request #2831 from mpranj/cache-tools
Browse files Browse the repository at this point in the history
Cache tools
  • Loading branch information
markus2330 committed Aug 3, 2019
2 parents bb8a171 + f51b8cb commit b04c7f8
Show file tree
Hide file tree
Showing 28 changed files with 506 additions and 63 deletions.
2 changes: 1 addition & 1 deletion doc/AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ notification system, I/O bindings

## Mihael Pranjić

development of the mmapstorage plugin
development of the cache and mmapstorage plugins

- email: mpranj@limun.org
- github user: [mpranj](https://github.com/mpranj)
Expand Down
2 changes: 1 addition & 1 deletion doc/BIGPICTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ one of them would be useless. Main differences are:
look like and reject invalid configuration.
- and much more...

## Further pointers
## Further Readings

- Continue reading the [tutorials](/doc/tutorials)
- Read about [bindings](/src/bindings/)
Expand Down
6 changes: 6 additions & 0 deletions doc/METADATA.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1364,3 +1364,9 @@ type = string
usedby/plugins = type
description = overrides the allowed false value for this key. Only the given value or 0 will be allowed as false. All false keys will be restored to this value in `kdbSet`.
Must be used together with check/boolean/true.

[cache/clear]
status = implemented
usedby/plugins = cache
type = boolean
description = tells the cache plugin to remove all cache files during the next `kdbGet` in a safe way.
128 changes: 128 additions & 0 deletions doc/VISION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# VISION

The vision of Elektra is to have
systems in which every configuration
setting is easily accessible and specifiable.

We will use samba and its configuration value
`global/workgroup` as running example.

## Problem

Currently, the administrator would first need to
locate the configuration file (it could be
`/etc/samba/smb.conf`

## Configuration Management

By a single invocation of a command-line tool
it should be possible to change a configuration
value:

If you already use configuration management tools,
the vision is that a single statement suffices to
change a configuration value:

Key/value access in Chef:

```
kdbset 'system/sw/samba/global/workgroup' do
value 'MY_WORKGROUP'
action :create
end
```

Key/value access in Ansible:

```yaml
- name: setup samba workgroup
connection: local
hosts: localhost
tasks:
- name: set workgroup
elektra:
key: "system/sw/samba/global/workgroup"
value: "MY_WORKGROUP"
```
elektra:
mountpoint: system/sw/samba
file: /etc/samba/smb.conf
plugins: ini
Key/value access in puppet-libelektra:
```
kdbkey {'system/sw/samba/global/workgroup':
ensure => 'present',
value => 'MY_WORKGROUP'
}
```

## Legacy

The vision also includes legacy applications which do
not directly use Elektra. Then distributions can mount
configuration files, so that the configuration is
visible within Elektra.

Mounting can also be done via configuration management
tools.

Mounting in puppet-libelektra:

```
kdbmount {'system/sw/samba':
ensure => 'present',
file => '/etc/samba/smb.conf',
plugins => 'ini'
}
kdbkey {'system/sw/samba/global/log level':
ensure => 'absent'
}
```

## Specifications

Key/value specifications in puppet-libelektra:

```
kdbkey {'system/sw/samba/global/log level':
ensure => 'present',
value => 'MY_WORKGROUP',
check => {
'type' => 'short',
'range' => '0-10',
'default' => '1',
'description' => 'Sets the amount of log/
debug messages that are sent to the
log file. 0 is none, 3 is consider-
able.'
}
```

Ideally, applications already specify their settings.

\end{frame}

## Unique Key Names

The main technique to achieve the vision is
unique key names: Every configuration setting
can be addressed by its unique key name.

With this unique key name, we get an identifier,
which can be used at all places throughout the
system.

## Common Data Structure

## Abstract Configuration For New Applications

## Integrate Legacy Applications

## Specify Keys

## Facilitate Configuration Management

- Continue reading [big picture](BIGPICTURE.md)
3 changes: 1 addition & 2 deletions doc/WHY.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ Features that rarely can be found elsewhere (at least in this combination):

## Further Readings

- Continue reading [big picture](BIGPICTURE.md)
- Continue reading [the vision](VISION.md).
- Look into [the glossary](/doc/help/elektra-glossary.md).
- For more about tools go on reading [here](/doc/help/kdb.md).
- Another viewpoint [why to use Elektra is described here](/doc/help/elektra-introduction.md)
- [Compile](COMPILE.md) and [Install](INSTALL.md) Elektra
10 changes: 5 additions & 5 deletions doc/help/elektra-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ result is GPL.

## How Can I Advertise Elektra?

If questions about configuration come up, point users to https://www.libelektra.org
Display the SVG logos found at https://master.libelektra.org/doc/images/logo
and already rastered logos at https://github.com/ElektraInitiative/blobs/tree/master/images/logos
Distribute the flyer found at https://github.com/ElektraInitiative/blobs/raw/master/flyers/flyer.odt
And of course: talk about it!
- If questions about configuration come up, point users to https://www.libelektra.org
- Display the SVG logos found at https://master.libelektra.org/doc/images/logo
- and already rastered logos at https://github.com/ElektraInitiative/blobs/tree/master/images/logos
- Distribute the flyer found at https://github.com/ElektraInitiative/blobs/raw/master/flyers/flyer.odt
- And of course: talk about it!
50 changes: 50 additions & 0 deletions doc/help/kdb-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# kdb-cache(1) -- Enable, disable or clear the cache

## SYNOPSIS

`kdb cache {enable,disable,default,clear}`

## DESCRIPTION

This command is used to enable or disable the cache and to revert
to the default settings. The default settings will let the system
decide whether to use the cache or not. The clear command will
remove the generated cache files in a safe way.

## LIMITATIONS

Caches are stored on a per-user basis, therefore the `clear`
subcommand can only remove a user's cache files (i.e. not system wide).

## OPTIONS

- `-H`, `--help`:
Show the man page.
- `-V`, `--version`:
Print version info.
- `-p`, `--profile <profile>`:
Use a different kdb profile.
- `-C`, `--color <when>`:
Print never/auto(default)/always colored output.
- `-v`, `--verbose`:
Explain what is happening. Prints additional information in case of errors/warnings.
- `-d`, `--debug`:
Give debug information. Prints additional debug information in case of errors/warnings.

## EXAMPLES

```sh
# Backup-and-Restore: system/elektra/cache

# Enable the cache
kdb cache enable

# Disable the cache
kdb cache disable

# Revert to defaults
kdb cache default

# Clear all generated cache files
kdb cache clear
```
6 changes: 3 additions & 3 deletions doc/man/man1/kdb-backup.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-BACKUP" "" "June 2019" "" ""
.TH "KDB\-BACKUP" "" "August 2019" "" ""
.
.SH "NAME"
\fBkdb\-backup\fR \- Make a backup of current KDB
Expand All @@ -27,10 +27,10 @@ kdb backup
.SH "SEE ALSO"
.
.IP "\(bu" 4
kdb\-stash(7) \fIkdb\-stash\.md\fR
kdb\-stash(1) \fIkdb\-stash\.md\fR
.
.IP "\(bu" 4
kdb\-restore(7) \fIkdb\-restore\.md\fR
kdb\-restore(1) \fIkdb\-restore\.md\fR
.
.IP "" 0

63 changes: 63 additions & 0 deletions doc/man/man1/kdb-cache.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-CACHE" "1" "August 2019" "" ""
.
.SH "NAME"
\fBkdb\-cache\fR \- Enable, disable or clear the cache
.
.SH "SYNOPSIS"
\fBkdb cache {enable,disable,default,clear}\fR
.
.SH "DESCRIPTION"
This command is used to enable or disable the cache and to revert to the default settings\. The default settings will let the system decide whether to use the cache or not\. The clear command will remove the generated cache files in a safe way\.
.
.SH "LIMITATIONS"
Caches are stored on a per\-user basis, therefore the \fBclear\fR subcommand can only remove a user\'s cache files (i\.e\. not system wide)\.
.
.SH "OPTIONS"
.
.TP
\fB\-H\fR, \fB\-\-help\fR
Show the man page\.
.
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version info\.
.
.TP
\fB\-p\fR, \fB\-\-profile <profile>\fR
Use a different kdb profile\.
.
.TP
\fB\-C\fR, \fB\-\-color <when>\fR
Print never/auto(default)/always colored output\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Explain what is happening\. Prints additional information in case of errors/warnings\.
.
.TP
\fB\-d\fR, \fB\-\-debug\fR
Give debug information\. Prints additional debug information in case of errors/warnings\.
.
.SH "EXAMPLES"
.
.nf

# Backup\-and\-Restore: system/elektra/cache

# Enable the cache
kdb cache enable

# Disable the cache
kdb cache disable

# Revert to defaults
kdb cache default

# Clear all generated cache files
kdb cache clear
.
.fi

4 changes: 2 additions & 2 deletions doc/man/man1/kdb-change-resolver-symlink.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-CHANGE\-RESOLVER\-SYMLINK" "" "June 2019" "" ""
.TH "KDB\-CHANGE\-RESOLVER\-SYMLINK" "" "August 2019" "" ""
.
.SH "NAME"
\fBkdb\-change\-resolver\-symlink\fR \- Changes the default resolver symlink
Expand All @@ -24,7 +24,7 @@ Set default resolver plugin to resolver_fm_hpu_b:
.SH "SEE ALSO"
.
.IP "\(bu" 4
kdb\-change\-storage\-symlink(7) \fIkdb\-change\-storage\-symlink\.md\fR
kdb\-change\-storage\-symlink(1) \fIkdb\-change\-storage\-symlink\.md\fR
.
.IP "" 0

4 changes: 2 additions & 2 deletions doc/man/man1/kdb-change-storage-symlink.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-CHANGE\-STORAGE\-SYMLINK" "" "June 2019" "" ""
.TH "KDB\-CHANGE\-STORAGE\-SYMLINK" "" "August 2019" "" ""
.
.SH "NAME"
\fBkdb\-change\-storage\-symlink\fR \- Changes the default storage symlink
Expand All @@ -24,7 +24,7 @@ Set default storage plugin to ini:
.SH "SEE ALSO"
.
.IP "\(bu" 4
kdb\-change\-resolver\-symlink(7) \fIkdb\-change\-resolver\-symlink\.md\fR
kdb\-change\-resolver\-symlink(1) \fIkdb\-change\-resolver\-symlink\.md\fR
.
.IP "" 0

4 changes: 2 additions & 2 deletions doc/man/man1/kdb-check-env-dep.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-CHECK\-ENV\-DEP" "" "June 2019" "" ""
.TH "KDB\-CHECK\-ENV\-DEP" "" "August 2019" "" ""
.
.SH "NAME"
\fBkdb\-check\-env\-dep\fR \- Checks which mount points are influenced by environment variables
Expand All @@ -15,7 +15,7 @@ This command checks which mount point is influenced by changes to environment va
.SH "SEE ALSO"
.
.IP "\(bu" 4
kdb\-mount\-list\-all\-files(7) \fIkdb\-mount\-list\-all\-files\.md\fR
kdb\-mount\-list\-all\-files(1) \fIkdb\-mount\-list\-all\-files\.md\fR
.
.IP "" 0

2 changes: 1 addition & 1 deletion doc/man/man1/kdb-global-mount.1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ For every change of KDB, write to syslog and notify by dbus:
elektra\-glossary(7) \fIelektra\-glossary\.md\fR\.
.
.IP "\(bu" 4
kdb\-umount(7) \fIkdb\-umount\.md\fR\.
kdb\-umount(1) \fIkdb\-umount\.md\fR\.
.
.IP "\(bu" 4
elektra\-mounting(7) \fIelektra\-mounting\.md\fR\.
Expand Down
4 changes: 2 additions & 2 deletions doc/man/man1/kdb-global-umount.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "KDB\-GLOBAL\-UMOUNT" "1" "June 2019" "" ""
.TH "KDB\-GLOBAL\-UMOUNT" "1" "August 2019" "" ""
.
.SH "NAME"
\fBkdb\-global\-umount\fR \- Unmount a global plugin from the key database
Expand Down Expand Up @@ -57,7 +57,7 @@ sudo kdb global\-mount
.SH "SEE ALSO"
.
.IP "\(bu" 4
kdb\-global\-mount(7) \fIkdb\-global\-mount\.md\fR\.
kdb\-global\-mount(1) \fIkdb\-global\-mount\.md\fR\.
.
.IP "\(bu" 4
elektra\-mounting(7) \fIelektra\-mounting\.md\fR\.
Expand Down
Loading

0 comments on commit b04c7f8

Please sign in to comment.