Diff

plugins/mod_storage_internal.lua @ 11275:b8fada57faf0

mod_storage_internal: Add support for full ID range query Based on the mod_storage_memory implementation
author Kim Alvefur <zash@zash.se>
date Tue, 12 Jan 2021 17:00:27 +0100
parent 10926:c55bd98a54f8
child 11278:c3907f05bed4
line wrap: on
line diff
--- a/plugins/mod_storage_internal.lua	Tue Jan 12 16:58:10 2021 +0100
+++ b/plugins/mod_storage_internal.lua	Tue Jan 12 17:00:27 2021 +0100
@@ -52,6 +52,7 @@
 	total = true;
 	quota = archive_item_limit;
 	truncate = true;
+	full_id_range = true;
 };
 
 function archive:append(username, key, value, when, with)
@@ -178,8 +179,7 @@
 					return nil, "item-not-found";
 				end
 			end
-		elseif query.before then
-			last_key = query.before;
+			last_key = query.after;
 		elseif query.after then
 			local found = false;
 			for j = 1, #items do
@@ -192,6 +192,9 @@
 			if not found then
 				return nil, "item-not-found";
 			end
+			last_key = query.before;
+		elseif query.before then
+			last_key = query.before;
 		end
 		if query.limit and #items - i > query.limit then
 			items[i+query.limit+1] = nil;