-- Delete only a terminal transfer and release its idempotency reservation if
-- this operation still owns it.
--
-- KEYS[1]: operation hash
-- KEYS[2]: reported worker set
-- KEYS[3]: create-request idempotency key
-- KEYS[4]: group active-operations set
-- ARGV[1]: operation_id
local state = redis.
if not state
if state ~= 'COMPLETE' and state ~= 'FAILED' and state ~= 'ABORTED'
redis.
redis.
if redis. == ARGV
redis.
return 'DELETED'