Skip to content

Commit

Permalink
add version verification (#370)
Browse files Browse the repository at this point in the history
* update thrift code

* add version verification

* add meta client version check

* fix typo

* optimize sslSocketFactory creation in SyncConnection
  • Loading branch information
Klay authored Oct 19, 2021
1 parent fc643c7 commit 8f1c233
Show file tree
Hide file tree
Showing 55 changed files with 7,321 additions and 2,004 deletions.
23 changes: 23 additions & 0 deletions client/src/main/generated/com/vesoft/nebula/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.vesoft.nebula;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
@SuppressWarnings({ "unused" })
public class Constants {

public static final byte[] version = "2.6.0".getBytes();

}
349 changes: 349 additions & 0 deletions client/src/main/generated/com/vesoft/nebula/Coordinate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.vesoft.nebula;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import com.facebook.thrift.*;
import com.facebook.thrift.annotations.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;

@SuppressWarnings({ "unused", "serial" })
public class Coordinate implements TBase, java.io.Serializable, Cloneable, Comparable<Coordinate> {
private static final TStruct STRUCT_DESC = new TStruct("Coordinate");
private static final TField X_FIELD_DESC = new TField("x", TType.DOUBLE, (short)1);
private static final TField Y_FIELD_DESC = new TField("y", TType.DOUBLE, (short)2);

public double x;
public double y;
public static final int X = 1;
public static final int Y = 2;

// isset id assignments
private static final int __X_ISSET_ID = 0;
private static final int __Y_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);

public static final Map<Integer, FieldMetaData> metaDataMap;

static {
Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
tmpMetaDataMap.put(X, new FieldMetaData("x", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.DOUBLE)));
tmpMetaDataMap.put(Y, new FieldMetaData("y", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.DOUBLE)));
metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
}

static {
FieldMetaData.addStructMetaDataMap(Coordinate.class, metaDataMap);
}

public Coordinate() {
}

public Coordinate(
double x,
double y) {
this();
this.x = x;
setXIsSet(true);
this.y = y;
setYIsSet(true);
}

public static class Builder {
private double x;
private double y;

BitSet __optional_isset = new BitSet(2);

public Builder() {
}

public Builder setX(final double x) {
this.x = x;
__optional_isset.set(__X_ISSET_ID, true);
return this;
}

public Builder setY(final double y) {
this.y = y;
__optional_isset.set(__Y_ISSET_ID, true);
return this;
}

public Coordinate build() {
Coordinate result = new Coordinate();
if (__optional_isset.get(__X_ISSET_ID)) {
result.setX(this.x);
}
if (__optional_isset.get(__Y_ISSET_ID)) {
result.setY(this.y);
}
return result;
}
}

public static Builder builder() {
return new Builder();
}

/**
* Performs a deep copy on <i>other</i>.
*/
public Coordinate(Coordinate other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.x = TBaseHelper.deepCopy(other.x);
this.y = TBaseHelper.deepCopy(other.y);
}

public Coordinate deepCopy() {
return new Coordinate(this);
}

public double getX() {
return this.x;
}

public Coordinate setX(double x) {
this.x = x;
setXIsSet(true);
return this;
}

public void unsetX() {
__isset_bit_vector.clear(__X_ISSET_ID);
}

// Returns true if field x is set (has been assigned a value) and false otherwise
public boolean isSetX() {
return __isset_bit_vector.get(__X_ISSET_ID);
}

public void setXIsSet(boolean __value) {
__isset_bit_vector.set(__X_ISSET_ID, __value);
}

public double getY() {
return this.y;
}

public Coordinate setY(double y) {
this.y = y;
setYIsSet(true);
return this;
}

public void unsetY() {
__isset_bit_vector.clear(__Y_ISSET_ID);
}

// Returns true if field y is set (has been assigned a value) and false otherwise
public boolean isSetY() {
return __isset_bit_vector.get(__Y_ISSET_ID);
}

public void setYIsSet(boolean __value) {
__isset_bit_vector.set(__Y_ISSET_ID, __value);
}

public void setFieldValue(int fieldID, Object __value) {
switch (fieldID) {
case X:
if (__value == null) {
unsetX();
} else {
setX((Double)__value);
}
break;

case Y:
if (__value == null) {
unsetY();
} else {
setY((Double)__value);
}
break;

default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
}

public Object getFieldValue(int fieldID) {
switch (fieldID) {
case X:
return new Double(getX());

case Y:
return new Double(getY());

default:
throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
}
}

@Override
public boolean equals(Object _that) {
if (_that == null)
return false;
if (this == _that)
return true;
if (!(_that instanceof Coordinate))
return false;
Coordinate that = (Coordinate)_that;

if (!TBaseHelper.equalsNobinary(this.x, that.x)) { return false; }

if (!TBaseHelper.equalsNobinary(this.y, that.y)) { return false; }

return true;
}

@Override
public int hashCode() {
return Arrays.deepHashCode(new Object[] {x, y});
}

@Override
public int compareTo(Coordinate other) {
if (other == null) {
// See java.lang.Comparable docs
throw new NullPointerException();
}

if (other == this) {
return 0;
}
int lastComparison = 0;

lastComparison = Boolean.valueOf(isSetX()).compareTo(other.isSetX());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(x, other.x);
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = Boolean.valueOf(isSetY()).compareTo(other.isSetY());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(y, other.y);
if (lastComparison != 0) {
return lastComparison;
}
return 0;
}

public void read(TProtocol iprot) throws TException {
TField __field;
iprot.readStructBegin(metaDataMap);
while (true)
{
__field = iprot.readFieldBegin();
if (__field.type == TType.STOP) {
break;
}
switch (__field.id)
{
case X:
if (__field.type == TType.DOUBLE) {
this.x = iprot.readDouble();
setXIsSet(true);
} else {
TProtocolUtil.skip(iprot, __field.type);
}
break;
case Y:
if (__field.type == TType.DOUBLE) {
this.y = iprot.readDouble();
setYIsSet(true);
} else {
TProtocolUtil.skip(iprot, __field.type);
}
break;
default:
TProtocolUtil.skip(iprot, __field.type);
break;
}
iprot.readFieldEnd();
}
iprot.readStructEnd();


// check for required fields of primitive type, which can't be checked in the validate method
validate();
}

public void write(TProtocol oprot) throws TException {
validate();

oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(X_FIELD_DESC);
oprot.writeDouble(this.x);
oprot.writeFieldEnd();
oprot.writeFieldBegin(Y_FIELD_DESC);
oprot.writeDouble(this.y);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}

@Override
public String toString() {
return toString(1, true);
}

@Override
public String toString(int indent, boolean prettyPrint) {
String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
String newLine = prettyPrint ? "\n" : "";
String space = prettyPrint ? " " : "";
StringBuilder sb = new StringBuilder("Coordinate");
sb.append(space);
sb.append("(");
sb.append(newLine);
boolean first = true;

sb.append(indentStr);
sb.append("x");
sb.append(space);
sb.append(":").append(space);
sb.append(TBaseHelper.toString(this.getX(), indent + 1, prettyPrint));
first = false;
if (!first) sb.append("," + newLine);
sb.append(indentStr);
sb.append("y");
sb.append(space);
sb.append(":").append(space);
sb.append(TBaseHelper.toString(this.getY(), indent + 1, prettyPrint));
first = false;
sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
sb.append(")");
return sb.toString();
}

public void validate() throws TException {
// check for required fields
}

}

Loading

0 comments on commit 8f1c233

Please sign in to comment.