File: proxyinternal2.lua

package info (click to toggle)
memcached 1.6.39-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,320 kB
  • sloc: ansic: 62,281; perl: 12,500; sh: 4,569; makefile: 468; python: 402; xml: 59
file content (21 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function mcp_config_pools()
    return true
end

function mcp_config_routes(zones)
    local fg = mcp.funcgen_new()
    local h1 = fg:new_handle(mcp.internal_handler)
    local h2 = fg:new_handle(mcp.internal_handler)
    fg:ready({ n = "internal", f = function(rctx)
        return function(r)
            -- ensure we can't leak by grabbing a result we then don't use.
            local cmd = r:command()
            if cmd == mcp.CMD_GET or cmd == mcp.CMD_MG then
                local res1 = rctx:enqueue_and_wait(r, h1)
            end
            return rctx:enqueue_and_wait(r, h2)
        end
    end})

    mcp.attach(mcp.CMD_ANY_STORAGE, fg)
end