Make Db typed, use pack/unpack for serialization.