/**
 * Copyright 2019 Huawei Technologies Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// ms_manager.proto
syntax = "proto3";

package mindspore.serving.proto;
import "mindspore_serving/proto/ms_service.proto";

service MSMaster {
  rpc Register(RegisterRequest) returns (RegisterReply) {}
  rpc Exit(ExitRequest) returns (ExitReply) {}
  rpc AddWorker(AddWorkerRequest) returns (AddWorkerReply) {}
  rpc RemoveWorker(RemoveWorkerRequest) returns (RemoveWorkerReply) {}
  rpc Ping(PingRequest) returns (PingReply) {}
  rpc Pong(PongRequest) returns (PongReply) {}
}

message WorkerSpec {
  string name = 1;
  int64 version_number = 2;

  message MethodInfo{
    string name = 1;
    repeated string input_names = 2;
  }
  repeated MethodInfo methods = 5;
}

message RegisterRequest {
  repeated WorkerSpec worker_spec = 1;
  string address = 2;
}

message RegisterReply {
  ErrorMsg error_msg = 1;
}

message ExitRequest {
  string address = 1;
}

message ExitReply {
  ErrorMsg error_msg = 1;
}

message AddWorkerRequest {
  WorkerSpec worker_spec = 1;
  string address = 2;
}

message AddWorkerReply {
  ErrorMsg error_msg = 1;
}

message RemoveWorkerRequest {
  WorkerSpec worker_spec = 1;
  string address = 2;
}

message RemoveWorkerReply {
  ErrorMsg error_msg = 1;
}
