- infos/maintainer = Tomislav Makar tmakar23@gmail.com
A server that provides an HTTP API to access Elektra remotely, built using Go.
Elektrad
uses the go-elektra binding to access the libelektra
core functionalities which are written in C.
Instantiating a KDB Handle for every request is expensive, espescially for big KDB databases, and prevents handling of conflicts. To mitigate this issue sessions with an associated handle are created. One hour after the last request these sessions are destroyed and the KDB handle is closed.
*_handler.go
files contain the HTTP handler functions.
*_handler_test.go
files contain the corresponding handler tests.
temp-elektra.pc.in
that CMAKE leverages to create an intermediate pkg-config file that tells the GO compiler where it can find the Elektra header files and symbols during the build step.
middleware.go
contains the HTTP middleware - such as user session (and caching of Elektra handles) management.
router.go
is responsible for setting up the API routes.
main.go
is the entry point of the server.
You can compile elektrad
manually or via CMake.
If go-elektra
fails to compile checkout the README.md for troubleshooting.
- make sure you have go (>1.13) installed.
- install libelektra.
- now run
go build
in the elektrad folder with Go modules enabled (GO111MODULE=on).
The output of go build
is a binary, you can simply run it with:
./elektrad
Compile Elektra as described in the COMPILE document, make sure to include the web
and kdb
tool using the -DTOOLS
flag, e.g. -DTOOLS="kdb;web"
.
The binary is located at build-dir/src/tools/web/elektrad
and symlinked to build-dir/bin/elektrad
.
You can install Elektra as described in the install documentation.
To launch elektrad run the command
kdb run-elektrad
-port 33333
- change the port the server uses.
By default, elektrad
runs on http://localhost:33333
- API documentation: https://elektrad.docs.apiary.io/
- API blueprint: elektrad.apib