File: proxyintext.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 (44 lines) | stat: -rw-r--r-- 926 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- using mcp.internal() with extstore

function new_splitter(afg, bfg)
    local fg = mcp.funcgen_new()
    local h_a = fg:new_handle(afg)
    local h_b = fg:new_handle(bfg)

    fg:ready({ f = function(rctx)
        return function(r)
            rctx:enqueue(r, h_a)
            rctx:enqueue(r, h_b)
            rctx:wait_cond(2, mcp.WAIT_ANY)
            return rctx:res_any(h_a)
        end
    end
    })

    return fg
end

function mcp_config_pools()
end

function mcp_config_routes()
    local mfg = mcp.funcgen_new()
    mfg:ready({ f = function(rctx)
            return function(r)
                return mcp.internal(r)
            end
        end
    })

    -- test running internal from subrctx's
    local split = new_splitter(mfg, mfg)

    local map = {
        ["top"] = mfg,
        ["split"] = split,
    }

    local router = mcp.router_new({ map = map })

    mcp.attach(mcp.CMD_ANY_STORAGE, router)
end