Skip to content

Latest commit

 

History

History
 
 

elektrad

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Elektrad

Introduction

A server that provides an HTTP API to access Elektra remotely, built using Go.

Lifetime of KDB handles

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.

Source structure

*_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.

Compiling

You can compile elektrad manually or via CMake.

If go-elektra fails to compile checkout the README.md for troubleshooting.

Manually

  • 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

With CMake

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.

Installing

You can install Elektra as described in the install documentation.

To Run

To launch elektrad run the command

kdb run-elektrad

Flags

-port 33333 - change the port the server uses.

API

By default, elektrad runs on http://localhost:33333