Commit 5b80a057 authored by Marek Vavrusa's avatar Marek Vavrusa

doc: cleanup

parent 00776953
......@@ -802,12 +802,12 @@ daemons or manipulated from other processes, making for example synchronised loa
.. code-block:: lua
-- Clear records at/below 'bad.cz'
cache.clear('*.bad.cz')
-- Clear packet cache
cache.clear('*. P')
-- Clear whole cache
cache.clear()
-- Clear records at/below 'bad.cz'
cache.clear('*.bad.cz')
-- Clear packet cache
cache.clear('*. P')
-- Clear whole cache
cache.clear()
Timers and events
......@@ -829,7 +829,7 @@ For example, ``5 * hour`` represents five hours, or 5*60*60*100 milliseconds.
.. code-block:: lua
event.after(1 * minute, function() print('Hi!') end)
event.after(1 * minute, function() print('Hi!') end)
.. function:: event.recurrent(interval, function)
......@@ -841,11 +841,11 @@ For example, ``5 * hour`` represents five hours, or 5*60*60*100 milliseconds.
.. code-block:: lua
msg_count = 0
event.recurrent(5 * sec, function(e)
msg_count = msg_count + 1
print('Hi #'..msg_count)
end)
msg_count = 0
event.recurrent(5 * sec, function(e)
msg_count = msg_count + 1
print('Hi #'..msg_count)
end)
.. function:: event.reschedule(event_id, timeout)
......@@ -857,13 +857,13 @@ For example, ``5 * hour`` represents five hours, or 5*60*60*100 milliseconds.
.. code-block:: lua
local interval = 1 * minute
event.after(1 * minute, function (ev)
print('Good morning!')
-- Halven the interval for each iteration
interval = interval / 2
event.reschedule(ev, interval)
end)
local interval = 1 * minute
event.after(1 * minute, function (ev)
print('Good morning!')
-- Halven the interval for each iteration
interval = interval / 2
event.reschedule(ev, interval)
end)
.. function:: event.cancel(event_id)
......@@ -875,8 +875,8 @@ For example, ``5 * hour`` represents five hours, or 5*60*60*100 milliseconds.
.. code-block:: lua
e = event.after(1 * minute, function() print('Hi!') end)
event.cancel(e)
e = event.after(1 * minute, function() print('Hi!') end)
event.cancel(e)
Watch for file descriptor activity. This allows embedding other event loops or simply
firing events when a pipe endpoint becomes active. In another words, asynchronous
......@@ -895,10 +895,10 @@ notifications for daemon.
.. code-block:: lua
e = event.socket(0, function(e, status, nevents)
print('activity detected')
end)
e.cancel(e)
e = event.socket(0, function(e, status, nevents)
print('activity detected')
end)
e.cancel(e)
Scripting worker
^^^^^^^^^^^^^^^^
......
......@@ -12,16 +12,16 @@ Examples
.. code-block:: lua
-- Load hints after iterator
modules = { 'hints > iterate' }
-- Load hints before rrcache, custom hosts file
modules = { ['hints < rrcache'] = 'hosts.custom' }
-- Add root hints
hints.root({
['j.root-servers.net.'] = { '2001:503:c27::2:30', '192.58.128.30' }
})
-- Set custom hint
hints['localhost'] = '127.0.0.1'
-- Load hints after iterator
modules = { 'hints > iterate' }
-- Load hints before rrcache, custom hosts file
modules = { ['hints < rrcache'] = 'hosts.custom' }
-- Add root hints
hints.root({
['j.root-servers.net.'] = { '2001:503:c27::2:30', '192.58.128.30' }
})
-- Set custom hint
hints['localhost'] = '127.0.0.1'
Properties
^^^^^^^^^^
......@@ -64,16 +64,16 @@ Properties
.. code-block:: lua
> hints.root({
['l.root-servers.net.'] = '199.7.83.42',
['m.root-servers.net.'] = '202.12.27.33'
})
[l.root-servers.net.] => {
[1] => 199.7.83.42
}
[m.root-servers.net.] => {
[1] => 202.12.27.33
}
> hints.root({
['l.root-servers.net.'] = '199.7.83.42',
['m.root-servers.net.'] = '202.12.27.33'
})
[l.root-servers.net.] => {
[1] => 199.7.83.42
}
[m.root-servers.net.] => {
[1] => 202.12.27.33
}
.. tip:: A good rule of thumb is to select only a few fastest root hints. The server learns RTT and NS quality over time, and thus tries all servers available. You can help it by preselecting the candidates.
\ No newline at end of file
......@@ -234,7 +234,7 @@ Dependencies
* `lua-http <https://github.com/daurnimator/lua-http>`_ available in LuaRocks
If you're installing via Homebrew on OS X, you need OpenSSL too.
If you're installing via Homebrew on OS X, you need OpenSSL too.
.. code-block:: bash
......
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