Changeset

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
parents 11274:ecbfde402364
children 11276:7b2ee8995af9
files plugins/mod_storage_internal.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
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;