syntax = "proto2";

option java_multiple_files = true;
option java_package = "alluxio.grpc";
option java_outer_classname = "JournalMasterProto";

package alluxio.grpc.journal;

import "grpc/common.proto";

enum QuorumServerState {
    AVAILABLE = 1;
    UNAVAILABLE = 2;
}

enum JournalDomain {
    MASTER = 1;
    JOB_MASTER = 2;
}

message QuorumServerInfo {
    optional NetAddress serverAddress = 1;
    optional QuorumServerState serverState = 2;
}

// GetQuorumInfo API
message GetQuorumInfoPOptions {}
message GetQuorumInfoPRequest {
    optional GetQuorumInfoPOptions options = 1;
}
message GetQuorumInfoPResponse {
    optional JournalDomain domain = 1;
    repeated QuorumServerInfo serverInfo = 2;
}

// RemoveQuorumServer API
message RemoveQuorumServerPOptions {}
message RemoveQuorumServerPRequest {
    optional RemoveQuorumServerPOptions options = 1;
    optional NetAddress serverAddress = 2;
}
message RemoveQuorumServerPResponse {}

/**
  * This interface contains journal master service endpoints for Alluxio clients.
  */
service JournalMasterClientService {

    /**
     * Gets list of server states in an embedded journal quorum.
     */
    rpc GetQuorumInfo(GetQuorumInfoPRequest) returns (GetQuorumInfoPResponse);

    /**
     * Removes a server from embedded journal quorum.
     */
    rpc RemoveQuorumServer(RemoveQuorumServerPRequest) returns (RemoveQuorumServerPResponse);
}
