Skip to content

Commit

Permalink
Remove v4 suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
kenhuuu committed Aug 14, 2024
1 parent 9281b2c commit 9a60e57
Show file tree
Hide file tree
Showing 78 changed files with 797 additions and 825 deletions.
2 changes: 1 addition & 1 deletion docs/src/reference/gremlin-applications.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ public class AllowListAuthorizer implements Authorizer {
* {@link AuthorizationException} if this is not the case.
*
* @param user {@link AuthenticatedUser} that needs authorization.
* @param msg {@link RequestMessage} in which the {@link org.apache.tinkerpop.gremlin.util.TokensV4}.ARGS_GREMLIN argument can contain an arbitrary succession of script statements.
* @param msg {@link RequestMessage} in which the {@link org.apache.tinkerpop.gremlin.util.Tokens}.ARGS_GREMLIN argument can contain an arbitrary succession of script statements.
*/
public void authorize(final AuthenticatedUser user, final RequestMessage msg) throws AuthorizationException {
if (!usernamesSandbox.contains(user.getName())) {
Expand Down
5 changes: 2 additions & 3 deletions gremlin-driver/src/main/java/examples/Connections.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Licensed to the Apache Software Foundation (ASF) under one

package examples;

import org.apache.tinkerpop.gremlin.driver.Channelizer;
import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
Expand All @@ -29,7 +28,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
import org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
import org.apache.tinkerpop.gremlin.util.MessageSerializerV4;
import org.apache.tinkerpop.gremlin.util.MessageSerializer;
import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4;

import static org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal;
Expand Down Expand Up @@ -95,7 +94,7 @@ private static void withCluster() throws Exception {
private static void withSerializer() throws Exception {
IoRegistry registry = new FakeIoRegistry(); // an IoRegistry instance exposed by a specific graph provider
TypeSerializerRegistry typeSerializerRegistry = TypeSerializerRegistry.build().addRegistry(registry).create();
MessageSerializerV4 serializer = new GraphBinaryMessageSerializerV4(typeSerializerRegistry);
MessageSerializer serializer = new GraphBinaryMessageSerializerV4(typeSerializerRegistry);
Cluster cluster = Cluster.build("localhost").
serializer(serializer).
create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinRequestEncoder;
import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinResponseStreamDecoder;
import org.apache.tinkerpop.gremlin.driver.handler.SslCheckHandler;
import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4;
import org.apache.tinkerpop.gremlin.util.message.ResponseMessage;

import java.util.Collections;
import java.util.Optional;
Expand Down Expand Up @@ -160,8 +160,8 @@ final class HttpChannelizer extends AbstractChannelizer {
/**
* This response is used as a signal for determining if all content of the response has been read.
*/
public static final ResponseMessageV4 LAST_CONTENT_READ_RESPONSE =
ResponseMessageV4.build().code(HttpResponseStatus.NO_CONTENT).result(Collections.emptyList()).create();
public static final ResponseMessage LAST_CONTENT_READ_RESPONSE =
ResponseMessage.build().code(HttpResponseStatus.NO_CONTENT).result(Collections.emptyList()).create();

private HttpGremlinRequestEncoder gremlinRequestEncoder;
private HttpGremlinResponseStreamDecoder gremlinResponseDecoder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4;
import org.apache.tinkerpop.gremlin.util.message.RequestMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -44,8 +44,6 @@
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static org.apache.tinkerpop.gremlin.driver.RequestOptions.getRequestOptions;

/**
* A {@code Client} is constructed from a {@link Cluster} and represents a way to send messages to Gremlin Server.
* This class itself is a base class as there are different implementations that provide differing kinds of
Expand All @@ -71,11 +69,11 @@ public abstract class Client {
}

/**
* Makes any initial changes to the builder and returns the constructed {@link RequestMessageV4}. Implementers
* Makes any initial changes to the builder and returns the constructed {@link RequestMessage}. Implementers
* may choose to override this message to append data to the request before sending. By default, this method
* will simply return the {@code builder} passed in by the caller.
*/
public RequestMessageV4.Builder buildMessage(final RequestMessageV4.Builder builder) {
public RequestMessage.Builder buildMessage(final RequestMessage.Builder builder) {
return builder;
}

Expand All @@ -87,7 +85,7 @@ public RequestMessageV4.Builder buildMessage(final RequestMessageV4.Builder buil
/**
* Chooses a {@link Connection} to write the message to.
*/
protected abstract Connection chooseConnection(final RequestMessageV4 msg) throws TimeoutException, ConnectionException;
protected abstract Connection chooseConnection(final RequestMessage msg) throws TimeoutException, ConnectionException;

/**
* Asynchronous close of the {@code Client}.
Expand Down Expand Up @@ -231,7 +229,7 @@ public CompletableFuture<ResultSet> submitAsync(final String gremlin, final Requ

// need to call buildMessage() right away to get client specific configurations, that way request specific
// ones can override as needed
final RequestMessageV4.Builder request = buildMessage(RequestMessageV4.build(gremlin))
final RequestMessage.Builder request = buildMessage(RequestMessage.build(gremlin))
.addChunkSize(batchSize);

// apply settings if they were made available
Expand All @@ -245,9 +243,9 @@ public CompletableFuture<ResultSet> submitAsync(final String gremlin, final Requ
}

/**
* A low-level method that allows the submission of a manually constructed {@link RequestMessageV4}.
* A low-level method that allows the submission of a manually constructed {@link RequestMessage}.
*/
public CompletableFuture<ResultSet> submitAsync(final RequestMessageV4 msg) {
public CompletableFuture<ResultSet> submitAsync(final RequestMessage msg) {
if (isClosing()) throw new IllegalStateException("Client is closed");

if (!initialized)
Expand Down Expand Up @@ -349,7 +347,7 @@ public Client alias(final String graphOrTraversalSource) {
* from that host's connection pool.
*/
@Override
protected Connection chooseConnection(final RequestMessageV4 msg) throws TimeoutException, ConnectionException {
protected Connection chooseConnection(final RequestMessage msg) throws TimeoutException, ConnectionException {
final Iterator<Host> possibleHosts = this.cluster.loadBalancingStrategy().select(msg);

// try a random host if none are marked available. maybe it will reconnect in the meantime. better than
Expand Down Expand Up @@ -483,8 +481,8 @@ public static class AliasClusteredClient extends Client {
}

@Override
public CompletableFuture<ResultSet> submitAsync(final RequestMessageV4 msg) {
final RequestMessageV4.Builder builder = RequestMessageV4.from(msg);
public CompletableFuture<ResultSet> submitAsync(final RequestMessage msg) {
final RequestMessage.Builder builder = RequestMessage.from(msg);

builder.addG(graphOrTraversalSource);

Expand All @@ -502,7 +500,7 @@ public synchronized Client init() {
}

@Override
public RequestMessageV4.Builder buildMessage(final RequestMessageV4.Builder builder) {
public RequestMessage.Builder buildMessage(final RequestMessage.Builder builder) {
if (close.isDone()) throw new IllegalStateException("Client is closed");
builder.addG(graphOrTraversalSource);

Expand All @@ -523,7 +521,7 @@ protected void initializeImplementation() {
* Delegates to the underlying {@link Client.ClusteredClient}.
*/
@Override
protected Connection chooseConnection(final RequestMessageV4 msg) throws TimeoutException, ConnectionException {
protected Connection chooseConnection(final RequestMessage msg) throws TimeoutException, ConnectionException {
if (close.isDone()) throw new IllegalStateException("Client is closed");
return client.chooseConnection(msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.apache.tinkerpop.gremlin.driver.auth.Auth;
import org.apache.tinkerpop.gremlin.util.MessageSerializerV4;
import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4;
import org.apache.tinkerpop.gremlin.util.ser.SerializersV4;
import org.apache.tinkerpop.gremlin.util.MessageSerializer;
import org.apache.tinkerpop.gremlin.util.message.RequestMessage;
import org.apache.tinkerpop.gremlin.util.ser.Serializers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -279,7 +279,7 @@ public String getPath() {
}

/**
* Get the {@link MessageSerializerV4} MIME types supported.
* Get the {@link MessageSerializer} MIME types supported.
*/
public String[] getSerializers() {
return getSerializer().mimeTypesSupported();
Expand Down Expand Up @@ -359,7 +359,7 @@ Factory getFactory() {
return manager.factory;
}

MessageSerializerV4<?> getSerializer() {
MessageSerializer<?> getSerializer() {
return manager.serializer;
}

Expand Down Expand Up @@ -387,7 +387,7 @@ LoadBalancingStrategy loadBalancingStrategy() {
return manager.loadBalancingStrategy;
}

RequestMessageV4.Builder validationRequest() {
RequestMessage.Builder validationRequest() {
return manager.validationRequest.get();
}

Expand Down Expand Up @@ -468,7 +468,7 @@ public final static class Builder {
private final List<InetAddress> addresses = new ArrayList<>();
private int port = 8182;
private String path = "/gremlin";
private MessageSerializerV4<?> serializer = null;
private MessageSerializer<?> serializer = null;
private int nioPoolSize = Runtime.getRuntime().availableProcessors();
private int workerPoolSize = Runtime.getRuntime().availableProcessors() * 2;
private int minConnectionPoolSize = ConnectionPool.MIN_POOL_SIZE;
Expand Down Expand Up @@ -529,28 +529,28 @@ public Builder path(final String path) {
}

/**
* Set the {@link MessageSerializerV4} to use given the exact name of a {@link SerializersV4} enum. Note that
* Set the {@link MessageSerializer} to use given the exact name of a {@link Serializers} enum. Note that
* setting this value this way will not allow specific configuration of the serializer itself. If specific
* configuration is required * please use {@link #serializer(MessageSerializerV4)}.
* configuration is required * please use {@link #serializer(MessageSerializer)}.
*/
public Builder serializer(final String mimeType) {
serializer = SerializersV4.valueOf(mimeType).simpleInstance();
serializer = Serializers.valueOf(mimeType).simpleInstance();
return this;
}

/**
* Set the {@link MessageSerializerV4} to use via the {@link SerializersV4} enum. If specific configuration is
* required please use {@link #serializer(MessageSerializerV4)}.
* Set the {@link MessageSerializer} to use via the {@link Serializers} enum. If specific configuration is
* required please use {@link #serializer(MessageSerializer)}.
*/
public Builder serializer(final SerializersV4 mimeType) {
public Builder serializer(final Serializers mimeType) {
serializer = mimeType.simpleInstance();
return this;
}

/**
* Sets the {@link MessageSerializerV4} to use.
* Sets the {@link MessageSerializer} to use.
*/
public Builder serializer(final MessageSerializerV4<?> serializer) {
public Builder serializer(final MessageSerializer<?> serializer) {
this.serializer = serializer;
return this;
}
Expand Down Expand Up @@ -804,7 +804,7 @@ List<InetSocketAddress> getContactPoints() {

public Cluster create() {
if (addresses.isEmpty()) addContactPoint("localhost");
if (null == serializer) serializer = SerializersV4.GRAPHBINARY_V4.simpleInstance();
if (null == serializer) serializer = Serializers.GRAPHBINARY_V4.simpleInstance();
return new Cluster(this);
}
}
Expand Down Expand Up @@ -839,11 +839,11 @@ class Manager {
private boolean initialized;
private final List<InetSocketAddress> contactPoints;
private final Factory factory;
private final MessageSerializerV4<?> serializer;
private final MessageSerializer<?> serializer;
private final Settings.ConnectionPoolSettings connectionPoolSettings;
private final LoadBalancingStrategy loadBalancingStrategy;
private final Optional<SslContext> sslContextOptional;
private final Supplier<RequestMessageV4.Builder> validationRequest;
private final Supplier<RequestMessage.Builder> validationRequest;
private final List<RequestInterceptor> interceptor;

/**
Expand Down Expand Up @@ -926,7 +926,7 @@ private Manager(final Builder builder) {
this.connectionScheduler = new ScheduledThreadPoolExecutor(contactPoints.size() + 1,
new BasicThreadFactory.Builder().namingPattern("gremlin-driver-conn-scheduler-%d").build());

validationRequest = () -> RequestMessageV4.build(builder.validationRequest);
validationRequest = () -> RequestMessage.build(builder.validationRequest);
}

private void validateBuilder(final Builder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException;
import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4;
import org.apache.tinkerpop.gremlin.util.message.RequestMessage;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener;
Expand Down Expand Up @@ -180,7 +180,7 @@ public synchronized CompletableFuture<Void> closeAsync() {
return future;
}

public ChannelPromise write(final RequestMessageV4 requestMessage, final CompletableFuture<ResultSet> resultQueueSetup) {
public ChannelPromise write(final RequestMessage requestMessage, final CompletableFuture<ResultSet> resultQueueSetup) {
// once there is a completed write, then create a traverser for the result set and complete
// the promise so that the client knows that that it can start checking for results.
final Connection thisConnection = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.slf4j.LoggerFactory;
import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException;
import org.apache.tinkerpop.gremlin.util.ExceptionHelper;
import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4;
import org.apache.tinkerpop.gremlin.util.message.RequestMessage;
import org.apache.tinkerpop.gremlin.util.TimeUtil;

import java.util.ArrayList;
Expand Down Expand Up @@ -500,7 +500,7 @@ private boolean tryReconnect(final Host h) {
// pool needs it. for now that seems like an unnecessary added bit of complexity for dealing with this
// error state
connection = connectionFactory.create(this);
final RequestMessageV4 ping = client.buildMessage(cluster.validationRequest()).create();
final RequestMessage ping = client.buildMessage(cluster.validationRequest()).create();
final CompletableFuture<ResultSet> f = new CompletableFuture<>();
connection.write(ping, f);
f.get().all().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.driver;

import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4;
import org.apache.tinkerpop.gremlin.util.message.RequestMessage;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -41,13 +41,13 @@ public interface LoadBalancingStrategy extends Host.Listener {
public void initialize(final Cluster cluster, final Collection<Host> hosts);

/**
* Provide an ordered list of hosts to send the given {@link RequestMessageV4} to.
* Provide an ordered list of hosts to send the given {@link RequestMessage} to.
*/
public Iterator<Host> select(final RequestMessageV4 msg);
public Iterator<Host> select(final RequestMessage msg);

/**
* A simple round-robin strategy that simply selects the next host in the {@link Cluster} to send the
* {@link RequestMessageV4} to.
* {@link RequestMessage} to.
*/
public static class RoundRobin implements LoadBalancingStrategy {

Expand All @@ -61,7 +61,7 @@ public void initialize(final Cluster cluster, final Collection<Host> hosts) {
}

@Override
public Iterator<Host> select(final RequestMessageV4 msg) {
public Iterator<Host> select(final RequestMessage msg) {
final List<Host> hosts = new ArrayList<>();

// a host could be marked as dead in which case we dont need to send messages to it - just skip it for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@

import org.apache.tinkerpop.gremlin.process.traversal.GremlinLang;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy;
import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4;
import org.apache.tinkerpop.gremlin.util.message.RequestMessage;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;

import static org.apache.tinkerpop.gremlin.util.TokensV4.ARGS_BATCH_SIZE;
import static org.apache.tinkerpop.gremlin.util.TokensV4.ARGS_EVAL_TIMEOUT;
import static org.apache.tinkerpop.gremlin.util.TokensV4.ARGS_G;
import static org.apache.tinkerpop.gremlin.util.TokensV4.ARGS_LANGUAGE;
import static org.apache.tinkerpop.gremlin.util.TokensV4.ARGS_MATERIALIZE_PROPERTIES;
import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_BATCH_SIZE;
import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_EVAL_TIMEOUT;
import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_G;
import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_LANGUAGE;
import static org.apache.tinkerpop.gremlin.util.Tokens.ARGS_MATERIALIZE_PROPERTIES;

/**
* Options that can be supplied on a per request basis.
Expand Down Expand Up @@ -145,7 +145,7 @@ public Builder addParameter(final String name, final Object value) {
/**
* The per client request override for the client and server configured {@code resultIterationBatchSize}. If
* this value is not set, then the configuration for the {@link Cluster} is used unless the
* {@link RequestMessageV4} is configured completely by the user.
* {@link RequestMessage} is configured completely by the user.
*/
public Builder batchSize(final int batchSize) {
this.batchSize = batchSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.util.message.ResponseResultV4;
import org.apache.tinkerpop.gremlin.util.message.ResponseResult;

import java.util.Iterator;

Expand All @@ -39,7 +39,7 @@ public final class Result {
final Object resultObject;

/**
* Constructs a "result" from data found in {@link ResponseResultV4#getData()}.
* Constructs a "result" from data found in {@link ResponseResult#getData()}.
*/
public Result(final Object responseData) {
this.resultObject = responseData;
Expand Down
Loading

0 comments on commit 9a60e57

Please sign in to comment.