module U = NUri
module L = Log
module H = U.UriHash
+module Y = Entity
module B = Bag
exception ObjectNotFound of B.message
let hsize = 7000
let env = H.create hsize
-let age = ref 1
(* Internal functions *******************************************************)
+let get_age =
+ let age = ref 0 in
+ fun () -> incr age; !age
+
let error uri = raise (ObjectNotFound (L.items1 (U.string_of_uri uri)))
(* Interface functions ******************************************************)
-let set_entry f entry =
- let _, uri, b = entry in
- let entry = !age, uri, b in
- incr age; H.add env uri entry; f entry
+let set_entity f (a, uri, b) =
+ let age = get_age () in
+ let entry = (Y.Apix age :: a), uri, b in
+ H.add env uri entry; f entry
-let get_entry f uri =
+let get_entity f uri =
try f (H.find env uri) with Not_found -> error uri