Skip to content
Snippets Groups Projects
  1. Jan 31, 2018
  2. Jan 30, 2018
  3. Jan 24, 2018
  4. Jan 23, 2018
  5. Jan 08, 2018
    • Marek Vavruša's avatar
      daemon: unified query completion callback with trace callback in resolve · 7afffaa9
      Marek Vavruša authored
      This is a followup on addition of trace callbacks in the resolver library,
      to get rid of the Lua/C interfacing in daemon and unify it with the log tracing.
      All modules can now install completion callback on the kr_request object that
      will be called after the resolution is done.
      7afffaa9
    • Marek Vavruša's avatar
      Implement worker coroutines for asynchronous background processing · 8fa95978
      Marek Vavruša authored and Marek Vavrusa's avatar Marek Vavrusa committed
      This implements worker coroutines in Lua to perform non-blocking I/O and do many things concurrently.
      For example a file watcher can be now implemented as:
      
      ```
        local watcher = notify.opendir('/etc')
        watcher:add('hosts')
      
        -- Watch changes to /etc/hosts
        worker.coroutine(function ()
          for flags, name in watcher:changes() do
            for flag in notify.flags(flags) do
              print(name, notify[flag])
            end
          end
        end)
      ```
      
      In order to make this work, the runtime uses the cqueues library which
      can run coroutines concurrently, and return a file descriptor to poll on
      if it's blocked. The worker takes that file descriptor and calls
      `event.socket(pollfd, resume_callback)` so that libuv can wake up
      the worker when its ready again.
      
      The cqueues library is still optional, but if it's not present following stuff
      won't work:
      
      * worker.coroutine()
      * worker.sleep()
      8fa95978
  6. Jan 04, 2018
  7. Dec 21, 2017
  8. Dec 08, 2017
  9. Dec 07, 2017
  10. Dec 04, 2017
  11. Nov 28, 2017
  12. Nov 24, 2017
    • Marek Vavruša's avatar
      daemon/lua: fixed unused variables, whitespace, cleanup · 3162da83
      Marek Vavruša authored
      Also fixed improper promotion of `ffi` to global variable.
      
      ```
      $ luacheck --codes daemon/lua/
      Checking daemon/lua/config.lua                    OK
      Checking daemon/lua/kres-gen.lua                  OK
      Checking daemon/lua/kres.lua                      OK
      Checking daemon/lua/sandbox.lua                   OK
      Checking daemon/lua/trust_anchors.lua             OK
      Checking daemon/lua/zonefile.lua                  OK
      
      Total: 0 warnings / 0 errors in 6 files
      ```
      3162da83
    • Marek Vavruša's avatar
      added basic config test for consts, depend on knot >= 2.4, cleanup · b90e6c71
      Marek Vavruša authored
      The library now depends on libknot >= 2.4.0 (in Debian stable),
      this allows us to remove a dead code and sed-ing of the kres.lua
      
      Added a basic config tests to check that constants still work,
      and basic interface to rrsets still works after the change.
      b90e6c71
    • Marek Vavruša's avatar
      95a6fdf7
    • Marek Vavruša's avatar
      converted constant tables, support kres.type.TYPE1234 · 0ec11416
      Marek Vavruša authored
      The difficulty with using structs as constant tables is that access
      to non-existent fields throws an error. This is difficult to handle
      without wrapping every access in a pcall, for example in predict module:
      
      ```
      error: /usr/local/lib/kdns_modules/predict.lua:34: 'struct rr_type' has no member named 'TYPE65535'
      ```
      
      So I converted the constant tables into regular Lua tables,
      and added a metatable for RR types to allow looking up unnamed types,
      in the TYPE%d format. Looking up non-existent fields will now
      return nil instead of throwing an error.
      0ec11416
    • Marek Vavruša's avatar
      tests: fixed config tests locking up on error, added test for predict · 52d4f519
      Marek Vavruša authored
      The config tests locked up on error as if error was raised from the
      event callback, it would never reach the `quit()` statement, so
      server would never close on error.
      
      Added a script to make running these types of tests a little bit nicer
      and to allow concurrent execution of config tests.
      
      Added a test for the predict module, that fails on prediction
      of unknown types:
      
      ```
      error: /usr/local/lib/kdns_modules/predict.lua:34: 'struct rr_type' has no member named 'TYPE65535'
      ```
      52d4f519
  13. Nov 21, 2017
  14. Nov 20, 2017
  15. Nov 02, 2017