grpclb: update load_balancer.proto to the latest version. (#3329)

Combined drop for rate limiting and drop for load balancing, broken down by token.
This commit is contained in:
Kun Zhang 2017-08-10 14:53:51 -07:00 committed by GitHub
parent c392a91a99
commit c8216e45f2
11 changed files with 1384 additions and 490 deletions

View File

@ -22,10 +22,9 @@ public final class ClientStats extends
private ClientStats() {
numCallsStarted_ = 0L;
numCallsFinished_ = 0L;
numCallsFinishedWithDropForRateLimiting_ = 0L;
numCallsFinishedWithDropForLoadBalancing_ = 0L;
numCallsFinishedWithClientFailedToSend_ = 0L;
numCallsFinishedKnownReceived_ = 0L;
callsFinishedWithDrop_ = java.util.Collections.emptyList();
}
@java.lang.Override
@ -76,16 +75,6 @@ public final class ClientStats extends
numCallsFinished_ = input.readInt64();
break;
}
case 32: {
numCallsFinishedWithDropForRateLimiting_ = input.readInt64();
break;
}
case 40: {
numCallsFinishedWithDropForLoadBalancing_ = input.readInt64();
break;
}
case 48: {
numCallsFinishedWithClientFailedToSend_ = input.readInt64();
@ -96,6 +85,15 @@ public final class ClientStats extends
numCallsFinishedKnownReceived_ = input.readInt64();
break;
}
case 66: {
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
callsFinishedWithDrop_ = new java.util.ArrayList<io.grpc.grpclb.ClientStatsPerToken>();
mutable_bitField0_ |= 0x00000020;
}
callsFinishedWithDrop_.add(
input.readMessage(io.grpc.grpclb.ClientStatsPerToken.parser(), extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -104,6 +102,9 @@ public final class ClientStats extends
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
callsFinishedWithDrop_ = java.util.Collections.unmodifiableList(callsFinishedWithDrop_);
}
makeExtensionsImmutable();
}
}
@ -119,6 +120,7 @@ public final class ClientStats extends
io.grpc.grpclb.ClientStats.class, io.grpc.grpclb.ClientStats.Builder.class);
}
private int bitField0_;
public static final int TIMESTAMP_FIELD_NUMBER = 1;
private com.google.protobuf.Timestamp timestamp_;
/**
@ -178,34 +180,6 @@ public final class ClientStats extends
return numCallsFinished_;
}
public static final int NUM_CALLS_FINISHED_WITH_DROP_FOR_RATE_LIMITING_FIELD_NUMBER = 4;
private long numCallsFinishedWithDropForRateLimiting_;
/**
* <pre>
* The total number of RPCs that were dropped by the client because of rate
* limiting.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_rate_limiting = 4;</code>
*/
public long getNumCallsFinishedWithDropForRateLimiting() {
return numCallsFinishedWithDropForRateLimiting_;
}
public static final int NUM_CALLS_FINISHED_WITH_DROP_FOR_LOAD_BALANCING_FIELD_NUMBER = 5;
private long numCallsFinishedWithDropForLoadBalancing_;
/**
* <pre>
* The total number of RPCs that were dropped by the client because of load
* balancing.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_load_balancing = 5;</code>
*/
public long getNumCallsFinishedWithDropForLoadBalancing() {
return numCallsFinishedWithDropForLoadBalancing_;
}
public static final int NUM_CALLS_FINISHED_WITH_CLIENT_FAILED_TO_SEND_FIELD_NUMBER = 6;
private long numCallsFinishedWithClientFailedToSend_;
/**
@ -233,6 +207,61 @@ public final class ClientStats extends
return numCallsFinishedKnownReceived_;
}
public static final int CALLS_FINISHED_WITH_DROP_FIELD_NUMBER = 8;
private java.util.List<io.grpc.grpclb.ClientStatsPerToken> callsFinishedWithDrop_;
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public java.util.List<io.grpc.grpclb.ClientStatsPerToken> getCallsFinishedWithDropList() {
return callsFinishedWithDrop_;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public java.util.List<? extends io.grpc.grpclb.ClientStatsPerTokenOrBuilder>
getCallsFinishedWithDropOrBuilderList() {
return callsFinishedWithDrop_;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public int getCallsFinishedWithDropCount() {
return callsFinishedWithDrop_.size();
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerToken getCallsFinishedWithDrop(int index) {
return callsFinishedWithDrop_.get(index);
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerTokenOrBuilder getCallsFinishedWithDropOrBuilder(
int index) {
return callsFinishedWithDrop_.get(index);
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
@ -254,18 +283,15 @@ public final class ClientStats extends
if (numCallsFinished_ != 0L) {
output.writeInt64(3, numCallsFinished_);
}
if (numCallsFinishedWithDropForRateLimiting_ != 0L) {
output.writeInt64(4, numCallsFinishedWithDropForRateLimiting_);
}
if (numCallsFinishedWithDropForLoadBalancing_ != 0L) {
output.writeInt64(5, numCallsFinishedWithDropForLoadBalancing_);
}
if (numCallsFinishedWithClientFailedToSend_ != 0L) {
output.writeInt64(6, numCallsFinishedWithClientFailedToSend_);
}
if (numCallsFinishedKnownReceived_ != 0L) {
output.writeInt64(7, numCallsFinishedKnownReceived_);
}
for (int i = 0; i < callsFinishedWithDrop_.size(); i++) {
output.writeMessage(8, callsFinishedWithDrop_.get(i));
}
}
public int getSerializedSize() {
@ -285,14 +311,6 @@ public final class ClientStats extends
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(3, numCallsFinished_);
}
if (numCallsFinishedWithDropForRateLimiting_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(4, numCallsFinishedWithDropForRateLimiting_);
}
if (numCallsFinishedWithDropForLoadBalancing_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(5, numCallsFinishedWithDropForLoadBalancing_);
}
if (numCallsFinishedWithClientFailedToSend_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(6, numCallsFinishedWithClientFailedToSend_);
@ -301,6 +319,10 @@ public final class ClientStats extends
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(7, numCallsFinishedKnownReceived_);
}
for (int i = 0; i < callsFinishedWithDrop_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(8, callsFinishedWithDrop_.get(i));
}
memoizedSize = size;
return size;
}
@ -326,14 +348,12 @@ public final class ClientStats extends
== other.getNumCallsStarted());
result = result && (getNumCallsFinished()
== other.getNumCallsFinished());
result = result && (getNumCallsFinishedWithDropForRateLimiting()
== other.getNumCallsFinishedWithDropForRateLimiting());
result = result && (getNumCallsFinishedWithDropForLoadBalancing()
== other.getNumCallsFinishedWithDropForLoadBalancing());
result = result && (getNumCallsFinishedWithClientFailedToSend()
== other.getNumCallsFinishedWithClientFailedToSend());
result = result && (getNumCallsFinishedKnownReceived()
== other.getNumCallsFinishedKnownReceived());
result = result && getCallsFinishedWithDropList()
.equals(other.getCallsFinishedWithDropList());
return result;
}
@ -354,18 +374,16 @@ public final class ClientStats extends
hash = (37 * hash) + NUM_CALLS_FINISHED_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getNumCallsFinished());
hash = (37 * hash) + NUM_CALLS_FINISHED_WITH_DROP_FOR_RATE_LIMITING_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getNumCallsFinishedWithDropForRateLimiting());
hash = (37 * hash) + NUM_CALLS_FINISHED_WITH_DROP_FOR_LOAD_BALANCING_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getNumCallsFinishedWithDropForLoadBalancing());
hash = (37 * hash) + NUM_CALLS_FINISHED_WITH_CLIENT_FAILED_TO_SEND_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getNumCallsFinishedWithClientFailedToSend());
hash = (37 * hash) + NUM_CALLS_FINISHED_KNOWN_RECEIVED_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getNumCallsFinishedKnownReceived());
if (getCallsFinishedWithDropCount() > 0) {
hash = (37 * hash) + CALLS_FINISHED_WITH_DROP_FIELD_NUMBER;
hash = (53 * hash) + getCallsFinishedWithDropList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
@ -496,6 +514,7 @@ public final class ClientStats extends
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
getCallsFinishedWithDropFieldBuilder();
}
}
public Builder clear() {
@ -510,14 +529,16 @@ public final class ClientStats extends
numCallsFinished_ = 0L;
numCallsFinishedWithDropForRateLimiting_ = 0L;
numCallsFinishedWithDropForLoadBalancing_ = 0L;
numCallsFinishedWithClientFailedToSend_ = 0L;
numCallsFinishedKnownReceived_ = 0L;
if (callsFinishedWithDropBuilder_ == null) {
callsFinishedWithDrop_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
} else {
callsFinishedWithDropBuilder_.clear();
}
return this;
}
@ -540,6 +561,8 @@ public final class ClientStats extends
public io.grpc.grpclb.ClientStats buildPartial() {
io.grpc.grpclb.ClientStats result = new io.grpc.grpclb.ClientStats(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (timestampBuilder_ == null) {
result.timestamp_ = timestamp_;
} else {
@ -547,10 +570,18 @@ public final class ClientStats extends
}
result.numCallsStarted_ = numCallsStarted_;
result.numCallsFinished_ = numCallsFinished_;
result.numCallsFinishedWithDropForRateLimiting_ = numCallsFinishedWithDropForRateLimiting_;
result.numCallsFinishedWithDropForLoadBalancing_ = numCallsFinishedWithDropForLoadBalancing_;
result.numCallsFinishedWithClientFailedToSend_ = numCallsFinishedWithClientFailedToSend_;
result.numCallsFinishedKnownReceived_ = numCallsFinishedKnownReceived_;
if (callsFinishedWithDropBuilder_ == null) {
if (((bitField0_ & 0x00000020) == 0x00000020)) {
callsFinishedWithDrop_ = java.util.Collections.unmodifiableList(callsFinishedWithDrop_);
bitField0_ = (bitField0_ & ~0x00000020);
}
result.callsFinishedWithDrop_ = callsFinishedWithDrop_;
} else {
result.callsFinishedWithDrop_ = callsFinishedWithDropBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@ -601,18 +632,38 @@ public final class ClientStats extends
if (other.getNumCallsFinished() != 0L) {
setNumCallsFinished(other.getNumCallsFinished());
}
if (other.getNumCallsFinishedWithDropForRateLimiting() != 0L) {
setNumCallsFinishedWithDropForRateLimiting(other.getNumCallsFinishedWithDropForRateLimiting());
}
if (other.getNumCallsFinishedWithDropForLoadBalancing() != 0L) {
setNumCallsFinishedWithDropForLoadBalancing(other.getNumCallsFinishedWithDropForLoadBalancing());
}
if (other.getNumCallsFinishedWithClientFailedToSend() != 0L) {
setNumCallsFinishedWithClientFailedToSend(other.getNumCallsFinishedWithClientFailedToSend());
}
if (other.getNumCallsFinishedKnownReceived() != 0L) {
setNumCallsFinishedKnownReceived(other.getNumCallsFinishedKnownReceived());
}
if (callsFinishedWithDropBuilder_ == null) {
if (!other.callsFinishedWithDrop_.isEmpty()) {
if (callsFinishedWithDrop_.isEmpty()) {
callsFinishedWithDrop_ = other.callsFinishedWithDrop_;
bitField0_ = (bitField0_ & ~0x00000020);
} else {
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.addAll(other.callsFinishedWithDrop_);
}
onChanged();
}
} else {
if (!other.callsFinishedWithDrop_.isEmpty()) {
if (callsFinishedWithDropBuilder_.isEmpty()) {
callsFinishedWithDropBuilder_.dispose();
callsFinishedWithDropBuilder_ = null;
callsFinishedWithDrop_ = other.callsFinishedWithDrop_;
bitField0_ = (bitField0_ & ~0x00000020);
callsFinishedWithDropBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
getCallsFinishedWithDropFieldBuilder() : null;
} else {
callsFinishedWithDropBuilder_.addAllMessages(other.callsFinishedWithDrop_);
}
}
}
onChanged();
return this;
}
@ -638,6 +689,7 @@ public final class ClientStats extends
}
return this;
}
private int bitField0_;
private com.google.protobuf.Timestamp timestamp_ = null;
private com.google.protobuf.SingleFieldBuilderV3<
@ -868,88 +920,6 @@ public final class ClientStats extends
return this;
}
private long numCallsFinishedWithDropForRateLimiting_ ;
/**
* <pre>
* The total number of RPCs that were dropped by the client because of rate
* limiting.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_rate_limiting = 4;</code>
*/
public long getNumCallsFinishedWithDropForRateLimiting() {
return numCallsFinishedWithDropForRateLimiting_;
}
/**
* <pre>
* The total number of RPCs that were dropped by the client because of rate
* limiting.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_rate_limiting = 4;</code>
*/
public Builder setNumCallsFinishedWithDropForRateLimiting(long value) {
numCallsFinishedWithDropForRateLimiting_ = value;
onChanged();
return this;
}
/**
* <pre>
* The total number of RPCs that were dropped by the client because of rate
* limiting.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_rate_limiting = 4;</code>
*/
public Builder clearNumCallsFinishedWithDropForRateLimiting() {
numCallsFinishedWithDropForRateLimiting_ = 0L;
onChanged();
return this;
}
private long numCallsFinishedWithDropForLoadBalancing_ ;
/**
* <pre>
* The total number of RPCs that were dropped by the client because of load
* balancing.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_load_balancing = 5;</code>
*/
public long getNumCallsFinishedWithDropForLoadBalancing() {
return numCallsFinishedWithDropForLoadBalancing_;
}
/**
* <pre>
* The total number of RPCs that were dropped by the client because of load
* balancing.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_load_balancing = 5;</code>
*/
public Builder setNumCallsFinishedWithDropForLoadBalancing(long value) {
numCallsFinishedWithDropForLoadBalancing_ = value;
onChanged();
return this;
}
/**
* <pre>
* The total number of RPCs that were dropped by the client because of load
* balancing.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_load_balancing = 5;</code>
*/
public Builder clearNumCallsFinishedWithDropForLoadBalancing() {
numCallsFinishedWithDropForLoadBalancing_ = 0L;
onChanged();
return this;
}
private long numCallsFinishedWithClientFailedToSend_ ;
/**
* <pre>
@ -1028,6 +998,318 @@ public final class ClientStats extends
onChanged();
return this;
}
private java.util.List<io.grpc.grpclb.ClientStatsPerToken> callsFinishedWithDrop_ =
java.util.Collections.emptyList();
private void ensureCallsFinishedWithDropIsMutable() {
if (!((bitField0_ & 0x00000020) == 0x00000020)) {
callsFinishedWithDrop_ = new java.util.ArrayList<io.grpc.grpclb.ClientStatsPerToken>(callsFinishedWithDrop_);
bitField0_ |= 0x00000020;
}
}
private com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.grpclb.ClientStatsPerToken, io.grpc.grpclb.ClientStatsPerToken.Builder, io.grpc.grpclb.ClientStatsPerTokenOrBuilder> callsFinishedWithDropBuilder_;
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public java.util.List<io.grpc.grpclb.ClientStatsPerToken> getCallsFinishedWithDropList() {
if (callsFinishedWithDropBuilder_ == null) {
return java.util.Collections.unmodifiableList(callsFinishedWithDrop_);
} else {
return callsFinishedWithDropBuilder_.getMessageList();
}
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public int getCallsFinishedWithDropCount() {
if (callsFinishedWithDropBuilder_ == null) {
return callsFinishedWithDrop_.size();
} else {
return callsFinishedWithDropBuilder_.getCount();
}
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerToken getCallsFinishedWithDrop(int index) {
if (callsFinishedWithDropBuilder_ == null) {
return callsFinishedWithDrop_.get(index);
} else {
return callsFinishedWithDropBuilder_.getMessage(index);
}
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder setCallsFinishedWithDrop(
int index, io.grpc.grpclb.ClientStatsPerToken value) {
if (callsFinishedWithDropBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.set(index, value);
onChanged();
} else {
callsFinishedWithDropBuilder_.setMessage(index, value);
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder setCallsFinishedWithDrop(
int index, io.grpc.grpclb.ClientStatsPerToken.Builder builderForValue) {
if (callsFinishedWithDropBuilder_ == null) {
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.set(index, builderForValue.build());
onChanged();
} else {
callsFinishedWithDropBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder addCallsFinishedWithDrop(io.grpc.grpclb.ClientStatsPerToken value) {
if (callsFinishedWithDropBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.add(value);
onChanged();
} else {
callsFinishedWithDropBuilder_.addMessage(value);
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder addCallsFinishedWithDrop(
int index, io.grpc.grpclb.ClientStatsPerToken value) {
if (callsFinishedWithDropBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.add(index, value);
onChanged();
} else {
callsFinishedWithDropBuilder_.addMessage(index, value);
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder addCallsFinishedWithDrop(
io.grpc.grpclb.ClientStatsPerToken.Builder builderForValue) {
if (callsFinishedWithDropBuilder_ == null) {
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.add(builderForValue.build());
onChanged();
} else {
callsFinishedWithDropBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder addCallsFinishedWithDrop(
int index, io.grpc.grpclb.ClientStatsPerToken.Builder builderForValue) {
if (callsFinishedWithDropBuilder_ == null) {
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.add(index, builderForValue.build());
onChanged();
} else {
callsFinishedWithDropBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder addAllCallsFinishedWithDrop(
java.lang.Iterable<? extends io.grpc.grpclb.ClientStatsPerToken> values) {
if (callsFinishedWithDropBuilder_ == null) {
ensureCallsFinishedWithDropIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, callsFinishedWithDrop_);
onChanged();
} else {
callsFinishedWithDropBuilder_.addAllMessages(values);
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder clearCallsFinishedWithDrop() {
if (callsFinishedWithDropBuilder_ == null) {
callsFinishedWithDrop_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000020);
onChanged();
} else {
callsFinishedWithDropBuilder_.clear();
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public Builder removeCallsFinishedWithDrop(int index) {
if (callsFinishedWithDropBuilder_ == null) {
ensureCallsFinishedWithDropIsMutable();
callsFinishedWithDrop_.remove(index);
onChanged();
} else {
callsFinishedWithDropBuilder_.remove(index);
}
return this;
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerToken.Builder getCallsFinishedWithDropBuilder(
int index) {
return getCallsFinishedWithDropFieldBuilder().getBuilder(index);
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerTokenOrBuilder getCallsFinishedWithDropOrBuilder(
int index) {
if (callsFinishedWithDropBuilder_ == null) {
return callsFinishedWithDrop_.get(index); } else {
return callsFinishedWithDropBuilder_.getMessageOrBuilder(index);
}
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public java.util.List<? extends io.grpc.grpclb.ClientStatsPerTokenOrBuilder>
getCallsFinishedWithDropOrBuilderList() {
if (callsFinishedWithDropBuilder_ != null) {
return callsFinishedWithDropBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(callsFinishedWithDrop_);
}
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerToken.Builder addCallsFinishedWithDropBuilder() {
return getCallsFinishedWithDropFieldBuilder().addBuilder(
io.grpc.grpclb.ClientStatsPerToken.getDefaultInstance());
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public io.grpc.grpclb.ClientStatsPerToken.Builder addCallsFinishedWithDropBuilder(
int index) {
return getCallsFinishedWithDropFieldBuilder().addBuilder(
index, io.grpc.grpclb.ClientStatsPerToken.getDefaultInstance());
}
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
public java.util.List<io.grpc.grpclb.ClientStatsPerToken.Builder>
getCallsFinishedWithDropBuilderList() {
return getCallsFinishedWithDropFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.grpclb.ClientStatsPerToken, io.grpc.grpclb.ClientStatsPerToken.Builder, io.grpc.grpclb.ClientStatsPerTokenOrBuilder>
getCallsFinishedWithDropFieldBuilder() {
if (callsFinishedWithDropBuilder_ == null) {
callsFinishedWithDropBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
io.grpc.grpclb.ClientStatsPerToken, io.grpc.grpclb.ClientStatsPerToken.Builder, io.grpc.grpclb.ClientStatsPerTokenOrBuilder>(
callsFinishedWithDrop_,
((bitField0_ & 0x00000020) == 0x00000020),
getParentForChildren(),
isClean());
callsFinishedWithDrop_ = null;
}
return callsFinishedWithDropBuilder_;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return this;

View File

@ -50,26 +50,6 @@ public interface ClientStatsOrBuilder extends
*/
long getNumCallsFinished();
/**
* <pre>
* The total number of RPCs that were dropped by the client because of rate
* limiting.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_rate_limiting = 4;</code>
*/
long getNumCallsFinishedWithDropForRateLimiting();
/**
* <pre>
* The total number of RPCs that were dropped by the client because of load
* balancing.
* </pre>
*
* <code>int64 num_calls_finished_with_drop_for_load_balancing = 5;</code>
*/
long getNumCallsFinishedWithDropForLoadBalancing();
/**
* <pre>
* The total number of RPCs that failed to reach a server except dropped RPCs.
@ -88,4 +68,48 @@ public interface ClientStatsOrBuilder extends
* <code>int64 num_calls_finished_known_received = 7;</code>
*/
long getNumCallsFinishedKnownReceived();
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
java.util.List<io.grpc.grpclb.ClientStatsPerToken>
getCallsFinishedWithDropList();
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
io.grpc.grpclb.ClientStatsPerToken getCallsFinishedWithDrop(int index);
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
int getCallsFinishedWithDropCount();
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
java.util.List<? extends io.grpc.grpclb.ClientStatsPerTokenOrBuilder>
getCallsFinishedWithDropOrBuilderList();
/**
* <pre>
* The list of dropped calls.
* </pre>
*
* <code>repeated .grpc.lb.v1.ClientStatsPerToken calls_finished_with_drop = 8;</code>
*/
io.grpc.grpclb.ClientStatsPerTokenOrBuilder getCallsFinishedWithDropOrBuilder(
int index);
}

View File

@ -0,0 +1,616 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: load_balancer.proto
package io.grpc.grpclb;
/**
* <pre>
* Contains the number of calls finished for a particular load balance token.
* </pre>
*
* Protobuf type {@code grpc.lb.v1.ClientStatsPerToken}
*/
public final class ClientStatsPerToken extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:grpc.lb.v1.ClientStatsPerToken)
ClientStatsPerTokenOrBuilder {
// Use ClientStatsPerToken.newBuilder() to construct.
private ClientStatsPerToken(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private ClientStatsPerToken() {
loadBalanceToken_ = "";
numCalls_ = 0L;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
}
private ClientStatsPerToken(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
int mutable_bitField0_ = 0;
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!input.skipField(tag)) {
done = true;
}
break;
}
case 10: {
java.lang.String s = input.readStringRequireUtf8();
loadBalanceToken_ = s;
break;
}
case 16: {
numCalls_ = input.readInt64();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStatsPerToken_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStatsPerToken_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.grpclb.ClientStatsPerToken.class, io.grpc.grpclb.ClientStatsPerToken.Builder.class);
}
public static final int LOAD_BALANCE_TOKEN_FIELD_NUMBER = 1;
private volatile java.lang.Object loadBalanceToken_;
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public java.lang.String getLoadBalanceToken() {
java.lang.Object ref = loadBalanceToken_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
loadBalanceToken_ = s;
return s;
}
}
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public com.google.protobuf.ByteString
getLoadBalanceTokenBytes() {
java.lang.Object ref = loadBalanceToken_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
loadBalanceToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int NUM_CALLS_FIELD_NUMBER = 2;
private long numCalls_;
/**
* <pre>
* The total number of RPCs that finished associated with the token.
* </pre>
*
* <code>int64 num_calls = 2;</code>
*/
public long getNumCalls() {
return numCalls_;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getLoadBalanceTokenBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, loadBalanceToken_);
}
if (numCalls_ != 0L) {
output.writeInt64(2, numCalls_);
}
}
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getLoadBalanceTokenBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, loadBalanceToken_);
}
if (numCalls_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(2, numCalls_);
}
memoizedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.grpc.grpclb.ClientStatsPerToken)) {
return super.equals(obj);
}
io.grpc.grpclb.ClientStatsPerToken other = (io.grpc.grpclb.ClientStatsPerToken) obj;
boolean result = true;
result = result && getLoadBalanceToken()
.equals(other.getLoadBalanceToken());
result = result && (getNumCalls()
== other.getNumCalls());
return result;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + LOAD_BALANCE_TOKEN_FIELD_NUMBER;
hash = (53 * hash) + getLoadBalanceToken().hashCode();
hash = (37 * hash) + NUM_CALLS_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getNumCalls());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.grpclb.ClientStatsPerToken parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.grpc.grpclb.ClientStatsPerToken parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.grpc.grpclb.ClientStatsPerToken parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.grpc.grpclb.ClientStatsPerToken prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* Contains the number of calls finished for a particular load balance token.
* </pre>
*
* Protobuf type {@code grpc.lb.v1.ClientStatsPerToken}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:grpc.lb.v1.ClientStatsPerToken)
io.grpc.grpclb.ClientStatsPerTokenOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStatsPerToken_descriptor;
}
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStatsPerToken_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.grpc.grpclb.ClientStatsPerToken.class, io.grpc.grpclb.ClientStatsPerToken.Builder.class);
}
// Construct using io.grpc.grpclb.ClientStatsPerToken.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
public Builder clear() {
super.clear();
loadBalanceToken_ = "";
numCalls_ = 0L;
return this;
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.grpc.grpclb.LoadBalancerProto.internal_static_grpc_lb_v1_ClientStatsPerToken_descriptor;
}
public io.grpc.grpclb.ClientStatsPerToken getDefaultInstanceForType() {
return io.grpc.grpclb.ClientStatsPerToken.getDefaultInstance();
}
public io.grpc.grpclb.ClientStatsPerToken build() {
io.grpc.grpclb.ClientStatsPerToken result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public io.grpc.grpclb.ClientStatsPerToken buildPartial() {
io.grpc.grpclb.ClientStatsPerToken result = new io.grpc.grpclb.ClientStatsPerToken(this);
result.loadBalanceToken_ = loadBalanceToken_;
result.numCalls_ = numCalls_;
onBuilt();
return result;
}
public Builder clone() {
return (Builder) super.clone();
}
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.setField(field, value);
}
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return (Builder) super.clearField(field);
}
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return (Builder) super.clearOneof(oneof);
}
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, Object value) {
return (Builder) super.setRepeatedField(field, index, value);
}
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) {
return (Builder) super.addRepeatedField(field, value);
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.grpc.grpclb.ClientStatsPerToken) {
return mergeFrom((io.grpc.grpclb.ClientStatsPerToken)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.grpc.grpclb.ClientStatsPerToken other) {
if (other == io.grpc.grpclb.ClientStatsPerToken.getDefaultInstance()) return this;
if (!other.getLoadBalanceToken().isEmpty()) {
loadBalanceToken_ = other.loadBalanceToken_;
onChanged();
}
if (other.getNumCalls() != 0L) {
setNumCalls(other.getNumCalls());
}
onChanged();
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.grpc.grpclb.ClientStatsPerToken parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.grpc.grpclb.ClientStatsPerToken) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object loadBalanceToken_ = "";
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public java.lang.String getLoadBalanceToken() {
java.lang.Object ref = loadBalanceToken_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
loadBalanceToken_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public com.google.protobuf.ByteString
getLoadBalanceTokenBytes() {
java.lang.Object ref = loadBalanceToken_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
loadBalanceToken_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public Builder setLoadBalanceToken(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
loadBalanceToken_ = value;
onChanged();
return this;
}
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public Builder clearLoadBalanceToken() {
loadBalanceToken_ = getDefaultInstance().getLoadBalanceToken();
onChanged();
return this;
}
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
public Builder setLoadBalanceTokenBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
loadBalanceToken_ = value;
onChanged();
return this;
}
private long numCalls_ ;
/**
* <pre>
* The total number of RPCs that finished associated with the token.
* </pre>
*
* <code>int64 num_calls = 2;</code>
*/
public long getNumCalls() {
return numCalls_;
}
/**
* <pre>
* The total number of RPCs that finished associated with the token.
* </pre>
*
* <code>int64 num_calls = 2;</code>
*/
public Builder setNumCalls(long value) {
numCalls_ = value;
onChanged();
return this;
}
/**
* <pre>
* The total number of RPCs that finished associated with the token.
* </pre>
*
* <code>int64 num_calls = 2;</code>
*/
public Builder clearNumCalls() {
numCalls_ = 0L;
onChanged();
return this;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return this;
}
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return this;
}
// @@protoc_insertion_point(builder_scope:grpc.lb.v1.ClientStatsPerToken)
}
// @@protoc_insertion_point(class_scope:grpc.lb.v1.ClientStatsPerToken)
private static final io.grpc.grpclb.ClientStatsPerToken DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.grpc.grpclb.ClientStatsPerToken();
}
public static io.grpc.grpclb.ClientStatsPerToken getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<ClientStatsPerToken>
PARSER = new com.google.protobuf.AbstractParser<ClientStatsPerToken>() {
public ClientStatsPerToken parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new ClientStatsPerToken(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<ClientStatsPerToken> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<ClientStatsPerToken> getParserForType() {
return PARSER;
}
public io.grpc.grpclb.ClientStatsPerToken getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}

View File

@ -0,0 +1,36 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: load_balancer.proto
package io.grpc.grpclb;
public interface ClientStatsPerTokenOrBuilder extends
// @@protoc_insertion_point(interface_extends:grpc.lb.v1.ClientStatsPerToken)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
java.lang.String getLoadBalanceToken();
/**
* <pre>
* See Server.load_balance_token.
* </pre>
*
* <code>string load_balance_token = 1;</code>
*/
com.google.protobuf.ByteString
getLoadBalanceTokenBytes();
/**
* <pre>
* The total number of RPCs that finished associated with the token.
* </pre>
*
* <code>int64 num_calls = 2;</code>
*/
long getNumCalls();
}

View File

@ -24,6 +24,11 @@ public final class LoadBalancerProto {
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_lb_v1_InitialLoadBalanceRequest_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_lb_v1_ClientStatsPerToken_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_grpc_lb_v1_ClientStatsPerToken_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_grpc_lb_v1_ClientStats_descriptor;
static final
@ -65,33 +70,32 @@ public final class LoadBalancerProto {
"InitialLoadBalanceRequestH\000\022/\n\014client_st" +
"ats\030\002 \001(\0132\027.grpc.lb.v1.ClientStatsH\000B\033\n\031" +
"load_balance_request_type\")\n\031InitialLoad" +
"BalanceRequest\022\014\n\004name\030\001 \001(\t\"\306\002\n\013ClientS" +
"tats\022-\n\ttimestamp\030\001 \001(\0132\032.google.protobu" +
"f.Timestamp\022\031\n\021num_calls_started\030\002 \001(\003\022\032",
"\n\022num_calls_finished\030\003 \001(\003\0226\n.num_calls_" +
"finished_with_drop_for_rate_limiting\030\004 \001" +
"(\003\0227\n/num_calls_finished_with_drop_for_l" +
"oad_balancing\030\005 \001(\003\0225\n-num_calls_finishe" +
"d_with_client_failed_to_send\030\006 \001(\003\022)\n!nu" +
"m_calls_finished_known_received\030\007 \001(\003\"\246\001" +
"\n\023LoadBalanceResponse\022B\n\020initial_respons" +
"e\030\001 \001(\0132&.grpc.lb.v1.InitialLoadBalanceR" +
"esponseH\000\022-\n\013server_list\030\002 \001(\0132\026.grpc.lb" +
".v1.ServerListH\000B\034\n\032load_balance_respons",
"e_type\"}\n\032InitialLoadBalanceResponse\022\036\n\026" +
"load_balancer_delegate\030\001 \001(\t\022?\n\034client_s" +
"tats_report_interval\030\002 \001(\0132\031.google.prot" +
"obuf.Duration\"i\n\nServerList\022#\n\007servers\030\001" +
" \003(\0132\022.grpc.lb.v1.Server\0226\n\023expiration_i" +
"nterval\030\003 \001(\0132\031.google.protobuf.Duration" +
"\"\207\001\n\006Server\022\022\n\nip_address\030\001 \001(\014\022\014\n\004port\030" +
"\002 \001(\005\022\032\n\022load_balance_token\030\003 \001(\t\022\036\n\026dro" +
"p_for_rate_limiting\030\004 \001(\010\022\037\n\027drop_for_lo" +
"ad_balancing\030\005 \001(\0102b\n\014LoadBalancer\022R\n\013Ba",
"lanceLoad\022\036.grpc.lb.v1.LoadBalanceReques" +
"t\032\037.grpc.lb.v1.LoadBalanceResponse(\0010\001B%" +
"\n\016io.grpc.grpclbB\021LoadBalancerProtoP\001b\006p" +
"roto3"
"BalanceRequest\022\014\n\004name\030\001 \001(\t\"D\n\023ClientSt" +
"atsPerToken\022\032\n\022load_balance_token\030\001 \001(\t\022" +
"\021\n\tnum_calls\030\002 \001(\003\"\244\002\n\013ClientStats\022-\n\tti",
"mestamp\030\001 \001(\0132\032.google.protobuf.Timestam" +
"p\022\031\n\021num_calls_started\030\002 \001(\003\022\032\n\022num_call" +
"s_finished\030\003 \001(\003\0225\n-num_calls_finished_w" +
"ith_client_failed_to_send\030\006 \001(\003\022)\n!num_c" +
"alls_finished_known_received\030\007 \001(\003\022A\n\030ca" +
"lls_finished_with_drop\030\010 \003(\0132\037.grpc.lb.v" +
"1.ClientStatsPerTokenJ\004\010\004\020\005J\004\010\005\020\006\"\246\001\n\023Lo" +
"adBalanceResponse\022B\n\020initial_response\030\001 " +
"\001(\0132&.grpc.lb.v1.InitialLoadBalanceRespo" +
"nseH\000\022-\n\013server_list\030\002 \001(\0132\026.grpc.lb.v1.",
"ServerListH\000B\034\n\032load_balance_response_ty" +
"pe\"}\n\032InitialLoadBalanceResponse\022\036\n\026load" +
"_balancer_delegate\030\001 \001(\t\022?\n\034client_stats" +
"_report_interval\030\002 \001(\0132\031.google.protobuf" +
".Duration\"i\n\nServerList\022#\n\007servers\030\001 \003(\013" +
"2\022.grpc.lb.v1.Server\0226\n\023expiration_inter" +
"val\030\003 \001(\0132\031.google.protobuf.Duration\"Z\n\006" +
"Server\022\022\n\nip_address\030\001 \001(\014\022\014\n\004port\030\002 \001(\005" +
"\022\032\n\022load_balance_token\030\003 \001(\t\022\014\n\004drop\030\004 \001" +
"(\010J\004\010\005\020\0062b\n\014LoadBalancer\022R\n\013BalanceLoad\022",
"\036.grpc.lb.v1.LoadBalanceRequest\032\037.grpc.l" +
"b.v1.LoadBalanceResponse(\0010\001B%\n\016io.grpc." +
"grpclbB\021LoadBalancerProtoP\001b\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@ -119,36 +123,42 @@ public final class LoadBalancerProto {
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_InitialLoadBalanceRequest_descriptor,
new java.lang.String[] { "Name", });
internal_static_grpc_lb_v1_ClientStats_descriptor =
internal_static_grpc_lb_v1_ClientStatsPerToken_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_grpc_lb_v1_ClientStatsPerToken_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_ClientStatsPerToken_descriptor,
new java.lang.String[] { "LoadBalanceToken", "NumCalls", });
internal_static_grpc_lb_v1_ClientStats_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_grpc_lb_v1_ClientStats_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_ClientStats_descriptor,
new java.lang.String[] { "Timestamp", "NumCallsStarted", "NumCallsFinished", "NumCallsFinishedWithDropForRateLimiting", "NumCallsFinishedWithDropForLoadBalancing", "NumCallsFinishedWithClientFailedToSend", "NumCallsFinishedKnownReceived", });
new java.lang.String[] { "Timestamp", "NumCallsStarted", "NumCallsFinished", "NumCallsFinishedWithClientFailedToSend", "NumCallsFinishedKnownReceived", "CallsFinishedWithDrop", });
internal_static_grpc_lb_v1_LoadBalanceResponse_descriptor =
getDescriptor().getMessageTypes().get(3);
getDescriptor().getMessageTypes().get(4);
internal_static_grpc_lb_v1_LoadBalanceResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_LoadBalanceResponse_descriptor,
new java.lang.String[] { "InitialResponse", "ServerList", "LoadBalanceResponseType", });
internal_static_grpc_lb_v1_InitialLoadBalanceResponse_descriptor =
getDescriptor().getMessageTypes().get(4);
getDescriptor().getMessageTypes().get(5);
internal_static_grpc_lb_v1_InitialLoadBalanceResponse_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_InitialLoadBalanceResponse_descriptor,
new java.lang.String[] { "LoadBalancerDelegate", "ClientStatsReportInterval", });
internal_static_grpc_lb_v1_ServerList_descriptor =
getDescriptor().getMessageTypes().get(5);
getDescriptor().getMessageTypes().get(6);
internal_static_grpc_lb_v1_ServerList_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_ServerList_descriptor,
new java.lang.String[] { "Servers", "ExpirationInterval", });
internal_static_grpc_lb_v1_Server_descriptor =
getDescriptor().getMessageTypes().get(6);
getDescriptor().getMessageTypes().get(7);
internal_static_grpc_lb_v1_Server_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_grpc_lb_v1_Server_descriptor,
new java.lang.String[] { "IpAddress", "Port", "LoadBalanceToken", "DropForRateLimiting", "DropForLoadBalancing", });
new java.lang.String[] { "IpAddress", "Port", "LoadBalanceToken", "Drop", });
com.google.protobuf.DurationProto.getDescriptor();
com.google.protobuf.TimestampProto.getDescriptor();
}

View File

@ -5,10 +5,8 @@ package io.grpc.grpclb;
/**
* <pre>
* Contains server information. When none of the [drop_for_*] fields are true,
* use the other fields. When drop_for_rate_limiting is true, ignore all other
* fields. Use drop_for_load_balancing only when it is true and
* drop_for_rate_limiting is false.
* Contains server information. When the drop field is not true, use the other
* fields.
* </pre>
*
* Protobuf type {@code grpc.lb.v1.Server}
@ -25,8 +23,7 @@ public final class Server extends
ipAddress_ = com.google.protobuf.ByteString.EMPTY;
port_ = 0;
loadBalanceToken_ = "";
dropForRateLimiting_ = false;
dropForLoadBalancing_ = false;
drop_ = false;
}
@java.lang.Override
@ -72,12 +69,7 @@ public final class Server extends
}
case 32: {
dropForRateLimiting_ = input.readBool();
break;
}
case 40: {
dropForLoadBalancing_ = input.readBool();
drop_ = input.readBool();
break;
}
}
@ -137,7 +129,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -159,7 +152,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -178,32 +172,19 @@ public final class Server extends
}
}
public static final int DROP_FOR_RATE_LIMITING_FIELD_NUMBER = 4;
private boolean dropForRateLimiting_;
public static final int DROP_FIELD_NUMBER = 4;
private boolean drop_;
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for rate limiting.
* Indicates whether this particular request should be dropped by the client.
* If the request is dropped, there will be a corresponding entry in
* ClientStats.calls_finished_with_drop.
* </pre>
*
* <code>bool drop_for_rate_limiting = 4;</code>
* <code>bool drop = 4;</code>
*/
public boolean getDropForRateLimiting() {
return dropForRateLimiting_;
}
public static final int DROP_FOR_LOAD_BALANCING_FIELD_NUMBER = 5;
private boolean dropForLoadBalancing_;
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for load balancing.
* </pre>
*
* <code>bool drop_for_load_balancing = 5;</code>
*/
public boolean getDropForLoadBalancing() {
return dropForLoadBalancing_;
public boolean getDrop() {
return drop_;
}
private byte memoizedIsInitialized = -1;
@ -227,11 +208,8 @@ public final class Server extends
if (!getLoadBalanceTokenBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, loadBalanceToken_);
}
if (dropForRateLimiting_ != false) {
output.writeBool(4, dropForRateLimiting_);
}
if (dropForLoadBalancing_ != false) {
output.writeBool(5, dropForLoadBalancing_);
if (drop_ != false) {
output.writeBool(4, drop_);
}
}
@ -251,13 +229,9 @@ public final class Server extends
if (!getLoadBalanceTokenBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, loadBalanceToken_);
}
if (dropForRateLimiting_ != false) {
if (drop_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(4, dropForRateLimiting_);
}
if (dropForLoadBalancing_ != false) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(5, dropForLoadBalancing_);
.computeBoolSize(4, drop_);
}
memoizedSize = size;
return size;
@ -281,10 +255,8 @@ public final class Server extends
== other.getPort());
result = result && getLoadBalanceToken()
.equals(other.getLoadBalanceToken());
result = result && (getDropForRateLimiting()
== other.getDropForRateLimiting());
result = result && (getDropForLoadBalancing()
== other.getDropForLoadBalancing());
result = result && (getDrop()
== other.getDrop());
return result;
}
@ -301,12 +273,9 @@ public final class Server extends
hash = (53 * hash) + getPort();
hash = (37 * hash) + LOAD_BALANCE_TOKEN_FIELD_NUMBER;
hash = (53 * hash) + getLoadBalanceToken().hashCode();
hash = (37 * hash) + DROP_FOR_RATE_LIMITING_FIELD_NUMBER;
hash = (37 * hash) + DROP_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getDropForRateLimiting());
hash = (37 * hash) + DROP_FOR_LOAD_BALANCING_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getDropForLoadBalancing());
getDrop());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
@ -402,10 +371,8 @@ public final class Server extends
}
/**
* <pre>
* Contains server information. When none of the [drop_for_*] fields are true,
* use the other fields. When drop_for_rate_limiting is true, ignore all other
* fields. Use drop_for_load_balancing only when it is true and
* drop_for_rate_limiting is false.
* Contains server information. When the drop field is not true, use the other
* fields.
* </pre>
*
* Protobuf type {@code grpc.lb.v1.Server}
@ -449,9 +416,7 @@ public final class Server extends
loadBalanceToken_ = "";
dropForRateLimiting_ = false;
dropForLoadBalancing_ = false;
drop_ = false;
return this;
}
@ -478,8 +443,7 @@ public final class Server extends
result.ipAddress_ = ipAddress_;
result.port_ = port_;
result.loadBalanceToken_ = loadBalanceToken_;
result.dropForRateLimiting_ = dropForRateLimiting_;
result.dropForLoadBalancing_ = dropForLoadBalancing_;
result.drop_ = drop_;
onBuilt();
return result;
}
@ -531,11 +495,8 @@ public final class Server extends
loadBalanceToken_ = other.loadBalanceToken_;
onChanged();
}
if (other.getDropForRateLimiting() != false) {
setDropForRateLimiting(other.getDropForRateLimiting());
}
if (other.getDropForLoadBalancing() != false) {
setDropForLoadBalancing(other.getDropForLoadBalancing());
if (other.getDrop() != false) {
setDrop(other.getDrop());
}
onChanged();
return this;
@ -651,7 +612,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -673,7 +635,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -696,7 +659,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -716,7 +680,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -732,7 +697,8 @@ public final class Server extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -749,84 +715,46 @@ public final class Server extends
return this;
}
private boolean dropForRateLimiting_ ;
private boolean drop_ ;
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for rate limiting.
* Indicates whether this particular request should be dropped by the client.
* If the request is dropped, there will be a corresponding entry in
* ClientStats.calls_finished_with_drop.
* </pre>
*
* <code>bool drop_for_rate_limiting = 4;</code>
* <code>bool drop = 4;</code>
*/
public boolean getDropForRateLimiting() {
return dropForRateLimiting_;
public boolean getDrop() {
return drop_;
}
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for rate limiting.
* Indicates whether this particular request should be dropped by the client.
* If the request is dropped, there will be a corresponding entry in
* ClientStats.calls_finished_with_drop.
* </pre>
*
* <code>bool drop_for_rate_limiting = 4;</code>
* <code>bool drop = 4;</code>
*/
public Builder setDropForRateLimiting(boolean value) {
public Builder setDrop(boolean value) {
dropForRateLimiting_ = value;
drop_ = value;
onChanged();
return this;
}
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for rate limiting.
* Indicates whether this particular request should be dropped by the client.
* If the request is dropped, there will be a corresponding entry in
* ClientStats.calls_finished_with_drop.
* </pre>
*
* <code>bool drop_for_rate_limiting = 4;</code>
* <code>bool drop = 4;</code>
*/
public Builder clearDropForRateLimiting() {
public Builder clearDrop() {
dropForRateLimiting_ = false;
onChanged();
return this;
}
private boolean dropForLoadBalancing_ ;
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for load balancing.
* </pre>
*
* <code>bool drop_for_load_balancing = 5;</code>
*/
public boolean getDropForLoadBalancing() {
return dropForLoadBalancing_;
}
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for load balancing.
* </pre>
*
* <code>bool drop_for_load_balancing = 5;</code>
*/
public Builder setDropForLoadBalancing(boolean value) {
dropForLoadBalancing_ = value;
onChanged();
return this;
}
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for load balancing.
* </pre>
*
* <code>bool drop_for_load_balancing = 5;</code>
*/
public Builder clearDropForLoadBalancing() {
dropForLoadBalancing_ = false;
drop_ = false;
onChanged();
return this;
}

View File

@ -31,7 +31,8 @@ public interface ServerOrBuilder extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -42,7 +43,8 @@ public interface ServerOrBuilder extends
* An opaque but printable token given to the frontend for each pick. All
* frontend requests for that pick must include the token in its initial
* metadata. The token is used by the backend to verify the request and to
* allow the backend to report load to the gRPC LB system.
* allow the backend to report load to the gRPC LB system. The token is also
* used in client stats for reporting dropped calls.
* </pre>
*
* <code>string load_balance_token = 3;</code>
@ -52,21 +54,12 @@ public interface ServerOrBuilder extends
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for rate limiting.
* Indicates whether this particular request should be dropped by the client.
* If the request is dropped, there will be a corresponding entry in
* ClientStats.calls_finished_with_drop.
* </pre>
*
* <code>bool drop_for_rate_limiting = 4;</code>
* <code>bool drop = 4;</code>
*/
boolean getDropForRateLimiting();
/**
* <pre>
* Indicates whether this particular request should be dropped by the client
* for load balancing.
* </pre>
*
* <code>bool drop_for_load_balancing = 5;</code>
*/
boolean getDropForLoadBalancing();
boolean getDrop();
}

View File

@ -23,8 +23,11 @@ import io.grpc.CallOptions;
import io.grpc.ClientStreamTracer;
import io.grpc.Metadata;
import io.grpc.Status;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
/**
@ -38,8 +41,10 @@ final class GrpclbClientLoadRecorder extends ClientStreamTracer.Factory {
private final AtomicLong callsFinished = new AtomicLong();
// Specific finish types
private final AtomicLong callsDroppedForRateLimiting = new AtomicLong();
private final AtomicLong callsDroppedForLoadBalancing = new AtomicLong();
// Access to it should be protected by lock. Contention is not an issue for these counts, because
// normally only a small portion of all RPCs are dropped.
@GuardedBy("this")
private HashMap<String, AtomicLong> callsDroppedPerToken = new HashMap<String, AtomicLong>();
private final AtomicLong callsFailedToSend = new AtomicLong();
private final AtomicLong callsFinishedKnownReceived = new AtomicLong();
@ -56,18 +61,18 @@ final class GrpclbClientLoadRecorder extends ClientStreamTracer.Factory {
/**
* Records that a request has been dropped as instructed by the remote balancer.
*/
void recordDroppedRequest(DropType type) {
void recordDroppedRequest(String token) {
callsStarted.incrementAndGet();
callsFinished.incrementAndGet();
switch (type) {
case RATE_LIMITING:
callsDroppedForRateLimiting.incrementAndGet();
break;
case LOAD_BALANCING:
callsDroppedForLoadBalancing.incrementAndGet();
break;
default:
throw new AssertionError("Unsupported DropType: " + type);
synchronized (this) {
AtomicLong count = callsDroppedPerToken.get(token);
if (count == null) {
count = new AtomicLong(1);
callsDroppedPerToken.put(token, count);
} else {
count.incrementAndGet();
}
}
}
@ -75,15 +80,26 @@ final class GrpclbClientLoadRecorder extends ClientStreamTracer.Factory {
* Generate the report with the data recorded this LB stream since the last report.
*/
ClientStats generateLoadReport() {
return ClientStats.newBuilder()
ClientStats.Builder statsBuilder =
ClientStats.newBuilder()
.setTimestamp(Timestamps.fromMillis(time.currentTimeMillis()))
.setNumCallsStarted(callsStarted.getAndSet(0))
.setNumCallsFinished(callsFinished.getAndSet(0))
.setNumCallsFinishedWithDropForRateLimiting(callsDroppedForRateLimiting.getAndSet(0))
.setNumCallsFinishedWithDropForLoadBalancing(callsDroppedForLoadBalancing.getAndSet(0))
.setNumCallsFinishedWithClientFailedToSend(callsFailedToSend.getAndSet(0))
.setNumCallsFinishedKnownReceived(callsFinishedKnownReceived.getAndSet(0))
.build();
.setNumCallsFinishedKnownReceived(callsFinishedKnownReceived.getAndSet(0));
HashMap<String, AtomicLong> savedCallsDroppedPerToken;
synchronized (this) {
savedCallsDroppedPerToken = callsDroppedPerToken;
callsDroppedPerToken = new HashMap<String, AtomicLong>();
}
for (Map.Entry<String, AtomicLong> dropCount : savedCallsDroppedPerToken.entrySet()) {
statsBuilder.addCallsFinishedWithDrop(
ClientStatsPerToken.newBuilder()
.setLoadBalanceToken(dropCount.getKey())
.setNumCalls(dropCount.getValue().get())
.build());
}
return statsBuilder.build();
}
private class StreamTracer extends ClientStreamTracer {

View File

@ -49,7 +49,6 @@ import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -72,19 +71,8 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
private static final Logger logger = Logger.getLogger(GrpclbLoadBalancer.class.getName());
@VisibleForTesting
static final Map<DropType, PickResult> DROP_PICK_RESULTS;
static {
EnumMap<DropType, PickResult> map = new EnumMap<DropType, PickResult>(DropType.class);
for (DropType dropType : DropType.values()) {
map.put(
dropType,
PickResult.withError(
Status.UNAVAILABLE.withDescription(
"Dropped as requested by balancer. Type: " + dropType)));
}
DROP_PICK_RESULTS = Collections.unmodifiableMap(map);
}
static final PickResult DROP_PICK_RESULT =
PickResult.withError(Status.UNAVAILABLE.withDescription("Dropped as requested by balancer"));
@VisibleForTesting
static final SubchannelPicker BUFFER_PICKER = new SubchannelPicker() {
@ -457,10 +445,9 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
// TODO(zhangkun83): honor expiration_interval
// Construct the new collections. Create new Subchannels when necessary.
for (Server server : serverList.getServersList()) {
if (server.getDropForRateLimiting()) {
newRoundRobinList.add(new RoundRobinEntry(DropType.RATE_LIMITING, loadRecorder));
} else if (server.getDropForLoadBalancing()) {
newRoundRobinList.add(new RoundRobinEntry(DropType.LOAD_BALANCING, loadRecorder));
String token = server.getLoadBalanceToken();
if (server.getDrop()) {
newRoundRobinList.add(RoundRobinEntry.newDropEntry(loadRecorder, token));
} else {
InetSocketAddress address;
try {
@ -471,7 +458,6 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
continue;
}
EquivalentAddressGroup eag = new EquivalentAddressGroup(address);
String token = server.getLoadBalanceToken();
Subchannel subchannel = newSubchannelMap.get(eag);
if (subchannel == null) {
subchannel = subchannels.get(eag);
@ -486,7 +472,7 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
}
newSubchannelMap.put(eag, subchannel);
}
newRoundRobinList.add(new RoundRobinEntry(subchannel, loadRecorder, token));
newRoundRobinList.add(RoundRobinEntry.newEntry(subchannel, loadRecorder, token));
}
}
// Close Subchannels whose addresses have been delisted
@ -665,35 +651,33 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
static final class RoundRobinEntry {
final PickResult result;
final GrpclbClientLoadRecorder loadRecorder;
@Nullable
private final String token;
@Nullable
private final DropType dropType;
final String token;
/**
* A non-drop result.
*/
RoundRobinEntry(Subchannel subchannel, GrpclbClientLoadRecorder loadRecorder, String token) {
private RoundRobinEntry(
PickResult result, GrpclbClientLoadRecorder loadRecorder, String token) {
this.result = checkNotNull(result);
this.loadRecorder = checkNotNull(loadRecorder, "loadRecorder");
this.result = PickResult.withSubchannel(subchannel, loadRecorder);
this.token = token;
this.dropType = null;
this.token = checkNotNull(token, "token");
}
/**
* A drop result.
* Create a non-drop result.
*/
RoundRobinEntry(DropType dropType, GrpclbClientLoadRecorder loadRecorder) {
this.loadRecorder = checkNotNull(loadRecorder, "loadRecorder");
// We re-use the status for each DropType to make it easy to test, because Status class
// intentionally doesn't implement equals().
this.result = DROP_PICK_RESULTS.get(dropType);
this.token = null;
this.dropType = dropType;
static RoundRobinEntry newEntry(
Subchannel subchannel, GrpclbClientLoadRecorder loadRecorder, String token) {
return new RoundRobinEntry(
PickResult.withSubchannel(subchannel, loadRecorder), loadRecorder, token);
}
/**
* Create a drop result.
*/
static RoundRobinEntry newDropEntry(GrpclbClientLoadRecorder loadRecorder, String token) {
return new RoundRobinEntry(DROP_PICK_RESULT, loadRecorder, token);
}
void updateHeaders(Metadata headers) {
if (token != null) {
if (!isDrop()) {
headers.discardAll(GrpclbConstants.TOKEN_METADATA_KEY);
headers.put(GrpclbConstants.TOKEN_METADATA_KEY, token);
}
@ -704,13 +688,12 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
return MoreObjects.toStringHelper(this)
.add("result", result)
.add("token", token)
.add("dropType", dropType)
.toString();
}
@Override
public int hashCode() {
return Objects.hashCode(result, token, dropType);
return Objects.hashCode(result, token);
}
@Override
@ -719,8 +702,11 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
return false;
}
RoundRobinEntry that = (RoundRobinEntry) other;
return Objects.equal(result, that.result) && Objects.equal(token, that.token)
&& Objects.equal(dropType, that.dropType);
return Objects.equal(result, that.result) && Objects.equal(token, that.token);
}
boolean isDrop() {
return result == DROP_PICK_RESULT;
}
}
@ -743,8 +729,8 @@ class GrpclbLoadBalancer extends LoadBalancer implements WithLogId {
index = 0;
}
result.updateHeaders(args.getHeaders());
if (result.dropType != null) {
result.loadRecorder.recordDroppedRequest(result.dropType);
if (result.isDrop()) {
result.loadRecorder.recordDroppedRequest(result.token);
}
return result.result;
}

View File

@ -34,6 +34,15 @@ message InitialLoadBalanceRequest {
string name = 1;
}
// Contains the number of calls finished for a particular load balance token.
message ClientStatsPerToken {
// See Server.load_balance_token.
string load_balance_token = 1;
// The total number of RPCs that finished associated with the token.
int64 num_calls = 2;
}
// Contains client level statistics that are useful to load balancing. Each
// count except the timestamp should be reset to zero after reporting the stats.
message ClientStats {
@ -46,20 +55,17 @@ message ClientStats {
// The total number of RPCs that finished.
int64 num_calls_finished = 3;
// The total number of RPCs that were dropped by the client because of rate
// limiting.
int64 num_calls_finished_with_drop_for_rate_limiting = 4;
// The total number of RPCs that were dropped by the client because of load
// balancing.
int64 num_calls_finished_with_drop_for_load_balancing = 5;
// The total number of RPCs that failed to reach a server except dropped RPCs.
int64 num_calls_finished_with_client_failed_to_send = 6;
// The total number of RPCs that finished and are known to have been received
// by a server.
int64 num_calls_finished_known_received = 7;
// The list of dropped calls.
repeated ClientStatsPerToken calls_finished_with_drop = 8;
reserved 4, 5;
}
message LoadBalanceResponse {
@ -101,10 +107,8 @@ message ServerList {
google.protobuf.Duration expiration_interval = 3;
}
// Contains server information. When none of the [drop_for_*] fields are true,
// use the other fields. When drop_for_rate_limiting is true, ignore all other
// fields. Use drop_for_load_balancing only when it is true and
// drop_for_rate_limiting is false.
// Contains server information. When the drop field is not true, use the other
// fields.
message Server {
// A resolved address for the server, serialized in network-byte-order. It may
// either be an IPv4 or IPv6 address.
@ -116,14 +120,14 @@ message Server {
// An opaque but printable token given to the frontend for each pick. All
// frontend requests for that pick must include the token in its initial
// metadata. The token is used by the backend to verify the request and to
// allow the backend to report load to the gRPC LB system.
// allow the backend to report load to the gRPC LB system. The token is also
// used in client stats for reporting dropped calls.
string load_balance_token = 3;
// Indicates whether this particular request should be dropped by the client
// for rate limiting.
bool drop_for_rate_limiting = 4;
// Indicates whether this particular request should be dropped by the client.
// If the request is dropped, there will be a corresponding entry in
// ClientStats.calls_finished_with_drop.
bool drop = 4;
// Indicates whether this particular request should be dropped by the client
// for load balancing.
bool drop_for_load_balancing = 5;
reserved 5;
}

View File

@ -27,7 +27,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.same;
@ -250,9 +249,9 @@ public class GrpclbLoadBalancerTest {
public void roundRobinPicker() {
GrpclbClientLoadRecorder loadRecorder = new GrpclbClientLoadRecorder(timeProvider);
Subchannel subchannel = mock(Subchannel.class);
RoundRobinEntry r1 = new RoundRobinEntry(DropType.RATE_LIMITING, loadRecorder);
RoundRobinEntry r2 = new RoundRobinEntry(subchannel, loadRecorder, "LBTOKEN0001");
RoundRobinEntry r3 = new RoundRobinEntry(subchannel, loadRecorder, "LBTOKEN0002");
RoundRobinEntry r1 = RoundRobinEntry.newDropEntry(loadRecorder, "LBTOKEN0001");
RoundRobinEntry r2 = RoundRobinEntry.newEntry(subchannel, loadRecorder, "LBTOKEN0001");
RoundRobinEntry r3 = RoundRobinEntry.newEntry(subchannel, loadRecorder, "LBTOKEN0002");
List<RoundRobinEntry> list = Arrays.asList(r1, r2, r3);
RoundRobinPicker picker = new RoundRobinPicker(list);
@ -332,9 +331,9 @@ public class GrpclbLoadBalancerTest {
List<ServerEntry> backends = Arrays.asList(
new ServerEntry("127.0.0.1", 2000, "token0001"),
new ServerEntry(DropType.RATE_LIMITING),
new ServerEntry("token0001"),
new ServerEntry("127.0.0.1", 2010, "token0002"),
new ServerEntry(DropType.LOAD_BALANCING));
new ServerEntry("token0003"));
lbResponseObserver.onNext(buildLbResponse(backends));
@ -350,10 +349,10 @@ public class GrpclbLoadBalancerTest {
.updateBalancingState(eq(READY), pickerCaptor.capture());
RoundRobinPicker picker = (RoundRobinPicker) pickerCaptor.getValue();
assertThat(picker.list).containsExactly(
new RoundRobinEntry(subchannel1, balancer.getLoadRecorder(), "token0001"),
new RoundRobinEntry(DropType.RATE_LIMITING, balancer.getLoadRecorder()),
new RoundRobinEntry(subchannel2, balancer.getLoadRecorder(), "token0002"),
new RoundRobinEntry(DropType.LOAD_BALANCING, balancer.getLoadRecorder())).inOrder();
RoundRobinEntry.newEntry(subchannel1, balancer.getLoadRecorder(), "token0001"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0001"),
RoundRobinEntry.newEntry(subchannel2, balancer.getLoadRecorder(), "token0002"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0003")).inOrder();
// Report, no data
assertNextReport(
@ -374,7 +373,7 @@ public class GrpclbLoadBalancerTest {
PickResult pick2 = picker.pickSubchannel(args);
assertNull(pick2.getSubchannel());
assertSame(GrpclbLoadBalancer.DROP_PICK_RESULTS.get(DropType.RATE_LIMITING), pick2);
assertSame(GrpclbLoadBalancer.DROP_PICK_RESULT, pick2);
// Report includes upstart of pick1 and the drop of pick2
assertNextReport(
@ -382,7 +381,11 @@ public class GrpclbLoadBalancerTest {
ClientStats.newBuilder()
.setNumCallsStarted(2)
.setNumCallsFinished(1) // pick2
.setNumCallsFinishedWithDropForRateLimiting(1) // pick2
.addCallsFinishedWithDrop(
ClientStatsPerToken.newBuilder()
.setLoadBalanceToken("token0001")
.setNumCalls(1) // pick2
.build())
.build());
PickResult pick3 = picker.pickSubchannel(args);
@ -403,7 +406,7 @@ public class GrpclbLoadBalancerTest {
PickResult pick4 = picker.pickSubchannel(args);
assertNull(pick4.getSubchannel());
assertSame(GrpclbLoadBalancer.DROP_PICK_RESULTS.get(DropType.LOAD_BALANCING), pick4);
assertSame(GrpclbLoadBalancer.DROP_PICK_RESULT, pick4);
// pick1 ended without sending anything
tracer1.streamClosed(Status.CANCELLED);
@ -415,8 +418,12 @@ public class GrpclbLoadBalancerTest {
.setNumCallsStarted(1) // pick4
.setNumCallsFinished(2)
.setNumCallsFinishedWithClientFailedToSend(1) // pick1
.setNumCallsFinishedWithDropForLoadBalancing(1) // pick4
.build());
.addCallsFinishedWithDrop(
ClientStatsPerToken.newBuilder()
.setLoadBalanceToken("token0003")
.setNumCalls(1) // pick4
.build())
.build());
PickResult pick5 = picker.pickSubchannel(args);
assertSame(subchannel1, pick1.getSubchannel());
@ -478,7 +485,7 @@ public class GrpclbLoadBalancerTest {
// that picker is associated with the previous stream.
PickResult pick6 = picker.pickSubchannel(args);
assertNull(pick6.getSubchannel());
assertSame(GrpclbLoadBalancer.DROP_PICK_RESULTS.get(DropType.RATE_LIMITING), pick6);
assertSame(GrpclbLoadBalancer.DROP_PICK_RESULT, pick6);
assertNextReport(
inOrder, lbRequestObserver, loadReportIntervalMillis,
ClientStats.newBuilder().build());
@ -930,14 +937,14 @@ public class GrpclbLoadBalancerTest {
RoundRobinPicker picker1 = (RoundRobinPicker) pickerCaptor.getValue();
assertThat(picker1.list).containsExactly(
new RoundRobinEntry(subchannel2, balancer.getLoadRecorder(), "token0002"));
RoundRobinEntry.newEntry(subchannel2, balancer.getLoadRecorder(), "token0002"));
deliverSubchannelState(subchannel1, ConnectivityStateInfo.forNonError(READY));
inOrder.verify(helper).updateBalancingState(eq(READY), pickerCaptor.capture());
RoundRobinPicker picker2 = (RoundRobinPicker) pickerCaptor.getValue();
assertThat(picker2.list).containsExactly(
new RoundRobinEntry(subchannel1, balancer.getLoadRecorder(), "token0001"),
new RoundRobinEntry(subchannel2, balancer.getLoadRecorder(), "token0002"))
RoundRobinEntry.newEntry(subchannel1, balancer.getLoadRecorder(), "token0001"),
RoundRobinEntry.newEntry(subchannel2, balancer.getLoadRecorder(), "token0002"))
.inOrder();
// Disconnected subchannels
@ -947,7 +954,7 @@ public class GrpclbLoadBalancerTest {
inOrder.verify(helper).updateBalancingState(eq(READY), pickerCaptor.capture());
RoundRobinPicker picker3 = (RoundRobinPicker) pickerCaptor.getValue();
assertThat(picker3.list).containsExactly(
new RoundRobinEntry(subchannel2, balancer.getLoadRecorder(), "token0002"));
RoundRobinEntry.newEntry(subchannel2, balancer.getLoadRecorder(), "token0002"));
deliverSubchannelState(subchannel1, ConnectivityStateInfo.forNonError(CONNECTING));
inOrder.verifyNoMoreInteractions();
@ -967,10 +974,10 @@ public class GrpclbLoadBalancerTest {
List<ServerEntry> backends2 =
Arrays.asList(
new ServerEntry("127.0.0.1", 2030, "token0003"), // New address
new ServerEntry(DropType.RATE_LIMITING),
new ServerEntry("token0003"),
new ServerEntry("127.0.0.1", 2010, "token0004"), // Existing address with token changed
new ServerEntry("127.0.0.1", 2030, "token0005"), // New address appearing second time
new ServerEntry(DropType.LOAD_BALANCING));
new ServerEntry("token0006"));
verify(subchannel1, never()).shutdown();
lbResponseObserver.onNext(buildLbResponse(backends2));
@ -988,8 +995,8 @@ public class GrpclbLoadBalancerTest {
inOrder.verify(helper).updateBalancingState(eq(READY), pickerCaptor.capture());
RoundRobinPicker picker7 = (RoundRobinPicker) pickerCaptor.getValue();
assertThat(picker7.list).containsExactly(
new RoundRobinEntry(DropType.RATE_LIMITING, balancer.getLoadRecorder()),
new RoundRobinEntry(DropType.LOAD_BALANCING, balancer.getLoadRecorder())).inOrder();
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0003"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0006")).inOrder();
// State updates on obsolete subchannel1 will have no effect
deliverSubchannelState(subchannel1, ConnectivityStateInfo.forNonError(READY));
@ -1003,20 +1010,20 @@ public class GrpclbLoadBalancerTest {
RoundRobinPicker picker8 = (RoundRobinPicker) pickerCaptor.getValue();
// subchannel2 is still IDLE, thus not in the active list
assertThat(picker8.list).containsExactly(
new RoundRobinEntry(subchannel3, balancer.getLoadRecorder(), "token0003"),
new RoundRobinEntry(DropType.RATE_LIMITING, balancer.getLoadRecorder()),
new RoundRobinEntry(subchannel3, balancer.getLoadRecorder(), "token0005"),
new RoundRobinEntry(DropType.LOAD_BALANCING, balancer.getLoadRecorder())).inOrder();
RoundRobinEntry.newEntry(subchannel3, balancer.getLoadRecorder(), "token0003"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0003"),
RoundRobinEntry.newEntry(subchannel3, balancer.getLoadRecorder(), "token0005"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0006")).inOrder();
// subchannel2 becomes READY and makes it into the list
deliverSubchannelState(subchannel2, ConnectivityStateInfo.forNonError(READY));
inOrder.verify(helper).updateBalancingState(eq(READY), pickerCaptor.capture());
RoundRobinPicker picker9 = (RoundRobinPicker) pickerCaptor.getValue();
assertThat(picker9.list).containsExactly(
new RoundRobinEntry(subchannel3, balancer.getLoadRecorder(), "token0003"),
new RoundRobinEntry(DropType.RATE_LIMITING, balancer.getLoadRecorder()),
new RoundRobinEntry(subchannel2, balancer.getLoadRecorder(), "token0004"),
new RoundRobinEntry(subchannel3, balancer.getLoadRecorder(), "token0005"),
new RoundRobinEntry(DropType.LOAD_BALANCING, balancer.getLoadRecorder())).inOrder();
RoundRobinEntry.newEntry(subchannel3, balancer.getLoadRecorder(), "token0003"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0003"),
RoundRobinEntry.newEntry(subchannel2, balancer.getLoadRecorder(), "token0004"),
RoundRobinEntry.newEntry(subchannel3, balancer.getLoadRecorder(), "token0005"),
RoundRobinEntry.newDropEntry(balancer.getLoadRecorder(), "token0006")).inOrder();
verify(subchannel3, never()).shutdown();
// Update backends, with no entry
@ -1134,23 +1141,17 @@ public class GrpclbLoadBalancerTest {
private static LoadBalanceResponse buildLbResponse(List<ServerEntry> servers) {
ServerList.Builder serverListBuilder = ServerList.newBuilder();
for (ServerEntry server : servers) {
if (server.dropType == null) {
if (server.addr != null) {
serverListBuilder.addServers(Server.newBuilder()
.setIpAddress(ByteString.copyFrom(server.addr.getAddress().getAddress()))
.setPort(server.addr.getPort())
.setLoadBalanceToken(server.token)
.build());
} else {
switch (server.dropType) {
case RATE_LIMITING:
serverListBuilder.addServers(Server.newBuilder().setDropForRateLimiting(true).build());
break;
case LOAD_BALANCING:
serverListBuilder.addServers(Server.newBuilder().setDropForLoadBalancing(true).build());
break;
default:
fail("Unhandled " + server.dropType);
}
serverListBuilder.addServers(Server.newBuilder()
.setDrop(true)
.setLoadBalanceToken(server.token)
.build());
}
}
return LoadBalanceResponse.newBuilder()
@ -1161,18 +1162,16 @@ public class GrpclbLoadBalancerTest {
private static class ServerEntry {
final InetSocketAddress addr;
final String token;
final DropType dropType;
ServerEntry(String host, int port, String token) {
this.addr = new InetSocketAddress(host, port);
this.token = token;
this.dropType = null;
}
ServerEntry(DropType dropType) {
this.dropType = dropType;
// Drop entry
ServerEntry(String token) {
this.addr = null;
this.token = null;
this.token = token;
}
}