Module Kv_hash.Nv_map_ss_private
The core implementation is for a map int->int; here we add some additional support to enable a map string->string.
To lookup a particular string key:
- hash the key to get an int
- use an int->int map to lookup the value_i (value as int)
- value_i is an index into a table of string values, implemented as a single file of all values, and an offset into that file
To add a key,value:
- hash the key to get an int
- add the value to the values file to get an offset
- add (hash,offset) to the int->int map
To delete a key:
- hash the key to get an int
- delete the int from the int->int map
NOTE the old value still remains in the values file. Whether this is a problem depends on your application: if you often delete keys there may be substantial overhead in the values file.
type 'int_map t={values : Values_file.t;mutable nv_int_map : 'int_map;debug : (string, string) Stdlib.Hashtbl.t;}A
string->stringmap is a values file and anint->intmap. Theint->intmap is really a map from hash(key) to offset(of value in values file).
module Make_2 : functor (Raw_bucket : Bucket_intf.BUCKET) -> sig ... endPutting it all together.
module Make_3 : functor (Raw_bucket : Bucket_intf.BUCKET) -> Nv_map_ss_intf.SNOTE prefer Make_2 since it provides the Nv_map_ii_ functions
module Nv_map_ss0 : sig ... end