Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ dependency-reduced-pom.xml
logs/

*.xml.releaseBackup
.go
45 changes: 45 additions & 0 deletions ci/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,34 @@

<!-- pattern sort by alpha -->

<Match>
<Bug pattern="AT_NONATOMIC_64BIT_PRIMITIVE"/>
</Match>

<Match>
<Bug pattern="AT_STALE_THREAD_WRITE_OF_PRIMITIVE"/>
</Match>

<Match>
<Bug pattern="SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR"/>
</Match>

<Match>
<Bug pattern="SING_SINGLETON_IMPLEMENTS_SERIALIZABLE"/>
</Match>

<Match>
<Bug pattern="DM_DEFAULT_ENCODING"/>
</Match>

<Match>
<Bug pattern="MS_PKGPROTECT"/>
</Match>

<Match>
<Bug pattern="REC_CATCH_EXCEPTION"/>
</Match>

<Match>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
Expand All @@ -46,4 +74,21 @@
<Match>
<Package name="io.opengemini.client.proto"/>
</Match>

<!-- Exclude protobuf generated classes -->
<Match>
<Class name="proto.Write$PingRequest"/>
</Match>
<Match>
<Class name="proto.Write$PingResponse"/>
</Match>
<Match>
<Class name="proto.Write$Record"/>
</Match>
<Match>
<Class name="proto.Write$WriteRequest"/>
</Match>
<Match>
<Class name="proto.Write$WriteResponse"/>
</Match>
</FindBugsFilter>
22 changes: 22 additions & 0 deletions opengemini-client-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,27 @@
<artifactId>annotations</artifactId>
<version>${annotations.version}</version>
</dependency>
<!-- gRPC -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,32 @@
* limitations under the License.
*/

//package io.opengemini.client.api;
//
//import lombok.AllArgsConstructor;
//import lombok.NoArgsConstructor;
//import lombok.Setter;
//import lombok.ToString;
//
//@Setter
//@NoArgsConstructor
//@AllArgsConstructor
//public class TlsConfig {
// public String keyStorePath;
//
// @ToString.Exclude
// public char[] keyStorePassword;
//
// public String trustStorePath;
//
// @ToString.Exclude
// public char[] trustStorePassword;
//
// public boolean verifyDisabled;
//
// public boolean hostnameVerifyDisabled;
//
// public String[] versions;
//
// public String[] cipherSuites;
//}
package io.opengemini.client.api;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Setter
@NoArgsConstructor
@AllArgsConstructor
public class TlsConfig {
public String keyStorePath;

@ToString.Exclude
public char[] keyStorePassword;

public String trustStorePath;

@ToString.Exclude
public char[] trustStorePassword;

public boolean verifyDisabled;

public boolean hostnameVerifyDisabled;

public String[] versions;

public String[] cipherSuites;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2024 openGemini Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.opengemini.client.api.grpc;

public enum CompressMethod {
UNCOMPRESSED(0),
LZ4_FAST(1),
ZSTD_FAST(2),
SNAPPY(3);

private final int value;

CompressMethod(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public static CompressMethod forNumber(int value) {
for (CompressMethod method : values()) {
if (method.value == value) {
return method;
}
}
return UNCOMPRESSED;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright 2024 openGemini Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.opengemini.client.api.grpc;

import io.opengemini.client.api.Address;
import io.opengemini.client.api.AuthConfig;
import io.opengemini.client.api.TlsConfig;
import lombok.Getter;
import lombok.Setter;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;

/**
* GrpcConfig represents the configuration information for write service by gRPC.
*/
@Getter
@Setter
public class GrpcConfig {

/**
* Addresses Configure the service endpoints for the openGemini grpc write service.
* This parameter is required.
*/
private List<Address> addresses = new ArrayList<>();

/**
* AuthConfig configuration information for authentication.
*/
private AuthConfig authConfig;

/**
* TlsConfig configuration information for tls.
*/
private TlsConfig tlsConfig;

/**
* CompressMethod determines the compress method used for data transmission.
*/
private CompressMethod compressMethod = CompressMethod.UNCOMPRESSED;

/**
* Timeout default 30s
*/
private Duration timeout = Duration.ofSeconds(30);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 openGemini Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.opengemini.client.api.grpc;

/**
* ResponseCode represents the response code from gRPC write service.
*/
public enum ResponseCode {
Success(0),
Partial(1),
Failed(2);

private final int value;

ResponseCode(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public static ResponseCode forNumber(int value) {
for (ResponseCode code : values()) {
if (code.value == value) {
return code;
}
}
return Success;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 openGemini Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.opengemini.client.api.grpc;

/**
* ServerStatus represents the server status from gRPC ping response.
*/
public enum ServerStatus {
Up(0),
Down(1),
Unknown(99);

private final int value;

ServerStatus(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public static ServerStatus forNumber(int value) {
for (ServerStatus status : values()) {
if (status.value == value) {
return status;
}
}
return Unknown;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2024 openGemini Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.opengemini.client.api.grpc;
Loading
Loading