Software /
code /
prosody-modules
Comparison
mod_storage_s3/mod_storage_s3.lua @ 5720:4a0279c5c7ed
mod_storage_s3: Implement archive store deletion
Not the most efficient way but should work.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 11 Nov 2023 22:47:14 +0100 |
parent | 5719:66986f5271c3 |
child | 5721:991fb904fa49 |
comparison
equal
deleted
inserted
replaced
5719:66986f5271c3 | 5720:4a0279c5c7ed |
---|---|
6 local httputil = require "prosody.util.http"; | 6 local httputil = require "prosody.util.http"; |
7 local uuid = require "prosody.util.uuid"; | 7 local uuid = require "prosody.util.uuid"; |
8 local it = require "prosody.util.iterators"; | 8 local it = require "prosody.util.iterators"; |
9 local jid = require "prosody.util.jid"; | 9 local jid = require "prosody.util.jid"; |
10 local json = require "prosody.util.json"; | 10 local json = require "prosody.util.json"; |
11 local promise = require "prosody.util.promise"; | |
11 local st = require "prosody.util.stanza"; | 12 local st = require "prosody.util.stanza"; |
12 local xml = require "prosody.util.xml"; | 13 local xml = require "prosody.util.xml"; |
13 local url = require "socket.url"; | 14 local url = require "socket.url"; |
14 | 15 |
15 local new_uuid = uuid.v7 or uuid.generate; | 16 local new_uuid = uuid.v7 or uuid.generate; |
307 | 308 |
308 function archive:users() | 309 function archive:users() |
309 return it.unique(keyval.users(self)); | 310 return it.unique(keyval.users(self)); |
310 end | 311 end |
311 | 312 |
312 --[[ TODO | 313 local function count(t) local n = 0; for _ in pairs(t) do n = n + 1; end return n; end |
314 | |
313 function archive:delete(username, query) | 315 function archive:delete(username, query) |
314 return nil, "not-implemented"; | 316 local deletions = {}; |
315 end | 317 for key, _, when, with in self:find(username, query) do |
316 --]] | 318 deletions[key] = new_request(self, "DELETE", self:_path(username or "@", dt.date(when), nil, with, key)); |
319 end | |
320 return async.wait_for(promise.all(deletions):next(count)); | |
321 end | |
317 | 322 |
318 module:provides("storage", driver); | 323 module:provides("storage", driver); |