Use txt.conf to generate index.pck meta; fix double load while indexing

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@22 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-11-02 21:47:20 +00:00
parent a89196679a
commit 4c7ed95a32
3 changed files with 16 additions and 13 deletions

View File

@@ -63,17 +63,9 @@ let index r print title auth locs peers =
else (File_store.file r.index_path (Header_pack.string pack))
let load dir =
let kv = File_store.of_kv_file () in
let index_path = Filename.concat dir "index.pck" in
let pck = match Header_pack.of_string @@ File_store.to_string index_path with
| Error s -> failwith s | Ok pck -> pck
| exception (Sys_error _) -> Header_pack.{
info = { version = version; id = Id.generate (); title = ""; people = []; locations = [] };
fields;
texts = of_text_list @@ File_store.fold ~dir
(fun a (t,_) -> of_text a t) [];
peers = Msgpck.of_list [];
} in
index { dir; index_path; pck }
index { dir; index_path; pck = Header_pack.of_kv kv }
open Cmdliner
let term =