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

Extract the scripting engine code from the functions unit #1312

Draft
wants to merge 14 commits into
base: unstable
Choose a base branch
from

Conversation

rjd15372
Copy link
Contributor

NOTE: this PR is on top of #1277, please ignore the common commits. I'll keep this PR in draft mode until #1277 is merged

This commit creates a new unit for the scripting engine code by extracting the existing code from the functions unit.

We're doing this refactor to prepare the code for runnning the EVAL command using different scripting engines.

Signed-off-by: Ricardo Dias [email protected]

This commit extends the module API to support the addition of different
scripting engines to run user defined functions.

The scripting engine can be implemented as a Valkey module, and can be
dynamically loaded with the `loadmodule` config directive, or with
the `MODULE LOAD` command.

The current module API support, only allows to load scripting engines to
run functions using `FCALL` command.

In a follow up PR, we will move the Lua scripting engine implmentation
into its own module.

Signed-off-by: Ricardo Dias <[email protected]>
This commit adds a module with a very simple stack based scripting
language implementation to test the new module API that allows to
implement new scripting engines as modules.

Signed-off-by: Ricardo Dias <[email protected]>
Signed-off-by: Ricardo Dias <[email protected]>
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 82.14286% with 55 lines in your changes missing coverage. Please review.

Project coverage is 70.73%. Comparing base (653d5f7) to head (990447a).
Report is 7 commits behind head on unstable.

Files with missing lines Patch % Lines
src/engine.c 71.95% 23 Missing ⚠️
src/module.c 11.76% 15 Missing ⚠️
src/functions.c 89.38% 12 Missing ⚠️
src/rdb.c 50.00% 3 Missing ⚠️
src/function_lua.c 98.38% 1 Missing ⚠️
src/server.c 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1312      +/-   ##
============================================
+ Coverage     70.63%   70.73%   +0.10%     
============================================
  Files           116      118       +2     
  Lines         63303    63493     +190     
============================================
+ Hits          44711    44910     +199     
+ Misses        18592    18583       -9     
Files with missing lines Coverage Δ
src/script_lua.c 89.92% <100.00%> (-0.51%) ⬇️
src/strl.c 97.43% <100.00%> (+0.88%) ⬆️
src/function_lua.c 98.86% <98.38%> (-0.33%) ⬇️
src/server.c 87.63% <50.00%> (-0.05%) ⬇️
src/rdb.c 76.31% <50.00%> (-0.27%) ⬇️
src/functions.c 94.27% <89.38%> (-1.28%) ⬇️
src/module.c 9.65% <11.76%> (+<0.01%) ⬆️
src/engine.c 71.95% <71.95%> (ø)

... and 18 files with indirect coverage changes

@hpatro
Copy link
Contributor

hpatro commented Nov 15, 2024

@rjd15372 You could point the merge branch as your initial branch. It will show only the diff then.

@rjd15372
Copy link
Contributor Author

rjd15372 commented Nov 15, 2024

@hpatro

@rjd15372 You could point the merge branch as your initial branch. It will show only the diff then.

I don't know if that is possible because the branch that I used to open #1277 is from my own fork of the valkey repo.

@rjd15372 rjd15372 force-pushed the refactor-engine-1261 branch 2 times, most recently from 0cad7ff to 6af7c63 Compare November 25, 2024 15:41
… functionLibInfo in most places

Signed-off-by: Ricardo Dias <[email protected]>
- Removed the `ValkeyModuleScriptingEngineFunctionLibrary` structure.
- Changed a few structure and parameters names.

Signed-off-by: Ricardo Dias <[email protected]>
Signed-off-by: Ricardo Dias <[email protected]>
Signed-off-by: Ricardo Dias <[email protected]>
@rjd15372 rjd15372 force-pushed the refactor-engine-1261 branch 2 times, most recently from 2db2efb to 990447a Compare November 27, 2024 11:55
This commit creates a new unit for the scripting engine code by
extracting the existing code from the functions unit.

We're doing this refactor to prepare the code for runnning the `EVAL`
command using different scripting engines.

Signed-off-by: Ricardo Dias <[email protected]>
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