lua-resty-core
lua-resty-core copied to clipboard
Balancer by lua stream
Commits in this branch correspond to the changes for Balancer by LUA in the Stream Subsystem ( https://github.com/openresty/stream-lua-nginx-module/pull/7).
I have renambe the balancer.lua to balancer_http, and created the new implementation as balancer_stream.lua.
I will create a balancer.lua compatibility wrapper once the subsystem check is implemented.
Feel free to adjust the API to match your desired layout.
@splitice Just a side note: I think the ngx.semaphore
API can be ported over to the stream subsystem in a similar way :)
Currently I have no use for the semaphore module so wont be doing it myself at this stage.
I ported this because of the lack of variable support in the stream subsystem preventing me from doing something as simple as proxy_pass $map_variable;
.
If you have any comments on any of the PR's I've made feel free to let me know today. I am spending the day porting over a couple more of our small patches to the stream subsystem so its not out of my way.
@splitice Will you add a test file for using ngx.balancer
in the stream subsystem here? (By porting the existing t/balancer.t
file to t/balancer-stream.t, for example.)
Probably best you do. I can do a theoretical port but dont have the time to get the environment passing.
Also might be best to check if the balancer_by_lua_* tests all pass first :)
@splitice Please check out this tutorial for how to run the tests on your side:
https://openresty.gitbooks.io/programming-openresty/content/testing/
It should be easy :)
This branch needs to rebase to the latest git master before it can be merged.