1. Kristian Fiskerstrand
  2. sks-keyserver-patches

Commits

Kristian Fiskerstrand  committed 0b884c5

Start basic metadata file

  • Participants
  • Parent commits 88eb511
  • Branches default

Comments (0)

Files changed (2)

File DUMP_METADATA

View file
+# HG changeset patch
+# Parent 3c75386bc7ce409eca4a4629b4b14b252a8808e8
+Add metadata to dump
+
+diff -r 3c75386bc7ce sksdump.ml
+--- a/sksdump.ml	Sat Oct 27 23:15:53 2012 +0200
++++ b/sksdump.ml	Wed Nov 07 20:55:16 2012 +0100
+@@ -80,11 +80,24 @@
+     let file = open_out fname in
+     protect ~f:(fun () -> write_to_file size stream file)
+       ~finally:(fun () -> close_out file)
+-
++  
++  let dump_database_create_metadata dumpdir name size ctr start_time =
++   let fname = Filename.concat dumpdir (sprintf "metadata-%s.txt" name) in
++   let file = open_out fname in
++   output_string file (sprintf "Metadata for %s\n" !Settings.hostname);
++   output_string file (sprintf "Dump started: %f\n" start_time);
++   output_string file (sprintf "Dump ended: %f\n" (Unix.gettimeofday()));
++   output_string file (sprintf "Number of files: %d\n" ctr);
++   close_out file;
++   ()
++  
+   let dump_database dumpdir size name =
+     let (stream,close) = Keydb.create_hash_skey_stream () in
++    let start_time = Unix.gettimeofday() in
++    let () = if not (Sys.file_exists dumpdir) then
++               Unix.mkdir dumpdir  0o700; in
++    let ctr = ref 0 in
+     let run () =
+-      let ctr = ref 0 in
+       while SStream.peek stream <> None do
+         let fname =
+           Filename.concat dumpdir (sprintf "%s-%04d.pgp" name !ctr)
+@@ -93,7 +106,8 @@
+         incr ctr
+       done
+     in
+-    protect ~f:run ~finally:close
++     dump_database_create_metadata dumpdir name size !ctr start_time;
++     protect ~f:run ~finally:close
+ 
+ 
+ 

File series

View file
+DUMP_METADATA
 MultiSearch
 CleanOption
 #KeyExpirationTime