Modules

ThingsDB can be extended with modules. A module is a binary file or Python code which accepts input from ThingsDB and returns with a response. Each module will be started by ThingsDB as a separate process. For Python code this means that a Python interpreter is started for every module. Modules keep running as long as ThingsDB is alive, but may be restarted from within ThingsDB using restart_module() on a single node, or with deploy_module() and/or refresh_module() which can be used to restart/re-install a module on all nodes.

See the hello world module section below for a tutorial on how to create and use modules in ThingsDB.

Function scope description
del_module @thingsdb Delete a module.
deploy_module @thingsdb Deploy code for a module.
refresh_module @thingsdb Refresh a module. This will stop, update (if required), and re-start a module.
has_module @thingsdb Check if a module exists.
module_info all scopes Show information about a module.
modules_info all scopes Show information about all module.
new_module @thingsdb Create a new module.
rename_module @thingsdb Rename an existing module.
restart_module @node Restart a module on a single node.
set_module_conf @thingsdb Change the module configuration.
set_module_scope @thingsdb Change the module scope.

Building modules

Modules can be created in any language. For some languages there exists a library which makes building a module an easy task. Refer below to a list of libraries and examples:

Language Library Example
Go go-timod Demo (echo-reply example)
Python py-timod Demo (echo-reply example)

List of modules

This is list with some tested modules. If you want you’re module in this list, feel free to modify the list and create a pull request!

Name Description
github.com/thingsdb/module-go-siridb For communicating with a SiriDB database.
github.com/thingsdb/module-go-requests For making HTTP requests.
github.com/thingsdb/module-py-demo Demo module using the Python language.
github.com/thingsdb/module-go-demo Demo module using the Go language.