Skip to content

Commit 2b15406

Browse files
committed
Reorganize Namespaces
1 parent 8c476a0 commit 2b15406

15 files changed

+78
-58
lines changed

benchmarks/csharp/Program.cs

+22-24
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
using System.Collections.Concurrent;
44
using System.Diagnostics;
55
using System.Text.Json;
6-
76
using CommandLine;
8-
9-
using Glide;
10-
117
using LinqStatistics;
12-
138
using StackExchange.Redis;
9+
using Valkey.Glide;
10+
11+
namespace csharp_benchmark;
1412

1513
public static class MainClass
1614
{
@@ -164,12 +162,12 @@ private static Dictionary<string, object> LatencyResults(
164162
ConcurrentBag<double> latencies
165163
) => new()
166164
{
167-
{prefix + "_p50_latency", CalculateLatency(latencies, 0.5)},
168-
{prefix + "_p90_latency", CalculateLatency(latencies, 0.9)},
169-
{prefix + "_p99_latency", CalculateLatency(latencies, 0.99)},
170-
{prefix + "_average_latency", Math.Round(latencies.Average(), 3)},
171-
{prefix + "_std_dev", latencies.StandardDeviation()},
172-
};
165+
{prefix + "_p50_latency", CalculateLatency(latencies, 0.5)},
166+
{prefix + "_p90_latency", CalculateLatency(latencies, 0.9)},
167+
{prefix + "_p99_latency", CalculateLatency(latencies, 0.99)},
168+
{prefix + "_average_latency", Math.Round(latencies.Average(), 3)},
169+
{prefix + "_std_dev", latencies.StandardDeviation()},
170+
};
173171

174172
private static async Task RunClients(
175173
ClientWrapper[] clients,
@@ -240,8 +238,8 @@ internal ClientWrapper(Func<string, Task<string?>> get, Func<string, string, Tas
240238

241239
private static async Task<ClientWrapper[]> CreateClients(int clientCount,
242240
Func<Task<(Func<string, Task<string?>>,
243-
Func<string, string, Task>,
244-
Action)>> clientCreation)
241+
Func<string, string, Task>,
242+
Action)>> clientCreation)
245243
{
246244
IEnumerable<Task<ClientWrapper>> tasks = Enumerable.Range(0, clientCount).Select(async (_) =>
247245
{
@@ -266,8 +264,8 @@ private static async Task RunWithParameters(int total_commands,
266264
BaseClient glide_client = new GlideClient(host, PORT, useTLS);
267265
return Task.FromResult<(Func<string, Task<string?>>, Func<string, string, Task>, Action)>(
268266
(async (key) => await glide_client.Get(key),
269-
async (key, value) => await glide_client.Set(key, value),
270-
() => glide_client.Dispose()));
267+
async (key, value) => await glide_client.Set(key, value),
268+
() => glide_client.Dispose()));
271269
});
272270

273271
await RunClients(
@@ -282,14 +280,14 @@ await RunClients(
282280
if (clientsToRun == "all")
283281
{
284282
ClientWrapper[] clients = await CreateClients(clientCount, () =>
285-
{
286-
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect(GetAddressForStackExchangeRedis(host, useTLS));
287-
IDatabase db = connection.GetDatabase();
288-
return Task.FromResult<(Func<string, Task<string?>>, Func<string, string, Task>, Action)>(
289-
(async (key) => await db.StringGetAsync(key),
290-
async (key, value) => await db.StringSetAsync(key, value),
291-
() => connection.Dispose()));
292-
});
283+
{
284+
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect(GetAddressForStackExchangeRedis(host, useTLS));
285+
IDatabase db = connection.GetDatabase();
286+
return Task.FromResult<(Func<string, Task<string?>>, Func<string, string, Task>, Action)>(
287+
(async (key) => await db.StringGetAsync(key),
288+
async (key, value) => await db.StringSetAsync(key, value),
289+
() => connection.Dispose()));
290+
});
293291
await RunClients(
294292
clients,
295293
"StackExchange.Redis",
@@ -324,4 +322,4 @@ public static async Task Main(string[] args)
324322

325323
PrintResults(options.ResultsFile);
326324
}
327-
}
325+
}

benchmarks/csharp/csharp_benchmark.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4-
<ProjectReference Include="..\..\csharp\lib\glide.csproj" />
4+
<ProjectReference Include="..\..\csharp\sources\Valkey.Glide\Valkey.Glide.csproj" />
55
</ItemGroup>
66

77
<ItemGroup>

csharp/Valkey.Glide.sln

+35-15
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.30114.105
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "glide", "lib\glide.csproj", "{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_benchmark", "..\benchmarks\csharp\csharp_benchmark.csproj", "{C62D5809-3059-4633-A267-31B402FCBFDA}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{B5A73329-1C34-4D33-8013-D030983A59FF}"
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".files", ".files", "{32B7AC89-C6AD-4BFF-9079-37F2F9C35ED8}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
.gitignore = .gitignore
12+
ReadMe.md = ReadMe.md
13+
EndProjectSection
914
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp_benchmark", "..\benchmarks\csharp\csharp_benchmark.csproj", "{C62D5809-3059-4633-A267-31B402FCBFDA}"
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{E4674D00-0C50-4C27-A16C-080AA8ED4AED}"
16+
EndProject
17+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DA0C6818-69FD-41B4-9907-AAC9B0C46511}"
18+
EndProject
19+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sources", "sources", "{A615F0CF-BB06-401E-BB29-1B096F144683}"
20+
EndProject
21+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{63B5D5AB-DFAD-4150-BCA1-8A02D17B4B9D}"
22+
EndProject
23+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Valkey.Glide", "sources\Valkey.Glide\Valkey.Glide.csproj", "{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}"
24+
EndProject
25+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Valkey.Glide.UnitTests", "tests\Valkey.Glide.UnitTests\Valkey.Glide.UnitTests.csproj", "{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}"
1126
EndProject
1227
Global
1328
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,23 +34,28 @@ Global
1934
HideSolutionNode = FALSE
2035
EndGlobalSection
2136
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22-
{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}.Lint|Any CPU.ActiveCfg = Lint|Any CPU
25-
{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}.Lint|Any CPU.Build.0 = Lint|Any CPU
26-
{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
27-
{32EC49AD-EB2E-4B07-8644-E56E4EC517BD}.Release|Any CPU.Build.0 = Release|Any CPU
28-
{B5A73329-1C34-4D33-8013-D030983A59FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29-
{B5A73329-1C34-4D33-8013-D030983A59FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
30-
{B5A73329-1C34-4D33-8013-D030983A59FF}.Lint|Any CPU.ActiveCfg = Lint|Any CPU
31-
{B5A73329-1C34-4D33-8013-D030983A59FF}.Lint|Any CPU.Build.0 = Lint|Any CPU
32-
{B5A73329-1C34-4D33-8013-D030983A59FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
33-
{B5A73329-1C34-4D33-8013-D030983A59FF}.Release|Any CPU.Build.0 = Release|Any CPU
3437
{C62D5809-3059-4633-A267-31B402FCBFDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3538
{C62D5809-3059-4633-A267-31B402FCBFDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
3639
{C62D5809-3059-4633-A267-31B402FCBFDA}.Lint|Any CPU.ActiveCfg = Lint|Any CPU
3740
{C62D5809-3059-4633-A267-31B402FCBFDA}.Lint|Any CPU.Build.0 = Lint|Any CPU
3841
{C62D5809-3059-4633-A267-31B402FCBFDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
3942
{C62D5809-3059-4633-A267-31B402FCBFDA}.Release|Any CPU.Build.0 = Release|Any CPU
43+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
44+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
45+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}.Lint|Any CPU.ActiveCfg = Lint|Any CPU
46+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}.Lint|Any CPU.Build.0 = Lint|Any CPU
47+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}.Lint|Any CPU.ActiveCfg = Lint|Any CPU
52+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}.Lint|Any CPU.Build.0 = Lint|Any CPU
53+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}.Release|Any CPU.ActiveCfg = Release|Any CPU
54+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D}.Release|Any CPU.Build.0 = Release|Any CPU
55+
EndGlobalSection
56+
GlobalSection(NestedProjects) = preSolution
57+
{C62D5809-3059-4633-A267-31B402FCBFDA} = {E4674D00-0C50-4C27-A16C-080AA8ED4AED}
58+
{EC866C03-DDA9-412B-91AB-FDFDCE1177FD} = {A615F0CF-BB06-401E-BB29-1B096F144683}
59+
{6EAB912B-AF22-4CAC-9686-4B3D0F86980D} = {63B5D5AB-DFAD-4150-BCA1-8A02D17B4B9D}
4060
EndGlobalSection
4161
EndGlobal

csharp/sources/Valkey.Glide/BaseClient.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
using System.Buffers;
44
using System.Runtime.InteropServices;
55

6-
using Glide.Commands;
7-
using Glide.Internals;
6+
using Valkey.Glide.Commands;
7+
using Valkey.Glide.Internals;
88

9-
namespace Glide;
9+
namespace Valkey.Glide;
1010

1111
public abstract class BaseClient : IDisposable, IStringBaseCommands
1212
{

csharp/sources/Valkey.Glide/Commands/IConnectionManagementCommands.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
22

3-
namespace Glide.Commands;
3+
namespace Valkey.Glide.Commands;
44

55
internal interface IConnectionManagementCommands
66
{

csharp/sources/Valkey.Glide/Commands/IStringBaseCommands.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
22

3-
namespace Glide.Commands;
3+
namespace Valkey.Glide.Commands;
44

55
/// <summary>
66
/// Supports commands for the "String Commands" group for standalone and cluster clients.

csharp/sources/Valkey.Glide/GlideClient.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
22

3-
using Glide.Commands;
3+
using Valkey.Glide.Commands;
44

5-
namespace Glide;
5+
namespace Valkey.Glide;
66

77
public class GlideClient(string host, uint port, bool useTLS) : BaseClient(host, port, useTLS), IConnectionManagementCommands
88
{

csharp/sources/Valkey.Glide/Internals/Message.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Runtime.CompilerServices;
55
using System.Runtime.InteropServices;
66

7-
using Glide.Internals;
7+
namespace Valkey.Glide.Internals;
88

99
/// Reusable source of ValueTask. This object can be allocated once and then reused
1010
/// to create multiple asynchronous operations, as long as each call to CreateTask
@@ -114,4 +114,4 @@ public void OnCompleted(Action continuation)
114114
public bool IsCompleted => _completionState == COMPLETION_STAGE_CONTINUATION_EXECUTED;
115115

116116
public T? GetResult() => _exception is null ? _result : throw _exception;
117-
}
117+
}

csharp/sources/Valkey.Glide/Internals/MessageContainer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using System.Collections.Concurrent;
44

5-
namespace Glide.Internals;
5+
namespace Valkey.Glide.Internals;
66

77

88
internal class MessageContainer<T>

csharp/sources/Valkey.Glide/Logger.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
using System.Runtime.InteropServices;
55
using System.Text;
66

7-
8-
namespace Glide;
7+
namespace Valkey.Glide;
98

109
// TODO - use a bindings generator to create this enum.
1110
public enum Level

csharp/sources/Valkey.Glide/Valkey.Glide.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
5-
<RootNamespace>Glide</RootNamespace>
5+
<RootNamespace>Valkey.Glide</RootNamespace>
6+
<AssemblyName>Valkey.Glide</AssemblyName>
67
<ImplicitUsings>enable</ImplicitUsings>
78
<Nullable>enable</Nullable>
89
<LangVersion>12.0</LangVersion>

csharp/tests/Valkey.Glide.UnitTests/Integration/SharedClientTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
22

3-
namespace Tests.Integration;
3+
namespace Valkey.Glide.UnitTests.Integration;
44

55
public class SharedClientTests(TestConfiguration config)
66
{

csharp/tests/Valkey.Glide.UnitTests/Integration/SharedCommandTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
22

3-
namespace Tests.Integration;
3+
namespace Valkey.Glide.UnitTests.Integration;
44
public class SharedCommandTests(TestConfiguration config)
55
{
66
public TestConfiguration Config { get; } = config;

csharp/tests/Valkey.Glide.UnitTests/Integration/TestConfiguration.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using System.Diagnostics;
44
using System.Runtime.InteropServices;
55

6-
[assembly: AssemblyFixture(typeof(Tests.Integration.TestConfiguration))]
6+
using Valkey.Glide.UnitTests.Integration;
77

8-
namespace Tests.Integration;
8+
[assembly: AssemblyFixture(typeof(TestConfiguration))]
9+
10+
namespace Valkey.Glide.UnitTests.Integration;
911

1012
public class TestConfiguration : IDisposable
1113
{

csharp/tests/Valkey.Glide.UnitTests/Valkey.Glide.UnitTests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</ItemGroup>
5050

5151
<ItemGroup>
52-
<ProjectReference Include="..\lib\glide.csproj" />
52+
<ProjectReference Include="..\..\sources\Valkey.Glide\Valkey.Glide.csproj" />
5353
</ItemGroup>
5454

5555
<ItemGroup>

0 commit comments

Comments
 (0)