mod_storage_s3/mod_storage_s3.lua
changeset 5764 59e38aaa3ec1
parent 5763 c7affea8bb24
child 5766 ff8b6d0b3bfa
equal deleted inserted replaced
5763:c7affea8bb24 5764:59e38aaa3ec1
   220 end
   220 end
   221 
   221 
   222 
   222 
   223 -- PUT .../with/when/id
   223 -- PUT .../with/when/id
   224 function archive:append(username, key, value, when, with)
   224 function archive:append(username, key, value, when, with)
   225 	local wrapper = st.stanza("wrapper");
       
   226 	-- Minio had trouble with timestamps, probably the ':' characters, in paths.
       
   227 	wrapper:tag("delay", { xmlns = "urn:xmpp:delay"; stamp = dt.datetime(when) }):up();
       
   228 	wrapper:add_direct_child(value);
       
   229 	key = key or new_uuid();
   225 	key = key or new_uuid();
   230 	return async.wait_for(new_request(self, "PUT", self:_path(username, nil, when, with, key), nil, wrapper):next(function(r)
   226 	return async.wait_for(new_request(self, "PUT", self:_path(username, nil, when, with, key), nil, value):next(function(r)
   231 		if r.code == 200 then
   227 		if r.code == 200 then
   232 			return key;
   228 			return key;
   233 		else
   229 		else
   234 			error(r.body);
   230 			error(r.body);
   235 		end
   231 		end