/[sks]/sks/keydb.ml
ViewVC logotype

Diff of /sks/keydb.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.41 by yminsky, Fri Nov 21 11:44:29 2003 UTC revision 1.42 by yminsky, Tue Dec 2 10:23:52 2003 UTC
# Line 174  struct Line 174  struct
174      let dbs = get_dbs () in      let dbs = get_dbs () in
175      dbs.dump.filearray      dbs.dump.filearray
176    
   let get_num_keys () =  
     let dbs = get_dbs () in  
     Db.get_size dbs.key  
   
177    (***********************************************************************)    (***********************************************************************)
178    (*  Key conversions ****************************************************)    (*  Key conversions ****************************************************)
179    (***********************************************************************)    (***********************************************************************)
# Line 618  struct Line 614  struct
614                
615    (***********************************************************************)    (***********************************************************************)
616    
617      let keyid_iter ~f =
618        let dbs = get_dbs () in
619        let c = Cursor.create dbs.keyid in
620        let rec loop get_type =
621          match (try Some (Cursor.get c get_type []) with Not_found -> None)
622          with
623            | Some (key,data) ->
624                f ~keyid:key ~hash:data;
625                loop Cursor.NEXT
626            | None -> ()
627        in
628        protect ~f:(fun () -> loop Cursor.FIRST)
629          ~finally:(fun () -> Cursor.close c)
630    
631      (***********************************************************************)
632    
633    let raw_iter ~f =    let raw_iter ~f =
634      let dbs = get_dbs () in      let dbs = get_dbs () in
635      let c = Cursor.create dbs.key in      let c = Cursor.create dbs.key in
# Line 1343  struct Line 1355  struct
1355            raise e            raise e
1356    
1357    
1358      let get_num_keys () =
1359        let ctr = ref 0 in
1360        keyid_iter ~f:(fun ~keyid ~hash -> incr ctr);
1361        !ctr
1362    
1363  end  end
1364    

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26