# Jubatus: Online machine learning framework for distributed environment
# Copyright (C) 2011,2012 Preferred Networks and Nippon Telegraph and Telephone Corporation.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

%include "jubatus/core/fv_converter/datum.hpp"
%include "jubatus/core/clustering/types.hpp"

message weighted_datum("std::pair<double, jubatus::core::fv_converter::datum>") {
  0: double weight
  1: datum point
}

message indexed_point("jubatus::core::clustering::indexed_point") {
  0: string id
  1: datum point
}

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

service clustering {
  #@random #@update #@pass
  bool push(0: list<indexed_point> points)

  #@random #@analysis #@pass
  uint get_revision()

  #@random #@analysis #@pass
  list<list<weighted_datum > > get_core_members()

  #@random #@analysis #@pass
  list<list<weighted_index > > get_core_members_light()

  #@random #@analysis #@pass
  list<datum> get_k_center()

  #@random #@analysis #@pass
  datum get_nearest_center(0: datum point)

  #@random #@analysis #@pass
  list<weighted_datum > get_nearest_members(0: datum point)

  #@random #@analysis #@pass
  list<weighted_index > get_nearest_members_light(0: datum point)
  
  #@broadcast #@update #@all_and
  bool clear()
}
