xiazcy commented on code in PR #3315:
URL: https://github.com/apache/tinkerpop/pull/3315#discussion_r2967367265
##########
gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs:
##########
@@ -153,69 +48,33 @@ private static void
VerifyGraphSONArgumentTypeForMimeType<T>(object? argument, s
/// A <see cref="IMessageSerializer" /> instance to serialize
messages sent to and received
/// from the server.
/// </param>
- /// <param name="connectionPoolSettings">The <see
cref="ConnectionPoolSettings" /> for the connection pool.</param>
- /// <param name="webSocketConfiguration">
- /// A delegate that will be invoked with the <see
cref="ClientWebSocketOptions" />
- /// object used to configure WebSocket connections.
- /// </param>
- /// <param name="sessionId">The session Id if Gremlin Client in
session mode, defaults to null as session-less Client.</param>
- /// <param name="disableCompression">
- /// Whether to disable compression. Compression is only supported
since .NET 6.
- /// There it is also enabled by default.
- ///
- /// Note that compression might make your application susceptible
to attacks like CRIME/BREACH. Compression
- /// should therefore be turned off if your application sends
sensitive data to the server as well as data
- /// that could potentially be controlled by an untrusted user.
- /// </param>
+ /// <param name="connectionSettings">The <see
cref="ConnectionSettings" /> for the HTTP connection.</param>
/// <param name="loggerFactory">A factory to create loggers. If not
provided, then nothing will be logged.</param>
+ // Interceptor slot reserved for future spec:
+ // IReadOnlyList<Func<HttpRequestMessage, Task>>? interceptors = null,
public GremlinClient(GremlinServer gremlinServer, IMessageSerializer?
messageSerializer = null,
- ConnectionPoolSettings? connectionPoolSettings = null,
- Action<ClientWebSocketOptions>? webSocketConfiguration = null,
string? sessionId = null,
- bool disableCompression = false, ILoggerFactory? loggerFactory =
null)
+ ConnectionSettings? connectionSettings = null,
+ ILoggerFactory? loggerFactory = null)
{
messageSerializer ??= new GraphBinaryMessageSerializer();
- var webSocketSettings = new WebSocketSettings
- {
- WebSocketConfigurationCallback = webSocketConfiguration,
- EnableUserAgentOnConnect =
connectionPoolSettings?.EnableUserAgentOnConnect ??
ConnectionPoolSettings.DefaultEnableUserAgentOnConnect
-#if NET6_0_OR_GREATER
- , UseCompression = !disableCompression
-#endif
- };
- var connectionFactory =
- new ConnectionFactory(gremlinServer, messageSerializer,
webSocketSettings, sessionId);
-
- // make sure one connection in pool as session mode
- if (!string.IsNullOrEmpty(sessionId))
- {
- if (connectionPoolSettings != null)
- {
- if (connectionPoolSettings.PoolSize != 1)
- throw new
ArgumentOutOfRangeException(nameof(connectionPoolSettings),
- "PoolSize must be 1 in session mode!");
- }
- else
- {
- connectionPoolSettings = new ConnectionPoolSettings
{PoolSize = 1};
- }
- }
-
+ connectionSettings ??= new ConnectionSettings();
LoggerFactory = loggerFactory ?? NullLoggerFactory.Instance;
- _connectionPool = new ConnectionPool(connectionFactory,
- connectionPoolSettings ?? new ConnectionPoolSettings(),
LoggerFactory.CreateLogger<ConnectionPool>());
- }
+ _connection = new Connection(
Review Comment:
That is true. Though I'm leaning towards leaving it for now then decide on a
name across GLVs afterwards for the change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]