Comparison

mod_storage_s3/mod_storage_s3.lua @ 5694:c8322c64a548

mod_storage_s3: Implement keyvalue deletion
author Kim Alvefur <zash@zash.se>
date Sat, 14 Oct 2023 21:40:46 +0200
parent 5693:2c9d72ef829e
child 5695:c74a96dc5d58
comparison
equal deleted inserted replaced
5693:2c9d72ef829e 5694:c8322c64a548
140 function keyval:get(user) 140 function keyval:get(user)
141 return async.wait_for(new_request("GET", self:_path(user)):next(on_result)); 141 return async.wait_for(new_request("GET", self:_path(user)):next(on_result));
142 end 142 end
143 143
144 function keyval:set(user, data) 144 function keyval:set(user, data)
145 return async.wait_for(new_request("PUT", self:_path(user), data)); 145
146 if data == nil or (type(data) == "table" and next(data) == nil) then
147 return async.wait_for(new_request("DELETE", self:_path(user)));
148 end
149
150 return async.wait_for(new_request("PUT", self:_path(user), nil, data));
146 end 151 end
147 152
148 function keyval:users() 153 function keyval:users()
149 return nil, "not-implemented"; 154 return nil, "not-implemented";
150 end 155 end