Changeset

13358:2b8ec22988af

util.datamanager: Load first item into index earlier Should get rid of fseek() call
author Kim Alvefur <zash@zash.se>
date Mon, 27 Nov 2023 00:14:56 +0100
parents 13357:f424c9f1460b
children 13359:1796370091d4
files util/datamanager.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/datamanager.lua	Sun Nov 26 22:58:11 2023 +0100
+++ b/util/datamanager.lua	Mon Nov 27 00:14:56 2023 +0100
@@ -424,7 +424,8 @@
 	end
 
 	if ih then
-		return setmetatable({ file = ih }, index_mt);
+		local first_length = string.unpack(ih:read(index_item_size));
+		return setmetatable({ file = ih; { start = 0; length = first_length } }, index_mt);
 	end
 
 	local index, err = build_list_index(username, host, datastore);