Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend SugarDB Commands Using Lua Scripts #155

Merged
merged 44 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
91cadbf
Installed gopher-lua
kelvinmwinuka Oct 1, 2024
6c1c7bd
Merge branch 'main' into feature/lua-scripts
kelvinmwinuka Oct 1, 2024
71b71b2
Load new module from lua script (w/o KeyFunc and Handler logic).
kelvinmwinuka Oct 1, 2024
54cc366
Added logic for getting extracted keys from Lua script
kelvinmwinuka Oct 2, 2024
b979d9c
Added ability to pass args to the loaded lua script module
kelvinmwinuka Oct 2, 2024
71e2c31
Pop return value from stack after grabbing lua key extraction func re…
kelvinmwinuka Oct 3, 2024
31e32b0
Simplified LUA modules to only accept file path and args. Moved logic…
kelvinmwinuka Oct 3, 2024
afaac1a
Installed gopher-lua
kelvinmwinuka Oct 1, 2024
03573b6
Load new module from lua script (w/o KeyFunc and Handler logic).
kelvinmwinuka Oct 1, 2024
f83a0f3
Added logic for getting extracted keys from Lua script
kelvinmwinuka Oct 2, 2024
1fafd3f
Added ability to pass args to the loaded lua script module
kelvinmwinuka Oct 2, 2024
0f74177
Pop return value from stack after grabbing lua key extraction func re…
kelvinmwinuka Oct 3, 2024
898f72c
Simplified LUA modules to only accept file path and args. Moved logic…
kelvinmwinuka Oct 3, 2024
7ddaafd
Merge branch 'feature/lua-scripts' of https://github.com/kelvinmwinuk…
kelvinmwinuka Oct 4, 2024
f4b1306
Get, pop, and return the return values from the lua command handler
kelvinmwinuka Oct 7, 2024
5ce7e62
fixed symbol name for handler from handler to handlerFunc
kelvinmwinuka Oct 7, 2024
49dc516
moved lua command handler generation to plugin_lua.go file
kelvinmwinuka Oct 7, 2024
88f034e
Created lua script userdate for the set data type in sugardb
kelvinmwinuka Oct 8, 2024
a6f7e44
Created scaffolding for lua sorted set type
kelvinmwinuka Oct 9, 2024
faafb9d
Allow set elements to be passed when creating a new set
kelvinmwinuka Oct 13, 2024
e0bb0ad
Added zmember lua user-defined type
kelvinmwinuka Oct 13, 2024
4645b67
Implemented zset data type along with its methods for lua scripts
kelvinmwinuka Oct 14, 2024
247dd48
Implemented logic to convert native types to lua types. Updated logic…
kelvinmwinuka Oct 16, 2024
316283a
Added script locking before executing lua script key extraction function
kelvinmwinuka Oct 16, 2024
27a6501
Added translation of set and sorted set from lua script into native type
kelvinmwinuka Oct 16, 2024
2276544
Implemented traslating lua table into native hash or slice
kelvinmwinuka Oct 17, 2024
e22c198
Added script vm shutdown logic during server shutdown
kelvinmwinuka Oct 19, 2024
ede4475
Added database to lua module context
kelvinmwinuka Oct 26, 2024
7e482e3
Basic details for different lua script modules
kelvinmwinuka Oct 26, 2024
bd2f9df
Merge branch 'main' into feature/lua-scripts
kelvinmwinuka Nov 9, 2024
1e18964
Added support for the custom hash data type for lua scripts
kelvinmwinuka Nov 9, 2024
a2ec372
Merge branch 'main' into feature/lua-scripts
kelvinmwinuka Nov 23, 2024
9a69e3c
Updated module build scripts in Makefile to add the 'go' subdirectory.
kelvinmwinuka Nov 23, 2024
2163974
Updated MODULE LOAD emebdded API test to run a list of module tests i…
kelvinmwinuka Nov 23, 2024
7552bf2
Removed module global variable in lua scripts. The lua script path wi…
kelvinmwinuka Nov 23, 2024
8ef2008
Updated go version to 1.23.3. Updated raft and memberlist packages. I…
kelvinmwinuka Nov 23, 2024
7ac315b
Updated error message for handleRenamenx handler to be more descriptive
kelvinmwinuka Nov 26, 2024
b4b102b
Merged latest main branch
kelvinmwinuka Nov 26, 2024
dbad2bc
Updated embedded plugin tests and RENAMENX command test cases
kelvinmwinuka Nov 26, 2024
f96fdd6
Implemented list parsing for lua scripts
kelvinmwinuka Nov 30, 2024
956a8c1
Added lua.list test to plugin embedded api tests
kelvinmwinuka Nov 30, 2024
2f15efb
Updated docusaurus version. Added documentation for Lua module extension
kelvinmwinuka Dec 1, 2024
af3d980
Added documentation for extending SugarDB with lua scripts
kelvinmwinuka Dec 11, 2024
5611469
Uncomment cluster nodes in docker-compose.yml
kelvinmwinuka Dec 12, 2024
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: 2 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ COPY . ./
ENV CGO_ENABLED=1 CC=gcc GOOS=linux GOARCH=amd64

ENV DEST=volumes/modules
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_set/module_set.so ./internal/volumes/modules/module_set/module_set.go
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_get/module_get.so ./internal/volumes/modules/module_get/module_get.go
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_set/module_set.so ./internal/volumes/modules/go/module_set/module_set.go
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_get/module_get.so ./internal/volumes/modules/go/module_get/module_get.go

ENV DEST=bin
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -o $DEST/server ./cmd/...
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ run:
docker-compose up --build

build-local:
CGO_ENABLED=1 go build -buildmode=plugin -o ./bin/modules/module_set/module_set.so ./internal/volumes/modules/module_set/module_set.go && \
CGO_ENABLED=1 go build -buildmode=plugin -o ./bin/modules/module_get/module_get.so ./internal/volumes/modules/module_get/module_get.go && \
CGO_ENABLED=1 go build -buildmode=plugin -o ./bin/modules/module_set/module_set.so ./internal/volumes/modules/go/module_set/module_set.go && \
CGO_ENABLED=1 go build -buildmode=plugin -o ./bin/modules/module_get/module_get.so ./internal/volumes/modules/go/module_get/module_get.go && \
CGO_ENABLED=1 go build -o ./bin ./...


build-modules-test:
CGO_ENABLED=1 go build --race=$(RACE) -buildmode=plugin -o $(OUT)/modules/module_set/module_set.so ./internal/volumes/modules/module_set/module_set.go && \
CGO_ENABLED=1 go build --race=$(RACE) -buildmode=plugin -o $(OUT)/modules/module_get/module_get.so ./internal/volumes/modules/module_get/module_get.go
CGO_ENABLED=1 go build --race=$(RACE) -buildmode=plugin -o $(OUT)/modules/module_set/module_set.so ./internal/volumes/modules/go/module_set/module_set.go && \
CGO_ENABLED=1 go build --race=$(RACE) -buildmode=plugin -o $(OUT)/modules/module_get/module_get.so ./internal/volumes/modules/go/module_get/module_get.go

test:
env RACE=false OUT=internal/modules/admin/testdata make build-modules-test && \
Expand Down
6,674 changes: 3,492 additions & 3,182 deletions coverage/coverage.out

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
volumes:
- ./internal/volumes/config:/etc/sugardb/config
- ./internal/volumes/nodes/standalone_node:/var/lib/sugardb
- ./internal/volumes/modules/lua:/var/lib/sugardb/scripts/lua
networks:
- testnet

Expand Down
Loading
Loading