summaryrefslogtreecommitdiff
path: root/t/startfile.lua
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2022-08-08 16:27:22 -0700
committerdormando <dormando@rydia.net>2022-08-24 22:32:40 -0700
commit6bcc5b8553d43f494e85ab3ec2ce789c38a3ca33 (patch)
treed49f62392b0b40419567014621877b5581885e72 /t/startfile.lua
parent2bdf0ec3c8d89d7b75cb8ba7f1290cd937595669 (diff)
downloadmemcached-6bcc5b8553d43f494e85ab3ec2ce789c38a3ca33.tar.gz
proxy: mcp.attach(CMD, r, "tag")
allows using tagged listeners (ex; `-l tag[test]:127.0.0.1:11212`) to select a top level route for a function. expects there to not be dozens of listeners, but for a handful will be faster than a hash table lookup.
Diffstat (limited to 't/startfile.lua')
-rw-r--r--t/startfile.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/t/startfile.lua b/t/startfile.lua
index 29e3d9b..9f16434 100644
--- a/t/startfile.lua
+++ b/t/startfile.lua
@@ -333,4 +333,7 @@ function mcp_config_routes(main_zones)
-- are attached to the internal parser.
--mcp.attach(mcp.CMD_ANY, function (r) return routetop(r) end)
mcp.attach(mcp.CMD_ANY_STORAGE, routetop)
+ -- tagged top level attachments. ex: memcached -l tag[tagtest]:127.0.0.1:11212
+ -- mcp.attach(mcp.CMD_ANY_STORAGE, function (r) return "SERVER_ERROR no route\r\n" end, "tagtest")
+ -- mcp.attach(mcp.CMD_ANY_STORAGE, function (r) return "SERVER_ERROR my route\r\n" end, "newtag")
end