.TH "autotoc_md429" 3elektra "Tue Nov 26 2019" "Version 0.9.1" "Elektra" \" -*- nroff -*-
.ad l
.nh
.SH NAME
autotoc_md429 \- Plugin: mmapstorage
.IP "\(bu" 2
infos = Information about the mmapstorage plugin is in keys below
.IP "\(bu" 2
infos/author = Mihael Pranjic mpranj@limun.org
.IP "\(bu" 2
infos/licence = BSD
.IP "\(bu" 2
infos/needs =
.IP "\(bu" 2
infos/provides = storage/mmapstorage
.IP "\(bu" 2
infos/recommends =
.IP "\(bu" 2
infos/placements = getstorage setstorage
.IP "\(bu" 2
infos/status = maintained unittest shelltest specific
.IP "\(bu" 2
infos/metadata =
.IP "\(bu" 2
infos/description = high performance storage using memory mapped files
.PP
.PP
This is a high performance storage plugin that supports full Elektra semantics\&.
.PP
The storage format uses Elektra's in-memory data layout and employs the \fCmmap()\fP system call to read/write data\&. The format is not portable across different architectures/platforms\&. The format can be seen as a memory dump of a keyset\&. Therefore, the files must not be edited by hand\&. Files written by mmapstorage are not intended to be human-readable\&.
.PP
Mount mmapstorage using \fCkdb mount\fP:
.PP
.PP
.nf
sudo kdb mount config\&.mmap user/tests/mmapstorage mmapstorage
.fi
.PP
.PP
Unmount mmapstorage using \fCkdb umount\fP:
.PP
.PP
.nf
sudo kdb umount user/tests/mmapstorage
.fi
.PP
.PP
The mmapstorage has two compilation variants:
.PP
.IP "1." 4
mmapstorage
.IP "2." 4
mmapstorage_crc
.PP
.PP
The \fCmmapstorage\fP will always be compiled on a supported system (see \fCDependencies\fP)\&. When zlib is available, we will additionally compile the \fCmmapstorage_crc\fP variant\&. The first variant does not do a CRC32 checksum of the critical data, while the second variant always checks the CRC32 checksum for additional security\&.
.PP
POSIX compliant system (including XSI extensions)\&.
.PP
Additionally, zlib is needed for the \fCmmapstorage_crc\fP compilation variant: \fCzlib1g-dev\fP or \fCzlib-devel\fP\&.
.PP
``\fC @section autotoc_md435 Mount mmapstorage to\fPuser/tests/mmapstorage` sudo kdb mount config\&.mmap user/tests/mmapstorage mmapstorage
.SH "Add some values via kdb set"
.PP
kdb set user/tests/mmapstorage 'Some root key' kdb set user/tests/mmapstorage/dir 'Directory within the hierarchy\&.' kdb set user/tests/mmapstorage/dir/leaf 'A leaf node holding some valuable data\&.' kdb meta-set user/tests/mmapstorage/dir/leaf superMetaKey 'Metadata is supported too\&.'
.SH "List the configuration tree below user/tests/mmapstorage"
.PP
kdb ls user/tests/mmapstorage #> user/tests/mmapstorage #> user/tests/mmapstorage/dir #> user/tests/mmapstorage/dir/leaf
.SH "Retrieve the new values"
.PP
kdb get user/tests/mmapstorage #> Some root key kdb get user/tests/mmapstorage/dir #> Directory within the hierarchy\&. kdb get user/tests/mmapstorage/dir/leaf #> A leaf node holding some valuable data\&. kdb meta-get user/tests/mmapstorage/dir/leaf superMetaKey #> Metadata is supported too\&.
.SH "Undo modifications to the database"
.PP
kdb rm -r user/tests/mmapstorage
.SH "Unmount mmapstorage"
.PP
sudo kdb umount user/tests/mmapstorage ```
.SS "Limitations"
Mapped files shall not be altered, otherwise the behavior is undefined\&.
.PP
The \fCmmap()\fP system call only supports regular files and so does the mmapstorage plugin with one notable exception: The plugin detects when it is called with the files \fC/dev/stdin\fP and \fC/dev/stdout\fP and makes an internal copy\&. This makes the plugin compatible with \fCkdb import\fP and \fCkdb export\fP\&.