aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/redis_lua/stored_procedure/delete_entry.lua
blob: 445337c77fac920ddd21d76b985a06a57f8af564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- KEYS[1]: full path of entry
local fullpath = KEYS[1]
-- KEYS[2]: full path of entry
local fullpath_list_key = KEYS[2]
-- KEYS[3]: dir of the entry
local dir_list_key = KEYS[3]

-- ARGV[1]: isSuperLargeDirectory
local isSuperLargeDirectory = ARGV[1] == "1"
-- ARGV[2]: name of the entry
local name = ARGV[2]

redis.call("DEL", fullpath, fullpath_list_key)

if not isSuperLargeDirectory and name ~= "" then
    redis.call("ZREM", dir_list_key, name)
end

return 0