Changeset 22 in code
- Timestamp:
- Nov 2, 2022, 9:47:20 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/index.ml
r8 r22 64 64 65 65 let load dir = 66 let kv = File_store.of_kv_file () in 66 67 let index_path = Filename.concat dir "index.pck" in 67 let pck = match Header_pack.of_string @@ File_store.to_string index_path with 68 | Error s -> failwith s | Ok pck -> pck 69 | exception (Sys_error _) -> Header_pack.{ 70 info = { version = version; id = Id.generate (); title = ""; people = []; locations = [] }; 71 fields; 72 texts = of_text_list @@ File_store.fold ~dir 73 (fun a (t,_) -> of_text a t) []; 74 peers = Msgpck.of_list []; 75 } in 76 index { dir; index_path; pck } 68 index { dir; index_path; pck = Header_pack.of_kv kv } 77 69 78 70 open Cmdliner -
trunk/cli/publish.ml
r21 r22 1 let targets () = 2 let kv = Logarion.File_store.of_kv_file () in 1 let targets kv = 3 2 let pub_dir = 4 3 try Logarion.Store.KV.find "Pubdir" kv with Not_found -> … … 14 13 open Logarion 15 14 let publish ids = 15 let kv = Logarion.File_store.of_kv_file () in 16 16 let predicate t = List.mem t.Text.id ids in 17 let targets = targets ()in17 let targets = targets kv in 18 18 let pub_dirs = List.map (fun x -> snd x) targets in 19 19 File_store.iter ~predicate (fun (_t, p) -> -
trunk/lib/header_pack.ml
r7 r22 54 54 let of_string s = unpack @@ snd @@ Msgpck.StringBuf.read s 55 55 56 let of_kv kv = 57 let find k kv = try Store.KV.find k kv with Not_found -> "" in 58 let find_ls k kv = try String_set.list_of_csv (Store.KV.find k kv) with Not_found -> [] in 59 { 60 info = { version = version; id = find "Id" kv; title = find "Title" kv; 61 people = find_ls "Authors" kv; locations = find_ls "Locations" kv }; 62 fields; 63 texts = Msgpck.List []; 64 peers = str_list (find_ls "Peers" kv); 65 } 66 56 67 let list filename = try 57 68 let texts_list = function
Note:
See TracChangeset
for help on using the changeset viewer.