# HG changeset patch # User Kim Alvefur # Date 1699739234 -3600 # Node ID 4a0279c5c7edfda321fb7b0ee4db1b39a8fd1286 # Parent 66986f5271c3c1a6e084422dac3a609a37617c12 mod_storage_s3: Implement archive store deletion Not the most efficient way but should work. diff -r 66986f5271c3 -r 4a0279c5c7ed mod_storage_s3/mod_storage_s3.lua --- a/mod_storage_s3/mod_storage_s3.lua Sat Nov 11 22:26:39 2023 +0100 +++ b/mod_storage_s3/mod_storage_s3.lua Sat Nov 11 22:47:14 2023 +0100 @@ -8,6 +8,7 @@ local it = require "prosody.util.iterators"; local jid = require "prosody.util.jid"; local json = require "prosody.util.json"; +local promise = require "prosody.util.promise"; local st = require "prosody.util.stanza"; local xml = require "prosody.util.xml"; local url = require "socket.url"; @@ -309,10 +310,14 @@ return it.unique(keyval.users(self)); end ---[[ TODO +local function count(t) local n = 0; for _ in pairs(t) do n = n + 1; end return n; end + function archive:delete(username, query) - return nil, "not-implemented"; + local deletions = {}; + for key, _, when, with in self:find(username, query) do + deletions[key] = new_request(self, "DELETE", self:_path(username or "@", dt.date(when), nil, with, key)); + end + return async.wait_for(promise.all(deletions):next(count)); end ---]] module:provides("storage", driver);