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

Invoke custom commands from custom proc/txn #597

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

yrajas
Copy link
Contributor

@yrajas yrajas commented Aug 16, 2024

Adds ability to invoke custom raw string commands and object commands from within custom procedures and transactions.

  • New APIs in CustomFunctions to invoke custom commands from custom procedures and transactions
  • CustomProcedure registration updated to take in a delegate similar to custom transaction registration
  • RespServerSession reference added to CustomFunctions to enable parsing of custom commands and invoking underlying API
  • Sample custom procedure and transaction that invoke custom raw string and object commands
  • Corresponding tests.

@yrajas yrajas force-pushed the yrajas/proctocmd branch 2 times, most recently from c1391fc to f0450e4 Compare October 22, 2024 04:36
@yrajas yrajas changed the title [WIP] Invoke custom raw string cmd from custom proc/txn [WIP] Invoke custom commands from custom proc/txn Oct 22, 2024
@yrajas yrajas changed the title [WIP] Invoke custom commands from custom proc/txn Invoke custom commands from custom proc/txn Oct 22, 2024
@yrajas yrajas marked this pull request as ready for review October 22, 2024 19:54
if (sessionCustomProcMap[id] == null)
{
var entry = customCommandManager.customProcedureMap[id] ?? throw new GarnetException($"Custom procedure {id} not found");
sessionCustomProcMap[id] = entry.CustomProcedure();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name this appropriately, as CustomProcedureFactory

@@ -769,7 +769,7 @@ bool NetworkCustomProcedure()
return true;
}

TryCustomProcedure(currentCustomProcedure.CustomProcedureImpl);
TryCustomProcedure(customCommandManagerSession.GetCustomProcedure(currentCustomProcedure.Id, this));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every call to this creates a new factory instance? that does not seem efficient at all.

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