TYPE
Database =
RECORD
hashByName, hashByPhone, hashByEmail: Hashes.Hash;
(* names act as primary keys (i.e. we expect them
to be unique) but we support phone numbers
and email addresses as secondary indices as well;
if secondary keys are not unique we just keep a
reference to the first object we have seen with
that key
*)
END;
PROCEDURE CreateDB(VAR db: Database);
(* create the three hashes associated with db *)
BEGIN
Hashes.Create(db.hashByName, Addresses.Hashable,
Addresses.HashByName, Addresses.EqualByName);
Hashes.Create(db.hashByPhone, Addresses.Hashable,
Addresses.HashByPhone, Addresses.EqualByPhone);
Hashes.Create(db.hashByEmail, Addresses.Hashable,
Addresses.HashByEmail, Addresses.EqualByEmail);
END CreateDB;
|