-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ProducerStateTable temp view implementation and UT (#247)
* Add ProducerStateTable temp view implementation and UT
- Loading branch information
Showing
7 changed files
with
679 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--[[ | ||
Sample args format: | ||
KEYS: | ||
SAMPLE_CHANNEL | ||
SAMPLE_KEY_SET | ||
SAMPLE_DEL_KEY_SET | ||
_SAMPLE:key_0 | ||
_SAMPLE:key_1 | ||
ARGV: | ||
G (String to be published to channel) | ||
2 (Count of objects to set) | ||
key_0 | ||
key_1 | ||
0 (Count of objects to del) | ||
2 (Count of A/V pair of object 0) | ||
attribute_0 | ||
value_0 | ||
attribute_1 | ||
value_1 | ||
1 (Count of A/V pair of object 1) | ||
attribute_0 | ||
value_0 | ||
]] | ||
local arg_start = 2 | ||
for i = 1, ARGV[arg_start] do | ||
redis.call('SADD', KEYS[2], ARGV[arg_start + i]) | ||
end | ||
arg_start = arg_start + ARGV[arg_start] + 1 | ||
for i = 1, ARGV[arg_start] do | ||
redis.call('SADD', KEYS[3], ARGV[arg_start + i]) | ||
end | ||
arg_start = arg_start + ARGV[arg_start] + 1 | ||
for j = 4, #KEYS do | ||
for i = 1, ARGV[arg_start] do | ||
redis.call('HSET', KEYS[j], ARGV[arg_start + i * 2 - 1], ARGV[arg_start + i * 2]) | ||
end | ||
arg_start = arg_start + 2 * ARGV[arg_start] + 1 | ||
end | ||
redis.call('PUBLISH', KEYS[1], ARGV[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
local keys = redis.call("keys", KEYS[1] .. ":*") | ||
local keys = redis.call("KEYS", KEYS[1] .. ":*") | ||
local res = {} | ||
|
||
for i,k in pairs(keys) do | ||
|
||
local skeys = redis.call("HKEYS", k) | ||
local sres={} | ||
|
||
for j,sk in pairs(skeys) do | ||
sres[sk] = redis.call("HGET", k, sk) | ||
local flat_map = redis.call('HGETALL', k) | ||
for j = 1, #flat_map, 2 do | ||
sres[flat_map[j]] = flat_map[j + 1] | ||
end | ||
|
||
res[k] = sres | ||
|
||
end | ||
|
||
return cjson.encode(res) |
Oops, something went wrong.