message id_with_score("std::pair<std::string, double>") {
  0: string id
  1: double score
}

service nearest_neighbor {
  #@broadcast #@update #@all_and
  bool clear()

  #@cht(1) #@update #@pass
  bool set_row(0: string id, 1: datum d)

  #@random #@nolock #@pass
  list<id_with_score> neighbor_row_from_id(0: string id, 1: uint size)

  #@random #@nolock #@pass
  list<id_with_score> neighbor_row_from_datum(0: datum query, 1: uint size)

  #@random #@nolock #@pass
  list<id_with_score> similar_row_from_id(0: string id, 1: uint ret_num)

  #@random #@nolock #@pass
  list<id_with_score> similar_row_from_datum(0: datum query, 1: uint ret_num)

  #@random #@nolock #@pass
  list<string> get_all_rows()
}
