Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ssl support for graph daemon #364

Merged
merged 6 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<commons-pool2.version>2.2</commons-pool2.version>
<servlet.version>3.0.1</servlet.version>
<fastjson.version>1.2.78</fastjson.version>
<bouncycastle.version>1.69</bouncycastle.version>
</properties>

<build>
Expand Down Expand Up @@ -239,5 +240,10 @@
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,37 @@ public TSocket(Socket socket) throws TTransportException {
}
}

/**
* Constructor that takes an already created socket that comes alone with timeout
* and connectionTimeout.
*
* @param socket Already created socket object
* @param timeout Socket timeout
* @param connectionTimeout Socket connection timeout
* @throws TTransportException if there is an error setting up the streams
*/
public TSocket(Socket socket, int timeout, int connectionTimeout) throws TTransportException {
socket_ = socket;
try {
socket_.setSoLinger(false, 0);
socket_.setTcpNoDelay(true);
socket_.setSoTimeout(timeout);
connectionTimeout_ = connectionTimeout;
} catch (SocketException sx) {
LOGGER.warn("Could not configure socket.", sx);
}

if (isOpen()) {
try {
inputStream_ = new BufferedInputStream(socket_.getInputStream());
outputStream_ = new BufferedOutputStream(socket_.getOutputStream());
} catch (IOException iox) {
close();
throw new TTransportException(TTransportException.NOT_OPEN, iox);
}
}
}

/**
* Creates a new unconnected socket that will connect to the given host on the given port.
*
Expand Down
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();

}
5 changes: 5 additions & 0 deletions client/src/main/generated/com/vesoft/nebula/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public enum ErrorCode implements com.facebook.thrift.TEnum {
E_USER_CANCEL(-3052),
E_TASK_EXECUTION_FAILED(-3053),
E_PLAN_IS_KILLED(-3060),
E_NO_TERM(-3070),
E_OUTDATED_TERM(-3071),
E_OUTDATED_EDGE(-3072),
E_WRITE_WRITE_CONFLICT(-3073),
E_CLIENT_SERVER_INCOMPATIBLE(-3061),
E_UNKNOWN(-8000);

private static final Map<Integer, ErrorCode> INDEXED_VALUES = new HashMap<Integer, ErrorCode>();
Expand Down
265 changes: 265 additions & 0 deletions client/src/main/generated/com/vesoft/nebula/Geography.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
/**
* 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 Geography implements TBase, java.io.Serializable, Cloneable, Comparable<Geography> {
private static final TStruct STRUCT_DESC = new TStruct("Geography");
private static final TField WKB_FIELD_DESC = new TField("wkb", TType.STRING, (short)1);

public String wkb;
public static final int WKB = 1;

// isset id assignments

public static final Map<Integer, FieldMetaData> metaDataMap;

static {
Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
tmpMetaDataMap.put(WKB, new FieldMetaData("wkb", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
}

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

public Geography() {
}

public Geography(
String wkb) {
this();
this.wkb = wkb;
}

public static class Builder {
private String wkb;

public Builder() {
}

public Builder setWkb(final String wkb) {
this.wkb = wkb;
return this;
}

public Geography build() {
Geography result = new Geography();
result.setWkb(this.wkb);
return result;
}
}

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

/**
* Performs a deep copy on <i>other</i>.
*/
public Geography(Geography other) {
if (other.isSetWkb()) {
this.wkb = TBaseHelper.deepCopy(other.wkb);
}
}

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

public String getWkb() {
return this.wkb;
}

public Geography setWkb(String wkb) {
this.wkb = wkb;
return this;
}

public void unsetWkb() {
this.wkb = null;
}

// Returns true if field wkb is set (has been assigned a value) and false otherwise
public boolean isSetWkb() {
return this.wkb != null;
}

public void setWkbIsSet(boolean __value) {
if (!__value) {
this.wkb = null;
}
}

public void setFieldValue(int fieldID, Object __value) {
switch (fieldID) {
case WKB:
if (__value == null) {
unsetWkb();
} else {
setWkb((String)__value);
}
break;

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

public Object getFieldValue(int fieldID) {
switch (fieldID) {
case WKB:
return getWkb();

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 Geography))
return false;
Geography that = (Geography)_that;

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

return true;
}

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

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

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

lastComparison = Boolean.valueOf(isSetWkb()).compareTo(other.isSetWkb());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(wkb, other.wkb);
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 WKB:
if (__field.type == TType.STRING) {
this.wkb = iprot.readString();
} 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);
if (this.wkb != null) {
oprot.writeFieldBegin(WKB_FIELD_DESC);
oprot.writeString(this.wkb);
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("Geography");
sb.append(space);
sb.append("(");
sb.append(newLine);
boolean first = true;

sb.append(indentStr);
sb.append("wkb");
sb.append(space);
sb.append(":").append(space);
if (this.getWkb() == null) {
sb.append("null");
} else {
sb.append(TBaseHelper.toString(this.getWkb(), 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