Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

rebase #3

Open
wants to merge 20 commits into
base: mr_tls_support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0cd6905
(feat) add configuration parameter for dictionary name
artomal May 24, 2019
8d7b96d
Update README.md
steve0511 Feb 15, 2020
c7c91d6
Merge pull request #1 from toredash/fix/dynamic-serv-list
toredash Apr 22, 2020
4e61ae1
Merge pull request #2 from steve0511/master
toredash Apr 22, 2020
27281b6
fix: allow multiple reconnection attempts
toredash Apr 22, 2020
ff95b8d
Merge pull request #59 from toredash/feat/reconnection-attempts
steve0511 Apr 25, 2020
b86c278
(feat) use pure lua(jit) crc algorithm
vinayakhulawale May 9, 2019
ffac449
update dev rockspec and README
vinayakhulawale May 24, 2020
e0a1380
remove debug log
vinayakhulawale May 24, 2020
0800907
remove changes for invalid and master only commands
vinayakhulawale May 26, 2020
b546dcb
Merge pull request #36 from vinayakhulawale/luajit-crc
steve0511 May 27, 2020
977124c
(feat) implement master only commands
vinayakhulawale May 31, 2020
e156fc8
fix(config) a typo in timeout (timout)
bungle Jun 3, 2020
6008012
Merge pull request #62 from bungle/fix/connection_timout
steve0511 Jun 4, 2020
851283b
Merge pull request #61 from vinayakhulawale/restrict-cmd
steve0511 Jun 5, 2020
c144432
fix(random) do not seed the random generator
Tieske Dec 2, 2019
7362c19
Merge pull request #54 from Tieske/patch-1
steve0511 Jun 25, 2020
2476e1a
Merge branch 'feat/add-configurable-dict-name' of https://github.com/…
steve0511 Jun 25, 2020
32cd5ff
Merge branch 'artomal-feat/add-configurable-dict-name'
steve0511 Jun 25, 2020
30d2e98
Merge pull request #2 from steve0511/master
mrehwald Aug 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ Thumbs.db
#c
*.so
*.o

luacov*
*.out
t/servroot
65 changes: 11 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,17 @@
INST_PREFIX ?= /usr
INST_LIBDIR ?= $(INST_PREFIX)/lib/lua/5.1
INST_LUADIR ?= $(INST_PREFIX)/share/lua/5.1
OPENRESTY_PREFIX ?=/usr/local/openresty
PREFIX ?= /usr/local
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
INSTALL ?= install
UNAME ?= $(shell uname)

CFLAGS := -O2 -g -Wall -fpic -std=c99
.PHONY: all test install

C_SO_NAME := librestyredisslot.so
LDFLAGS := -shared
all: ;

# on Mac OS X, one should set instead:
# for Mac OS X environment, use one of options
ifeq ($(UNAME),Darwin)
LDFLAGS := -bundle -undefined dynamic_lookup
C_SO_NAME := librestyredisslot.dylib
endif
install: all
$(INSTALL) -d $(DESTDIR)$(LUA_LIB_DIR)/resty
$(INSTALL) lib/resty/*.lua $(DESTDIR)$(LUA_LIB_DIR)/resty

MY_CFLAGS := $(CFLAGS) -DBUILDING_SO
MY_LDFLAGS := $(LDFLAGS) -fvisibility=hidden
test: all
PATH=$(OPENRESTY_PREFIX)/nginx/sbin:$$PATH prove -I../test-nginx/lib -r t

OBJS := src/redis_slot.o

.PHONY: default
default: compile


### clean: Remove generated files
.PHONY: clean
clean:
rm -f $(C_SO_NAME) $(OBJS) ${R3_CONGIGURE}


### compile: Compile library
.PHONY: compile

compile: ${R3_FOLDER} ${R3_CONGIGURE} ${R3_STATIC_LIB} $(C_SO_NAME)

${OBJS} : %.o : %.c
$(CC) $(MY_CFLAGS) -c $< -o $@

${C_SO_NAME} : ${OBJS}
$(CC) $(MY_LDFLAGS) $(OBJS) -o $@


### install: Install the library to runtime
.PHONY: install
install:
$(INSTALL) -d $(INST_LUADIR)/resty/
$(INSTALL) lib/resty/*.lua $(INST_LUADIR)/resty/
$(INSTALL) $(C_SO_NAME) $(INST_LIBDIR)/



### help: Show Makefile rules
.PHONY: help
help:
@echo Makefile rules:
@echo
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ While building the client, thanks for https://github.com/cuiweixie/lua-resty-red

### installation

1. please compile and generate redis_slot.so from redis_slot.c (can done by gcc)
1. please compile and generate librestyredisslot.so from redis_slot.c (can done by gcc)

2. please add redis_slot.so and rediscluster.lua at lualib, Also please add library:lua-resty-redis and lua-resty-lock
2. please add xmodem.lua and rediscluster.lua at lualib, Also please add library:lua-resty-redis and lua-resty-lock

nginx.conf like:

lua_package_path "/path/lualib/?.lua;";
Expand All @@ -61,6 +62,7 @@ While building the client, thanks for https://github.com/cuiweixie/lua-resty-red

```lua
local config = {
dict_name = "test_locks", --shared dictionary name for locks
name = "testCluster", --rediscluster name
serv_list = { --redis cluster node list(host and port),
{ ip = "127.0.0.1", port = 7001 },
Expand All @@ -72,8 +74,9 @@ local config = {
},
keepalive_timeout = 60000, --redis connection pool idle timeout
keepalive_cons = 1000, --redis connection pool size
connection_timout = 1000, --timeout while connecting
connection_timeout = 1000, --timeout while connecting
max_redirection = 5, --maximum retry attempts for redirection
max_connection_attempts = 1 --maximum retry attempts for connection
}

local redis_cluster = require "rediscluster"
Expand Down Expand Up @@ -101,8 +104,9 @@ local config = {
},
keepalive_timeout = 60000, --redis connection pool idle timeout
keepalive_cons = 1000, --redis connection pool size
connection_timout = 1000, --timeout while connecting
connection_timeout = 1000, --timeout while connecting
max_redirection = 5, --maximum retry attempts for redirection,
max_connection_attempts = 1, --maximum retry attempts for connection
auth = "pass" --set password while setting auth
}

Expand Down Expand Up @@ -134,8 +138,9 @@ local config = {
},
keepalive_timeout = 60000,
keepalive_cons = 1000,
connection_timout = 1000,
max_redirection = 5
connection_timeout = 1000,
max_redirection = 5,
max_connection_attempts = 1
}

local redis_cluster = require "rediscluster"
Expand Down Expand Up @@ -180,8 +185,9 @@ local config = {
},
keepalive_timeout = 60000,
keepalive_cons = 1000,
connection_timout = 1000,
max_redirection = 5
connection_timeout = 1000,
max_redirection = 5,
max_connection_attempts = 1
}

local redis_cluster = require "rediscluster"
Expand Down Expand Up @@ -212,8 +218,9 @@ local config = {
},
keepalive_timeout = 60000,
keepalive_cons = 1000,
connection_timout = 1000,
max_redirection = 5
connection_timeout = 1000,
max_redirection = 5,
max_connection_attempts = 1
}

local redis_cluster = require "rediscluster"
Expand Down Expand Up @@ -249,8 +256,9 @@ local config = {
},
keepalive_timeout = 60000, --redis connection pool idle timeout
keepalive_cons = 1000, --redis connection pool size
connection_timout = 1000, --timeout while connecting
connection_timeout = 1000, --timeout while connecting
max_redirection = 5, --maximum retry attempts for redirection
max_connection_attempts = 1 --maximum retry attempts for connection
}

local redis_cluster = require "rediscluster"
Expand Down Expand Up @@ -293,4 +301,3 @@ Redistributions of source code must retain the above copyright notice, this list
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Loading