/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
syntax = "proto2";

// The protos for ConnectionRegistry.
package hbase.pb;

option java_package = "org.apache.hadoop.hbase.shaded.protobuf.generated";
option java_outer_classname = "RegistryProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
option optimize_for = SPEED;

import "HBase.proto";

/** Request and response to get the clusterID for this cluster */
message GetClusterIdRequest {
}
message GetClusterIdResponse {
  /** Not set if cluster ID could not be determined. */
  optional string cluster_id = 1;
}

/** Request and response to get the currently active master name for this cluster */
message GetActiveMasterRequest {
}
message GetActiveMasterResponse {
  /** Not set if an active master could not be determined. */
  optional ServerName server_name = 1;
}

/** Request and response to get the current list of all registers master servers */
message GetMastersRequest {
  option deprecated = true;
}
message GetMastersResponseEntry {
  option deprecated = true;
  required ServerName server_name = 1;
  required bool is_active = 2;
}
message GetMastersResponse {
  option deprecated = true;
  repeated GetMastersResponseEntry master_servers = 1;
}

/** Request and response to get the current list of meta region locations */
message GetMetaRegionLocationsRequest {
}
message GetMetaRegionLocationsResponse {
  /** Not set if meta region locations could not be determined. */
  repeated RegionLocation meta_locations = 1;
}

/** Request and response to get the nodes which could be used to as ClientMetaService */
message GetBootstrapNodesRequest {
}
message GetBootstrapNodesResponse {
  repeated ServerName server_name = 1;
}

/**
 * Implements all the RPCs needed by clients to look up cluster meta information needed for
 * connection establishment.
 */
service ClientMetaService {
  /**
   * Get Cluster ID for this cluster.
   */
  rpc GetClusterId(GetClusterIdRequest) returns(GetClusterIdResponse);

  /**
   * Get active master server name for this cluster. Retained for out of sync client and master
   * rolling upgrades. Newer clients switched to GetMasters RPC request.
   */
  rpc GetActiveMaster(GetActiveMasterRequest) returns(GetActiveMasterResponse);

  /**
   * Get registered list of master servers in this cluster.
   */
  rpc GetMasters(GetMastersRequest) returns(GetMastersResponse) {
    option deprecated = true;
  };

  /**
   * Get current meta replicas' region locations.
   */
  rpc GetMetaRegionLocations(GetMetaRegionLocationsRequest) returns(GetMetaRegionLocationsResponse);

  /**
   * Get nodes which could be used as ClientMetaService
   */
  rpc GetBootstrapNodes(GetBootstrapNodesRequest) returns (GetBootstrapNodesResponse);
}