-
Notifications
You must be signed in to change notification settings - Fork 201
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
Add read locks to the Lua runner #260
Conversation
CC @ayeshaali |
scripts/gen_bytecode.lua
Outdated
@@ -10,7 +10,9 @@ function gen_bytecode() | |||
|
|||
function get_account(name) | |||
account_key = get_account_key(name) | |||
account_data = coroutine.yield(account_key) | |||
|
|||
-- 0 is read lock, 1 is write lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps consider using something more enum-like? https://unendli.ch/posts/2016-07-22-enumerations-in-lua.html
1e538d3
to
c8e806b
Compare
9d79b5c
to
2a5b917
Compare
Update: Responded to comments from @eolesinski, additionally caught an error from testing in |
2a5b917
to
6888c5c
Compare
Support requesting read locks from Lua contracts instead of only write-locks. Signed-off-by: Michael Maurer <[email protected]>
6888c5c
to
bd90534
Compare
@HalosGhost Added in a unit test that should make verification easier here |
Signed-off-by: Michael Maurer <[email protected]>
8f0743c
to
97bae54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an excellent addition, enabling dramatically more performant/parallelization contracts in the lua runner (namely due to enabling multiple, concurrent read-locks on a given key).
This PR adds support for requesting read locks from Lua contracts. Now values yielded from contracts can include an optional second integer parameter (0 = read, else = write).