Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public interface OpenGeminiAsyncClient extends AutoCloseable {
*/
CompletableFuture<Void> write(String database, String retentionPolicy, List<Point> points);

/**
* Writing via GRPC points to the database.
*
* @param database the name of the database.
* @param points the points to write.
*/
CompletableFuture<Void> writeByGrpc(String database, List<Point> points);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter is modified to(WriteRequest writeRequest),referring to the definition in the Go SDK.


/**
* Ping the OpenGemini server
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ public CompletableFuture<Void> write(String database, String retentionPolicy, Li
return executeWrite(database, retentionPolicy, body);
}


@Override
public CompletableFuture<Void> writeByGrpc(String database, List<Point> points) {
if (points.isEmpty()) {
return CompletableFuture.completedFuture(null);
}
return executeWriteByGrpc(database, points);
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -187,6 +196,15 @@ protected abstract CompletableFuture<Void> executeWrite(String database,
String retentionPolicy,
String lineProtocol);

/**
* The implementation class needs to implement this method to execute a write operation via an RPC call.
*
* @param database the name of the database.
* @param points the points to write.
*/
protected abstract CompletableFuture<Void> executeWriteByGrpc(String database,
List<Point> points);

/**
* The implementation class needs to implement this method to execute a ping call.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.opengemini.client.api.AuthType;
import io.opengemini.client.api.Configuration;
import io.opengemini.client.api.OpenGeminiException;
import io.opengemini.client.api.Point;
import io.opengemini.client.api.Pong;
import io.opengemini.client.api.Query;
import io.opengemini.client.api.QueryResult;
Expand All @@ -35,6 +36,7 @@

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

Expand Down Expand Up @@ -130,6 +132,17 @@ public CompletableFuture<HttpResponse> post(String url, String body) {
headers);
}

/**
* Execute a write call with java GRPC Client.
*
* @param database the name of the database.
* @param points the points to write.
*/
@Override
protected CompletableFuture<Void> executeWriteByGrpc(String database, List<Point> points) {
return null;
}

@Override
public void close() throws IOException {
this.client.close();
Expand Down