From 15e284583c79ac6ab3c7737c096fba70cf4dcbbe Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Tue, 23 Mar 2021 10:22:09 +0800 Subject: [PATCH] Update ga thrift files and modify the version (#278) * update ga thrift files and modiry version * Add interface description * modify version --- README.md | 1 + .../com/vesoft/nebula/graph/ErrorCode.java | 1 + .../vesoft/nebula/graph/PlanDescription.java | 95 ++++++++++++++++++- .../com/vesoft/nebula/meta/AdminCmd.java | 2 + .../com/vesoft/nebula/storage/ErrorCode.java | 1 + .../vesoft/nebula/client/graph/data/Node.java | 16 ++++ .../nebula/client/storage/StorageClient.java | 11 +++ .../nebula/examples/StorageClientExample.java | 1 + 8 files changed, 127 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3166682c1..c8678b1ca 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ There are the version correspondence between client and Nebula: | 1.1.0 | 1.1.0,1.2.0 | | 2.0.0-beta | 2.0.0-beta | | 2.0.0-rc1 | 2.0.0-rc1 | +| 2.0.0-ga | 2.0.0-ga | | 2.0.0-SNAPSHOT| 2.0.0-nightly | ## Graph client example diff --git a/client/src/main/generated/com/vesoft/nebula/graph/ErrorCode.java b/client/src/main/generated/com/vesoft/nebula/graph/ErrorCode.java index ac9fcc3ff..75dbaa366 100644 --- a/client/src/main/generated/com/vesoft/nebula/graph/ErrorCode.java +++ b/client/src/main/generated/com/vesoft/nebula/graph/ErrorCode.java @@ -31,6 +31,7 @@ public class ErrorCode { public static final int E_BAD_PERMISSION = -11; public static final int E_SEMANTIC_ERROR = -12; public static final int E_TOO_MANY_CONNECTIONS = -13; + public static final int E_PARTIAL_SUCCEEDED = -14; public static final IntRangeSet VALID_VALUES; public static final Map VALUES_TO_NAMES = new HashMap(); diff --git a/client/src/main/generated/com/vesoft/nebula/graph/PlanDescription.java b/client/src/main/generated/com/vesoft/nebula/graph/PlanDescription.java index e7e14e668..89121fe89 100644 --- a/client/src/main/generated/com/vesoft/nebula/graph/PlanDescription.java +++ b/client/src/main/generated/com/vesoft/nebula/graph/PlanDescription.java @@ -32,16 +32,21 @@ public class PlanDescription implements TBase, java.io.Serializable, Cloneable, private static final TField PLAN_NODE_DESCS_FIELD_DESC = new TField("plan_node_descs", TType.LIST, (short)1); private static final TField NODE_INDEX_MAP_FIELD_DESC = new TField("node_index_map", TType.MAP, (short)2); private static final TField FORMAT_FIELD_DESC = new TField("format", TType.STRING, (short)3); + private static final TField OPTIMIZE_TIME_IN_US_FIELD_DESC = new TField("optimize_time_in_us", TType.I32, (short)4); public List plan_node_descs; public Map node_index_map; public byte[] format; + public int optimize_time_in_us; public static final int PLAN_NODE_DESCS = 1; public static final int NODE_INDEX_MAP = 2; public static final int FORMAT = 3; + public static final int OPTIMIZE_TIME_IN_US = 4; public static boolean DEFAULT_PRETTY_PRINT = true; // isset id assignments + private static final int __OPTIMIZE_TIME_IN_US_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); public static final Map metaDataMap; static { @@ -55,6 +60,8 @@ public class PlanDescription implements TBase, java.io.Serializable, Cloneable, new FieldValueMetaData(TType.I64)))); tmpMetaDataMap.put(FORMAT, new FieldMetaData("format", TFieldRequirementType.REQUIRED, new FieldValueMetaData(TType.STRING))); + tmpMetaDataMap.put(OPTIMIZE_TIME_IN_US, new FieldMetaData("optimize_time_in_us", TFieldRequirementType.REQUIRED, + new FieldValueMetaData(TType.I32))); metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap); } @@ -68,18 +75,23 @@ public PlanDescription() { public PlanDescription( List plan_node_descs, Map node_index_map, - byte[] format) + byte[] format, + int optimize_time_in_us) { this(); this.plan_node_descs = plan_node_descs; this.node_index_map = node_index_map; this.format = format; + this.optimize_time_in_us = optimize_time_in_us; + setOptimize_time_in_usIsSet(true); } /** * Performs a deep copy on other. */ public PlanDescription(PlanDescription other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); if (other.isSetPlan_node_descs()) { this.plan_node_descs = TBaseHelper.deepCopy(other.plan_node_descs); } @@ -89,6 +101,7 @@ public PlanDescription(PlanDescription other) { if (other.isSetFormat()) { this.format = TBaseHelper.deepCopy(other.format); } + this.optimize_time_in_us = TBaseHelper.deepCopy(other.optimize_time_in_us); } public PlanDescription deepCopy() { @@ -172,6 +185,29 @@ public void setFormatIsSet(boolean value) { } } + public int getOptimize_time_in_us() { + return this.optimize_time_in_us; + } + + public PlanDescription setOptimize_time_in_us(int optimize_time_in_us) { + this.optimize_time_in_us = optimize_time_in_us; + setOptimize_time_in_usIsSet(true); + return this; + } + + public void unsetOptimize_time_in_us() { + __isset_bit_vector.clear(__OPTIMIZE_TIME_IN_US_ISSET_ID); + } + + // Returns true if field optimize_time_in_us is set (has been assigned a value) and false otherwise + public boolean isSetOptimize_time_in_us() { + return __isset_bit_vector.get(__OPTIMIZE_TIME_IN_US_ISSET_ID); + } + + public void setOptimize_time_in_usIsSet(boolean value) { + __isset_bit_vector.set(__OPTIMIZE_TIME_IN_US_ISSET_ID, value); + } + @SuppressWarnings("unchecked") public void setFieldValue(int fieldID, Object value) { switch (fieldID) { @@ -199,6 +235,14 @@ public void setFieldValue(int fieldID, Object value) { } break; + case OPTIMIZE_TIME_IN_US: + if (value == null) { + unsetOptimize_time_in_us(); + } else { + setOptimize_time_in_us((Integer)value); + } + break; + default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } @@ -215,6 +259,9 @@ public Object getFieldValue(int fieldID) { case FORMAT: return getFormat(); + case OPTIMIZE_TIME_IN_US: + return new Integer(getOptimize_time_in_us()); + default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } @@ -229,6 +276,8 @@ public boolean isSet(int fieldID) { return isSetNode_index_map(); case FORMAT: return isSetFormat(); + case OPTIMIZE_TIME_IN_US: + return isSetOptimize_time_in_us(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } @@ -276,6 +325,15 @@ public boolean equals(PlanDescription that) { return false; } + boolean this_present_optimize_time_in_us = true; + boolean that_present_optimize_time_in_us = true; + if (this_present_optimize_time_in_us || that_present_optimize_time_in_us) { + if (!(this_present_optimize_time_in_us && that_present_optimize_time_in_us)) + return false; + if (!TBaseHelper.equalsNobinary(this.optimize_time_in_us, that.optimize_time_in_us)) + return false; + } + return true; } @@ -298,6 +356,11 @@ public int hashCode() { if (present_format) builder.append(format); + boolean present_optimize_time_in_us = true; + builder.append(present_optimize_time_in_us); + if (present_optimize_time_in_us) + builder.append(optimize_time_in_us); + return builder.toHashCode(); } @@ -337,6 +400,14 @@ public int compareTo(PlanDescription other) { if (lastComparison != 0) { return lastComparison; } + lastComparison = Boolean.valueOf(isSetOptimize_time_in_us()).compareTo(other.isSetOptimize_time_in_us()); + if (lastComparison != 0) { + return lastComparison; + } + lastComparison = TBaseHelper.compareTo(optimize_time_in_us, other.optimize_time_in_us); + if (lastComparison != 0) { + return lastComparison; + } return 0; } @@ -399,6 +470,14 @@ public void read(TProtocol iprot) throws TException { TProtocolUtil.skip(iprot, field.type); } break; + case OPTIMIZE_TIME_IN_US: + if (field.type == TType.I32) { + this.optimize_time_in_us = iprot.readI32(); + setOptimize_time_in_usIsSet(true); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; default: TProtocolUtil.skip(iprot, field.type); break; @@ -409,6 +488,9 @@ public void read(TProtocol iprot) throws TException { // check for required fields of primitive type, which can't be checked in the validate method + if (!isSetOptimize_time_in_us()) { + throw new TProtocolException("Required field 'optimize_time_in_us' was not found in serialized data! Struct: " + toString()); + } validate(); } @@ -444,6 +526,9 @@ public void write(TProtocol oprot) throws TException { oprot.writeBinary(this.format); oprot.writeFieldEnd(); } + oprot.writeFieldBegin(OPTIMIZE_TIME_IN_US_FIELD_DESC); + oprot.writeI32(this.optimize_time_in_us); + oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -506,6 +591,13 @@ public String toString(int indent, boolean prettyPrint) { if (this. getFormat().length > 128) sb.append(" ..."); } first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("optimize_time_in_us"); + sb.append(space); + sb.append(":").append(space); + sb.append(TBaseHelper.toString(this. getOptimize_time_in_us(), indent + 1, prettyPrint)); + first = false; sb.append(newLine + TBaseHelper.reduceIndent(indentStr)); sb.append(")"); return sb.toString(); @@ -522,6 +614,7 @@ public void validate() throws TException { if (format == null) { throw new TProtocolException(TProtocolException.MISSING_REQUIRED_FIELD, "Required field 'format' was not present! Struct: " + toString()); } + // alas, we cannot check 'optimize_time_in_us' because it's a primitive and you chose the non-beans generator. // check that fields of type enum have valid values } diff --git a/client/src/main/generated/com/vesoft/nebula/meta/AdminCmd.java b/client/src/main/generated/com/vesoft/nebula/meta/AdminCmd.java index b4c9f43e7..1c8b05305 100644 --- a/client/src/main/generated/com/vesoft/nebula/meta/AdminCmd.java +++ b/client/src/main/generated/com/vesoft/nebula/meta/AdminCmd.java @@ -23,6 +23,8 @@ public class AdminCmd { public static final int REBUILD_EDGE_INDEX = 3; public static final int STATS = 4; public static final int DATA_BALANCE = 5; + public static final int DOWELOAD = 6; + public static final int INGEST = 7; public static final int UNKNOWN = 99; public static final IntRangeSet VALID_VALUES; diff --git a/client/src/main/generated/com/vesoft/nebula/storage/ErrorCode.java b/client/src/main/generated/com/vesoft/nebula/storage/ErrorCode.java index 1f65f0830..0ae98bccf 100644 --- a/client/src/main/generated/com/vesoft/nebula/storage/ErrorCode.java +++ b/client/src/main/generated/com/vesoft/nebula/storage/ErrorCode.java @@ -35,6 +35,7 @@ public class ErrorCode { public static final int E_FIELD_UNSET = -22; public static final int E_OUT_OF_RANGE = -23; public static final int E_ATOMIC_OP_FAILED = -24; + public static final int E_DATA_CONFLICT_ERROR = -25; public static final int E_EDGE_PROP_NOT_FOUND = -31; public static final int E_TAG_PROP_NOT_FOUND = -32; public static final int E_IMPROPER_DATA_TYPE = -33; diff --git a/client/src/main/java/com/vesoft/nebula/client/graph/data/Node.java b/client/src/main/java/com/vesoft/nebula/client/graph/data/Node.java index b8aadfaf0..f8cf087dd 100644 --- a/client/src/main/java/com/vesoft/nebula/client/graph/data/Node.java +++ b/client/src/main/java/com/vesoft/nebula/client/graph/data/Node.java @@ -50,6 +50,14 @@ public List tagNames() { return tagNames; } + /** + * Used to be compatible with older versions of interfaces + * @return the list of tag name + */ + public List labels() { + return tagNames; + } + /** * determine if node contains the given tag * @param tagName the tag name @@ -59,6 +67,14 @@ public boolean hasTagName(String tagName) { return tagNames.contains(tagName); } + /** + * Used to be compatible with older versions of interfaces + * @return tboolean + */ + public boolean hasLabel(String tagName) { + return tagNames.contains(tagName); + } + /** * get property values from the node * @param tagName the tag name diff --git a/client/src/main/java/com/vesoft/nebula/client/storage/StorageClient.java b/client/src/main/java/com/vesoft/nebula/client/storage/StorageClient.java index f551d077d..c782e85fd 100644 --- a/client/src/main/java/com/vesoft/nebula/client/storage/StorageClient.java +++ b/client/src/main/java/com/vesoft/nebula/client/storage/StorageClient.java @@ -35,15 +35,26 @@ public class StorageClient { private final List addresses; private int timeout = 10000; // ms + /** + * @param ip the ip of metad server + * @param port the port of meted server + */ public StorageClient(String ip, int port) { this(Arrays.asList(new HostAddress(ip, port))); } + /** + * @param addresses the address of metad server + */ public StorageClient(List addresses) { this.connection = new GraphStorageConnection(); this.addresses = addresses; } + /** + * @param addresses the address of metad server + * @param timeout the timeout of scan vertex or edge + */ public StorageClient(List addresses, int timeout) { this.connection = new GraphStorageConnection(); this.addresses = addresses; diff --git a/examples/src/main/java/com/vesoft/nebula/examples/StorageClientExample.java b/examples/src/main/java/com/vesoft/nebula/examples/StorageClientExample.java index 67b4f99c0..b82b232d4 100644 --- a/examples/src/main/java/com/vesoft/nebula/examples/StorageClientExample.java +++ b/examples/src/main/java/com/vesoft/nebula/examples/StorageClientExample.java @@ -24,6 +24,7 @@ public class StorageClientExample { private static final Logger LOGGER = LoggerFactory.getLogger(StorageClientExample.class); public static void main(String[] args) { + // input params are the metad's ip and port StorageClient client = new StorageClient("127.0.0.1", 9559); try { client.connect();