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

Conversation

kelvinmwinuka
Copy link
Collaborator

This change allows the user to define new commands using Lua. This extends the functionality of the existing MODULE LOAD command. Now the user can can run MODULE LOAD path/to/script.lua [args ...] to load a new command that's defined by a Lua script.

Just like regular .so modules, lua modules can be removed using MODULE UNLOAD <module-name>, where module name is the name of the lua module as displayed by the MODULE LIST command.

To view the documentation:

  • Install pnpm - npm install -g pnpm
  • Navigate to the project's docs subdirectory - cd docs
  • Install packages - pnpm install
  • Run the docs server - pnpm run start

The documentation for Lua extensions can be found at /docs/extension/lua

kelvinmwinuka and others added 30 commits October 1, 2024 22:03
… for generating LUA script command into plugin_lua.go file.
… for generating LUA script command into plugin_lua.go file.
… for lua key extraction and handler functions that only expect one return type, the correct one. When there's an error, the functions should throw an error instead of returning an error string. Implemented error handlers when calling key extraction and handler functions so that errors from the lua script will be safely returned to the user. Implemented script locking when executing a script command.
@kelvinmwinuka kelvinmwinuka self-assigned this Dec 11, 2024
@DMcP89
Copy link
Contributor

DMcP89 commented Dec 11, 2024

Tested locally and working as documented from what I can tell. I would recommend we add a response to the MODULE UNLOAD command to give a confirmation that the command completes successfully, but that can be handled in another PR.

@kelvinmwinuka kelvinmwinuka merged commit 108bf97 into EchoVault:main Dec 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants