Skip to content

Commit

Permalink
refactor version to handshakeKey (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole00 authored Jan 5, 2024
1 parent 5d96b32 commit 6e00369
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public class NebulaClientOptions implements Serializable {

private final SelfSignParams selfSignParams;

private final String version;
private final String handshakeKey;

private NebulaClientOptions(String metaAddress, String graphAddress, String username,
String password, int timeout, int connectRetry,
boolean enableGraphSSL, boolean enableMetaSSL,
boolean enableStorageSSL,
SSLSignType sslSignType, CASignParams caSignParams,
SelfSignParams selfSignParams, String version) {
SelfSignParams selfSignParams, String handshakeKey) {
this.metaAddress = metaAddress;
this.graphAddress = graphAddress;
this.username = username;
Expand All @@ -60,7 +60,7 @@ private NebulaClientOptions(String metaAddress, String graphAddress, String user
this.sslSignType = sslSignType;
this.caSignParams = caSignParams;
this.selfSignParams = selfSignParams;
this.version = version;
this.handshakeKey = handshakeKey;
}

public List<HostAddress> getMetaAddress() {
Expand Down Expand Up @@ -120,8 +120,8 @@ public SelfSignParams getSelfSignParam() {
return selfSignParams;
}

public String getVersion() {
return version;
public String getHandshakeKey() {
return handshakeKey;
}

/**
Expand All @@ -142,7 +142,7 @@ public static class NebulaClientOptionsBuilder {
private SSLSignType sslSignType = null;
private CASignParams caSignParams = null;
private SelfSignParams selfSignParams = null;
private String version = null;
private String handshakeKey = null;

public NebulaClientOptionsBuilder setMetaAddress(String metaAddress) {
this.metaAddress = metaAddress;
Expand Down Expand Up @@ -207,8 +207,8 @@ public NebulaClientOptionsBuilder setSelfSignParam(String crtFilePath, String ke
return this;
}

public NebulaClientOptionsBuilder setVersion(String version) {
this.version = version;
public NebulaClientOptionsBuilder setHandshakeKey(String handshakeKey) {
this.handshakeKey = handshakeKey;
return this;
}

Expand Down Expand Up @@ -259,7 +259,7 @@ public NebulaClientOptions build() {
sslSignType,
caSignParams,
selfSignParams,
version);
handshakeKey);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public NebulaPool getNebulaPool() throws UnknownHostException {
Collections.shuffle(addresses);
NebulaPoolConfig poolConfig = new NebulaPoolConfig();
poolConfig.setTimeout(nebulaClientOptions.getTimeout());
poolConfig.setVersion(nebulaClientOptions.getVersion());
poolConfig.setHandshakeKey(nebulaClientOptions.getHandshakeKey());
if (nebulaClientOptions.isEnableGraphSSL()) {
poolConfig.setEnableSsl(true);
switch (nebulaClientOptions.getSSLSignType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public MetaClient getMetaClient() throws TException, ClientServerIncompatibleExc
metaClient = new MetaClient(addresses, timeout, retry, retry);
}

metaClient.setVersion(nebulaClientOptions.getVersion());
metaClient.setHandshakeKey(nebulaClientOptions.getHandshakeKey());
metaClient.connect();
return metaClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public StorageClient getStorageClient() throws Exception {
storageClient = new StorageClient(addresses, timeout);
}

storageClient.setVersion(nebulaClientOptions.getVersion());
storageClient.setHandshakeKey(nebulaClientOptions.getHandshakeKey());
if (!storageClient.connect()) {
throw new Exception("failed to connect storaged.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void getNebulaPool() {
.setPassword("nebula")
.setConnectRetry(1)
.setTimeout(1000)
.setVersion("test")
.setHandshakeKey("test")
.build();
NebulaGraphConnectionProvider graphConnectionProvider =
new NebulaGraphConnectionProvider(nebulaClientOptions);
Expand All @@ -63,7 +63,7 @@ public void getNebulaPoolWithWrongVersion() {
.setPassword("nebula")
.setConnectRetry(1)
.setTimeout(1000)
.setVersion("INVALID_VERSION")
.setHandshakeKey("INVALID_VERSION")
.build();
NebulaGraphConnectionProvider graphConnectionProvider =
new NebulaGraphConnectionProvider(nebulaClientOptions);
Expand Down

0 comments on commit 6e00369

Please sign in to comment.