Use long uid in artery remoting and cluster #20644

This commit is contained in:
Johan Andrén 2016-09-26 15:34:59 +02:00 committed by GitHub
parent e9c4393f7b
commit 8ae0c9a888
37 changed files with 932 additions and 151 deletions

View file

@ -12421,6 +12421,24 @@ public final class ReplicatorMessages {
* <code>required sfixed32 uid = 2;</code>
*/
int getUid();
// optional sfixed32 uid2 = 3;
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
boolean hasUid2();
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
int getUid2();
}
/**
* Protobuf type {@code akka.cluster.ddata.UniqueAddress}
@ -12491,6 +12509,11 @@ public final class ReplicatorMessages {
uid_ = input.readSFixed32();
break;
}
case 29: {
bitField0_ |= 0x00000004;
uid2_ = input.readSFixed32();
break;
}
}
}
} catch (akka.protobuf.InvalidProtocolBufferException e) {
@ -12569,9 +12592,34 @@ public final class ReplicatorMessages {
return uid_;
}
// optional sfixed32 uid2 = 3;
public static final int UID2_FIELD_NUMBER = 3;
private int uid2_;
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
public boolean hasUid2() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
public int getUid2() {
return uid2_;
}
private void initFields() {
address_ = akka.cluster.ddata.protobuf.msg.ReplicatorMessages.Address.getDefaultInstance();
uid_ = 0;
uid2_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@ -12603,6 +12651,9 @@ public final class ReplicatorMessages {
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeSFixed32(2, uid_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeSFixed32(3, uid2_);
}
getUnknownFields().writeTo(output);
}
@ -12620,6 +12671,10 @@ public final class ReplicatorMessages {
size += akka.protobuf.CodedOutputStream
.computeSFixed32Size(2, uid_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += akka.protobuf.CodedOutputStream
.computeSFixed32Size(3, uid2_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@ -12745,6 +12800,8 @@ public final class ReplicatorMessages {
bitField0_ = (bitField0_ & ~0x00000001);
uid_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
uid2_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
@ -12785,6 +12842,10 @@ public final class ReplicatorMessages {
to_bitField0_ |= 0x00000002;
}
result.uid_ = uid_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.uid2_ = uid2_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@ -12807,6 +12868,9 @@ public final class ReplicatorMessages {
if (other.hasUid()) {
setUid(other.getUid());
}
if (other.hasUid2()) {
setUid2(other.getUid2());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@ -12996,6 +13060,55 @@ public final class ReplicatorMessages {
return this;
}
// optional sfixed32 uid2 = 3;
private int uid2_ ;
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
public boolean hasUid2() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
public int getUid2() {
return uid2_;
}
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
public Builder setUid2(int value) {
bitField0_ |= 0x00000004;
uid2_ = value;
onChanged();
return this;
}
/**
* <code>optional sfixed32 uid2 = 3;</code>
*
* <pre>
* 64 bit uids but with backward wire compatibility
* </pre>
*/
public Builder clearUid2() {
bitField0_ = (bitField0_ & ~0x00000004);
uid2_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:akka.cluster.ddata.UniqueAddress)
}
@ -14806,14 +14919,14 @@ public final class ReplicatorMessages {
" \002(\010\0221\n\007entries\030\002 \003(\0132 .akka.cluster.dda" +
"ta.Gossip.Entry\032H\n\005Entry\022\013\n\003key\030\001 \002(\t\0222\n" +
"\010envelope\030\002 \002(\0132 .akka.cluster.ddata.Dat",
"aEnvelope\"J\n\rUniqueAddress\022,\n\007address\030\001 " +
"aEnvelope\"X\n\rUniqueAddress\022,\n\007address\030\001 " +
"\002(\0132\033.akka.cluster.ddata.Address\022\013\n\003uid\030" +
"\002 \002(\017\")\n\007Address\022\020\n\010hostname\030\001 \002(\t\022\014\n\004po" +
"rt\030\002 \002(\r\"V\n\014OtherMessage\022\027\n\017enclosedMess" +
"age\030\001 \002(\014\022\024\n\014serializerId\030\002 \002(\005\022\027\n\017messa" +
"geManifest\030\004 \001(\014\"\036\n\nStringGSet\022\020\n\010elemen" +
"ts\030\001 \003(\tB#\n\037akka.cluster.ddata.protobuf." +
"msgH\001"
"\002 \002(\017\022\014\n\004uid2\030\003 \001(\017\")\n\007Address\022\020\n\010hostna" +
"me\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\"V\n\014OtherMessage\022\027" +
"\n\017enclosedMessage\030\001 \002(\014\022\024\n\014serializerId\030" +
"\002 \002(\005\022\027\n\017messageManifest\030\004 \001(\014\"\036\n\nString" +
"GSet\022\020\n\010elements\030\001 \003(\tB#\n\037akka.cluster.d" +
"data.protobuf.msgH\001"
};
akka.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new akka.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -14927,7 +15040,7 @@ public final class ReplicatorMessages {
internal_static_akka_cluster_ddata_UniqueAddress_fieldAccessorTable = new
akka.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_akka_cluster_ddata_UniqueAddress_descriptor,
new java.lang.String[] { "Address", "Uid", });
new java.lang.String[] { "Address", "Uid", "Uid2", });
internal_static_akka_cluster_ddata_Address_descriptor =
getDescriptor().getMessageTypes().get(15);
internal_static_akka_cluster_ddata_Address_fieldAccessorTable = new

View file

@ -98,6 +98,8 @@ message Gossip {
message UniqueAddress {
required Address address = 1;
required sfixed32 uid = 2;
// 64 bit uids but with backward wire compatibility
optional sfixed32 uid2 = 3;
}
message Address {

View file

@ -88,10 +88,21 @@ trait SerializationSupport {
Address(addressProtocol, system.name, address.getHostname, address.getPort)
def uniqueAddressToProto(uniqueAddress: UniqueAddress): dm.UniqueAddress.Builder =
dm.UniqueAddress.newBuilder().setAddress(addressToProto(uniqueAddress.address)).setUid(uniqueAddress.uid)
dm.UniqueAddress.newBuilder().setAddress(addressToProto(uniqueAddress.address))
.setUid(uniqueAddress.longUid.toInt)
.setUid2((uniqueAddress.longUid >> 32).toInt)
def uniqueAddressFromProto(uniqueAddress: dm.UniqueAddress): UniqueAddress =
UniqueAddress(addressFromProto(uniqueAddress.getAddress), uniqueAddress.getUid)
UniqueAddress(
addressFromProto(uniqueAddress.getAddress),
if (uniqueAddress.hasUid2) {
// new remote node join the two parts of the long uid back
(uniqueAddress.getUid2.toLong << 32) | (uniqueAddress.getUid & 0xFFFFFFFFL)
} else {
// old remote node
uniqueAddress.getUid.toLong
}
)
def resolveActorRef(path: String): ActorRef =
system.provider.resolveActorRef(path)