Commit f9742127 authored by Petr Špaček's avatar Petr Špaček

etcd: rename module ketcd -> etcd

The old name was confusing because module name was different than all
other names and references in manual.
parent 2869abd7
......@@ -3,6 +3,7 @@ Knot Resolver 2.0.0 (2018-xx-yy)
Incompatible changes
--------------------
- script supervisor.py was removed, please migrate to a real process manager
- module ketcd was renamed to etcd for consistency
- module kmemcached was renamed to memcached for consistency
Knot Resolver 1.5.1 (2017-1x-yy)
......
......@@ -18,7 +18,7 @@ Knot DNS Resolver modules
.. include:: ../modules/graphite/README.rst
.. include:: ../modules/memcached/README.rst
.. include:: ../modules/redis/README.rst
.. include:: ../modules/ketcd/README.rst
.. include:: ../modules/etcd/README.rst
.. include:: ../modules/dns64/README.rst
.. include:: ../modules/renumber/README.rst
.. include:: ../modules/cookies/README.rst
......
......@@ -27,7 +27,7 @@ Example configuration
.. code-block:: lua
modules = {
ketcd = {
etcd = {
prefix = '/kresd',
peer = 'http://127.0.0.1:7001'
}
......
--- @module ketcd
local ketcd = {}
--- @module etcd
local etcd = {}
-- @function update subtree configuration
local function update_subtree(tree)
......@@ -17,39 +17,39 @@ local function update_subtree(tree)
end
-- @function reload whole configuration
function ketcd.reload()
local res, err = ketcd.cli:readdir('/', true)
function etcd.reload()
local res, err = etcd.cli:readdir('/', true)
if err then
error(err)
end
update_subtree(res.body.node.nodes)
end
function ketcd.init()
ketcd.Etcd = require('etcd.luasocket')
ketcd.defaults = { prefix = '/kresd' }
function etcd.init()
etcd.Etcd = require('etcd.luasocket')
etcd.defaults = { prefix = '/kresd' }
end
function ketcd.deinit()
if ketcd.ev then event.cancel(ketcd.ev) end
function etcd.deinit()
if etcd.ev then event.cancel(etcd.ev) end
end
function ketcd.config(conf)
local options = ketcd.defaults
function etcd.config(conf)
local options = etcd.defaults
if type(conf) == 'table' then
for k,v in pairs(conf) do options[k] = v end
end
-- create connection
local cli, err = ketcd.Etcd.new(options)
local cli, err = etcd.Etcd.new(options)
if err then
error(err)
end
ketcd.cli = cli
etcd.cli = cli
-- schedule recurrent polling
-- @todo: the etcd has watch() API, but this requires
-- coroutines on socket operations
if ketcd.ev then event.cancel(ketcd.ev) end
ketcd.ev = event.recurrent(5 * sec, ketcd.reload)
if etcd.ev then event.cancel(etcd.ev) end
etcd.ev = event.recurrent(5 * sec, etcd.reload)
end
return ketcd
return etcd
etcd_SOURCES := etcd.lua
$(call make_lua_module,etcd)
ketcd_SOURCES := ketcd.lua
$(call make_lua_module,ketcd)
......@@ -22,7 +22,7 @@ endif
# List of Lua modules
ifeq ($(HAS_lua),yes)
modules_TARGETS += ketcd \
modules_TARGETS += etcd \
graphite \
policy \
view \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment