Skip to content

Commit

Permalink
CLIENT-2534 CLIENT-2692 Proxy client
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonklaus committed Dec 8, 2023
1 parent ea164b5 commit c9b39e3
Show file tree
Hide file tree
Showing 156 changed files with 12,432 additions and 1,034 deletions.
2 changes: 1 addition & 1 deletion Aerospike.sln
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AerospikeTest", "AerospikeT
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AerospikeClient", "AerospikeClient\AerospikeClient.csproj", "{A1AA3444-EAED-4394-BCCA-96EA0E0A88D1}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AerospikeClient", "AerospikeClient\AerospikeClient.csproj", "{A1AA3444-EAED-4394-BCCA-96EA0E0A88D1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AerospikeBenchmarks", "AerospikeBenchmarks\AerospikeBenchmarks.csproj", "{09C0B19A-41DD-4B47-A015-B7DFCA0072D3}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AerospikeBenchmarks", "AerospikeBenchmarks\AerospikeBenchmarks.csproj", "{09C0B19A-41DD-4B47-A015-B7DFCA0072D3}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
24 changes: 22 additions & 2 deletions AerospikeClient/AerospikeClient.csproj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,15 +34,35 @@
<SignAssembly>True</SignAssembly> <SignAssembly>True</SignAssembly>
</PropertyGroup> </PropertyGroup>


<ItemGroup>
<None Remove="Protos\Kvs\kvs.proto" />
</ItemGroup>

<ItemGroup> <ItemGroup>
<EmbeddedResource Include="LuaResources\aerospike.lua" /> <EmbeddedResource Include="LuaResources\aerospike.lua" />
<EmbeddedResource Include="LuaResources\aslib.lua" /> <EmbeddedResource Include="LuaResources\aslib.lua" />
<EmbeddedResource Include="LuaResources\stream_ops.lua" /> <EmbeddedResource Include="LuaResources\stream_ops.lua" />
</ItemGroup> </ItemGroup>


<ItemGroup> <ItemGroup>
<PackageReference Include="Iconic.Zlib.Netstandard" Version="1.0.0" /> <Protobuf Include="Protos\Auth\auth.proto" GrpcServices="Client" />
<PackageReference Include="NeoLua" Version="1.3.13" /> <Protobuf Include="Protos\Kvs\kvs.proto">
<GrpcServices>Client</GrpcServices>
</Protobuf>
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
<PackageReference Include="Grpc.AspNetCore" Version="2.59.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.59.0" />
<PackageReference Include="Grpc.Tools" Version="2.59.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NeoLua" Version="1.3.14" />
</ItemGroup>

<ItemGroup>
<None Update="Protos\Auth\auth.proto">
<GrpcServices>Client</GrpcServices>
</None>
</ItemGroup> </ItemGroup>


</Project> </Project>
4 changes: 1 addition & 3 deletions AerospikeClient/Async/AsyncBatch.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,8 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System;
using System.Collections.Generic;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
7 changes: 2 additions & 5 deletions AerospikeClient/Async/AsyncClient.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,9 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down Expand Up @@ -1118,7 +1115,7 @@ public Task<Record> Operate(WritePolicy policy, CancellationToken token, Key key
/// <exception cref="AerospikeException">if queue is full</exception> /// <exception cref="AerospikeException">if queue is full</exception>
public void Operate(WritePolicy policy, RecordListener listener, Key key, params Operation[] ops) public void Operate(WritePolicy policy, RecordListener listener, Key key, params Operation[] ops)
{ {
OperateArgs args = new OperateArgs(cluster, policy, writePolicyDefault, operatePolicyReadDefault, key, ops); OperateArgs args = new OperateArgs(policy, writePolicyDefault, operatePolicyReadDefault, key, ops);
AsyncOperate async = new AsyncOperate(cluster, listener, key, args); AsyncOperate async = new AsyncOperate(cluster, listener, key, args);
async.Execute(); async.Execute();
} }
Expand Down
5 changes: 1 addition & 4 deletions AerospikeClient/Async/AsyncCommand.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,10 +14,7 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading;
using System.Diagnostics;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Async/AsyncDelete.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,6 +14,7 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */

namespace Aerospike.Client namespace Aerospike.Client
{ {
public sealed class AsyncDelete : AsyncSingleCommand public sealed class AsyncDelete : AsyncSingleCommand
Expand Down
3 changes: 1 addition & 2 deletions AerospikeClient/Async/AsyncExecute.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,7 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System.Collections.Generic;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Async/AsyncExists.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,6 +14,7 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */

namespace Aerospike.Client namespace Aerospike.Client
{ {
public sealed class AsyncExists : AsyncSingleCommand public sealed class AsyncExists : AsyncSingleCommand
Expand Down
3 changes: 1 addition & 2 deletions AerospikeClient/Async/AsyncNode.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,7 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System.Threading;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
5 changes: 2 additions & 3 deletions AerospikeClient/Async/AsyncOperate.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,7 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System.Collections.Generic;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand All @@ -23,7 +22,7 @@ public sealed class AsyncOperate : AsyncRead
private readonly OperateArgs args; private readonly OperateArgs args;


public AsyncOperate(AsyncCluster cluster, RecordListener listener, Key key, OperateArgs args) public AsyncOperate(AsyncCluster cluster, RecordListener listener, Key key, OperateArgs args)
: base(cluster, args.writePolicy, listener, key, args.partition, true) : base(cluster, args.writePolicy, listener, key, args.GetPartition(cluster, key), true)
{ {
this.args = args; this.args = args;
} }
Expand Down
4 changes: 1 addition & 3 deletions AerospikeClient/Async/AsyncRead.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,8 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System;
using System.Collections.Generic;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
3 changes: 1 addition & 2 deletions AerospikeClient/Async/AsyncReadHeader.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,7 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System.Collections.Generic;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Async/AsyncSingleCommand.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,6 +14,7 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */

namespace Aerospike.Client namespace Aerospike.Client
{ {
public abstract class AsyncSingleCommand : AsyncCommand public abstract class AsyncSingleCommand : AsyncCommand
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Async/AsyncTouch.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,6 +14,7 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */

namespace Aerospike.Client namespace Aerospike.Client
{ {
public sealed class AsyncTouch : AsyncSingleCommand public sealed class AsyncTouch : AsyncSingleCommand
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Async/AsyncWrite.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,6 +14,7 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */

namespace Aerospike.Client namespace Aerospike.Client
{ {
public sealed class AsyncWrite : AsyncSingleCommand public sealed class AsyncWrite : AsyncSingleCommand
Expand Down
2 changes: 1 addition & 1 deletion AerospikeClient/CDT/ListReturnType.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public enum ListReturnType
/// <summary> /// <summary>
/// Invert meaning of list command and return values. For example: /// Invert meaning of list command and return values. For example:
/// <code> /// <code>
/// ListOperation.RemoveByIndexRange(binName, index, count, ListReturnType.KEY | ListReturnType.INVERTED); /// ListOperation.RemoveByIndexRange(binName, index, count, ListReturnType.INDEX | ListReturnType.INVERTED);
/// </code> /// </code>
/// With the INVERTED flag enabled, the keys outside of the specified index range will be removed and returned. /// With the INVERTED flag enabled, the keys outside of the specified index range will be removed and returned.
/// </summary> /// </summary>
Expand Down
9 changes: 3 additions & 6 deletions AerospikeClient/Cluster/Connection.cs
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 Aerospike, Inc. * Copyright 2012-2023 Aerospike, Inc.
* *
* Portions may be licensed to Aerospike, Inc. under one or more contributor * Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements. * license agreements.
Expand All @@ -14,18 +14,15 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System;
using System.IO;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading;


namespace Aerospike.Client namespace Aerospike.Client
{ {
/// <summary> /// <summary>
/// Socket connection wrapper. /// Socket connection wrapper.
/// </summary> /// </summary>
public class Connection public class Connection : IConnection
{ {
protected internal readonly Socket socket; protected internal readonly Socket socket;
protected internal readonly Pool<Connection> pool; protected internal readonly Pool<Connection> pool;
Expand Down Expand Up @@ -177,7 +174,7 @@ public void UpdateLastUsed()
/// <summary> /// <summary>
/// Shutdown and close socket. /// Shutdown and close socket.
/// </summary> /// </summary>
public void Close() public virtual void Close()
{ {
try try
{ {
Expand Down
45 changes: 45 additions & 0 deletions AerospikeClient/Cluster/IConnection.cs
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2012-2023 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements.
*
* 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.
*/

namespace Aerospike.Client
{
/// <summary>
/// Socket connection wrapper.
/// </summary>
public interface IConnection
{
public void SetTimeout(int timeoutMillis);

public abstract void Write(byte[] buffer, int length);

public abstract void ReadFully(byte[] buffer, int length);

public abstract Stream GetStream();

/// <summary>
/// Is socket closed from client perspective only.
/// </summary>
public bool IsClosed();

public void UpdateLastUsed();

/// <summary>
/// Shutdown and close socket.
/// </summary>
public void Close();
}
}
3 changes: 0 additions & 3 deletions AerospikeClient/Cluster/Partition.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
* License for the specific language governing permissions and limitations under * License for the specific language governing permissions and limitations under
* the License. * the License.
*/ */
using System;
using System.Collections.Generic;
using System.Threading;


namespace Aerospike.Client namespace Aerospike.Client
{ {
Expand Down
11 changes: 10 additions & 1 deletion AerospikeClient/Cluster/TlsConnection.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public TlsConnection(Cluster cluster, string tlsName, IPEndPoint address, int ti
} }
catch (Exception) catch (Exception)
{ {
base.Close(); Close();
throw; throw;
} }
} }
Expand Down Expand Up @@ -212,5 +212,14 @@ public override Stream GetStream()
{ {
return sslStream; return sslStream;
} }

/// <summary>
/// Shutdown and close socket.
/// </summary>
public override void Close()
{
base.Close();
sslStream.Dispose();
}
} }
} }
Loading

0 comments on commit c9b39e3

Please sign in to comment.