grpclb: remove expiration_interval. (#3398)

This commit is contained in:
Kun Zhang 2017-08-25 10:49:46 -07:00 committed by GitHub
parent cfc9433ee3
commit 485431880f
5 changed files with 11 additions and 318 deletions

View File

@ -87,15 +87,14 @@ public final class LoadBalancerProto {
"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"
".Duration\"7\n\nServerList\022#\n\007servers\030\001 \003(\013" +
"2\022.grpc.lb.v1.ServerJ\004\010\003\020\004\"Z\n\006Server\022\022\n\n" +
"ip_address\030\001 \001(\014\022\014\n\004port\030\002 \001(\005\022\032\n\022load_b" +
"alance_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.lb.v1.LoadB",
"alanceResponse(\0010\001B%\n\016io.grpc.grpclbB\021Lo" +
"adBalancerProtoP\001b\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@ -152,7 +151,7 @@ public final class LoadBalancerProto {
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", });
new java.lang.String[] { "Servers", });
internal_static_grpc_lb_v1_Server_descriptor =
getDescriptor().getMessageTypes().get(7);
internal_static_grpc_lb_v1_Server_fieldAccessorTable = new

View File

@ -52,19 +52,6 @@ public final class ServerList extends
input.readMessage(io.grpc.grpclb.Server.parser(), extensionRegistry));
break;
}
case 26: {
com.google.protobuf.Duration.Builder subBuilder = null;
if (expirationInterval_ != null) {
subBuilder = expirationInterval_.toBuilder();
}
expirationInterval_ = input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(expirationInterval_);
expirationInterval_ = subBuilder.buildPartial();
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -91,7 +78,6 @@ public final class ServerList extends
io.grpc.grpclb.ServerList.class, io.grpc.grpclb.ServerList.Builder.class);
}
private int bitField0_;
public static final int SERVERS_FIELD_NUMBER = 1;
private java.util.List<io.grpc.grpclb.Server> servers_;
/**
@ -162,48 +148,6 @@ public final class ServerList extends
return servers_.get(index);
}
public static final int EXPIRATION_INTERVAL_FIELD_NUMBER = 3;
private com.google.protobuf.Duration expirationInterval_;
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public boolean hasExpirationInterval() {
return expirationInterval_ != null;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public com.google.protobuf.Duration getExpirationInterval() {
return expirationInterval_ == null ? com.google.protobuf.Duration.getDefaultInstance() : expirationInterval_;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public com.google.protobuf.DurationOrBuilder getExpirationIntervalOrBuilder() {
return getExpirationInterval();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
@ -219,9 +163,6 @@ public final class ServerList extends
for (int i = 0; i < servers_.size(); i++) {
output.writeMessage(1, servers_.get(i));
}
if (expirationInterval_ != null) {
output.writeMessage(3, getExpirationInterval());
}
}
public int getSerializedSize() {
@ -233,10 +174,6 @@ public final class ServerList extends
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, servers_.get(i));
}
if (expirationInterval_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getExpirationInterval());
}
memoizedSize = size;
return size;
}
@ -255,11 +192,6 @@ public final class ServerList extends
boolean result = true;
result = result && getServersList()
.equals(other.getServersList());
result = result && (hasExpirationInterval() == other.hasExpirationInterval());
if (hasExpirationInterval()) {
result = result && getExpirationInterval()
.equals(other.getExpirationInterval());
}
return result;
}
@ -274,10 +206,6 @@ public final class ServerList extends
hash = (37 * hash) + SERVERS_FIELD_NUMBER;
hash = (53 * hash) + getServersList().hashCode();
}
if (hasExpirationInterval()) {
hash = (37 * hash) + EXPIRATION_INTERVAL_FIELD_NUMBER;
hash = (53 * hash) + getExpirationInterval().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
@ -414,12 +342,6 @@ public final class ServerList extends
} else {
serversBuilder_.clear();
}
if (expirationIntervalBuilder_ == null) {
expirationInterval_ = null;
} else {
expirationInterval_ = null;
expirationIntervalBuilder_ = null;
}
return this;
}
@ -443,7 +365,6 @@ public final class ServerList extends
public io.grpc.grpclb.ServerList buildPartial() {
io.grpc.grpclb.ServerList result = new io.grpc.grpclb.ServerList(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (serversBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
servers_ = java.util.Collections.unmodifiableList(servers_);
@ -453,12 +374,6 @@ public final class ServerList extends
} else {
result.servers_ = serversBuilder_.build();
}
if (expirationIntervalBuilder_ == null) {
result.expirationInterval_ = expirationInterval_;
} else {
result.expirationInterval_ = expirationIntervalBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@ -526,9 +441,6 @@ public final class ServerList extends
}
}
}
if (other.hasExpirationInterval()) {
mergeExpirationInterval(other.getExpirationInterval());
}
onChanged();
return this;
}
@ -921,186 +833,6 @@ public final class ServerList extends
}
return serversBuilder_;
}
private com.google.protobuf.Duration expirationInterval_ = null;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> expirationIntervalBuilder_;
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public boolean hasExpirationInterval() {
return expirationIntervalBuilder_ != null || expirationInterval_ != null;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public com.google.protobuf.Duration getExpirationInterval() {
if (expirationIntervalBuilder_ == null) {
return expirationInterval_ == null ? com.google.protobuf.Duration.getDefaultInstance() : expirationInterval_;
} else {
return expirationIntervalBuilder_.getMessage();
}
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public Builder setExpirationInterval(com.google.protobuf.Duration value) {
if (expirationIntervalBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
expirationInterval_ = value;
onChanged();
} else {
expirationIntervalBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public Builder setExpirationInterval(
com.google.protobuf.Duration.Builder builderForValue) {
if (expirationIntervalBuilder_ == null) {
expirationInterval_ = builderForValue.build();
onChanged();
} else {
expirationIntervalBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public Builder mergeExpirationInterval(com.google.protobuf.Duration value) {
if (expirationIntervalBuilder_ == null) {
if (expirationInterval_ != null) {
expirationInterval_ =
com.google.protobuf.Duration.newBuilder(expirationInterval_).mergeFrom(value).buildPartial();
} else {
expirationInterval_ = value;
}
onChanged();
} else {
expirationIntervalBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public Builder clearExpirationInterval() {
if (expirationIntervalBuilder_ == null) {
expirationInterval_ = null;
onChanged();
} else {
expirationInterval_ = null;
expirationIntervalBuilder_ = null;
}
return this;
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public com.google.protobuf.Duration.Builder getExpirationIntervalBuilder() {
onChanged();
return getExpirationIntervalFieldBuilder().getBuilder();
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
public com.google.protobuf.DurationOrBuilder getExpirationIntervalOrBuilder() {
if (expirationIntervalBuilder_ != null) {
return expirationIntervalBuilder_.getMessageOrBuilder();
} else {
return expirationInterval_ == null ?
com.google.protobuf.Duration.getDefaultInstance() : expirationInterval_;
}
}
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>
getExpirationIntervalFieldBuilder() {
if (expirationIntervalBuilder_ == null) {
expirationIntervalBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>(
getExpirationInterval(),
getParentForChildren(),
isClean());
expirationInterval_ = null;
}
return expirationIntervalBuilder_;
}
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return this;

View File

@ -65,38 +65,4 @@ public interface ServerListOrBuilder extends
*/
io.grpc.grpclb.ServerOrBuilder getServersOrBuilder(
int index);
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
boolean hasExpirationInterval();
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
com.google.protobuf.Duration getExpirationInterval();
/**
* <pre>
* Indicates the amount of time that the client should consider this server
* list as valid. It may be considered stale after waiting this interval of
* time after receiving the list. If the interval is not positive, the
* client can assume the list is valid until the next list is received.
* </pre>
*
* <code>.google.protobuf.Duration expiration_interval = 3;</code>
*/
com.google.protobuf.DurationOrBuilder getExpirationIntervalOrBuilder();
}

View File

@ -336,7 +336,6 @@ final class GrpclbState {
new HashMap<EquivalentAddressGroup, Subchannel>();
List<DropEntry> newDropList = new ArrayList<DropEntry>();
List<BackendEntry> newBackendList = new ArrayList<BackendEntry>();
// TODO(zhangkun83): honor expiration_interval
// Construct the new collections. Create new Subchannels when necessary.
for (Server server : serverList.getServersList()) {
String token = server.getLoadBalanceToken();

View File

@ -100,11 +100,8 @@ message ServerList {
// unless instructed otherwise via the client_config.
repeated Server servers = 1;
// Indicates the amount of time that the client should consider this server
// list as valid. It may be considered stale after waiting this interval of
// time after receiving the list. If the interval is not positive, the
// client can assume the list is valid until the next list is received.
google.protobuf.Duration expiration_interval = 3;
// Was google.protobuf.Duration expiration_interval.
reserved 3;
}
// Contains server information. When the drop field is not true, use the other