Skip to content

Commit

Permalink
Implementing COMMAND DOCS (microsoft#678)
Browse files Browse the repository at this point in the history
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* WIP

* wip

* cleanup

* some small updates

* format

* Moved json resources to separate dll, loaded dynamically by garnet.server

* Added unloading of assembly once done

* format
  • Loading branch information
TalZaccai authored Oct 7, 2024
1 parent 41d77ba commit dd89054
Show file tree
Hide file tree
Showing 43 changed files with 9,318 additions and 2,190 deletions.
3 changes: 3 additions & 0 deletions Garnet.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<file src="libs\server\bin\Release\net8.0\Garnet.server.dll" target="lib\net8.0" />
<file src="libs\server\bin\Release\net8.0\Garnet.server.pdb" target="lib\net8.0" />
<file src="libs\server\bin\Release\net8.0\Garnet.server.xml" target="lib\net8.0" />
<file src="libs\resources\bin\Release\net8.0\Garnet.resources.dll" target="lib\net8.0" />
<file src="libs\resources\bin\Release\net8.0\Garnet.resources.pdb" target="lib\net8.0" />
<file src="libs\resources\bin\Release\net8.0\Garnet.resources.xml" target="lib\net8.0" />
<file src="libs\common\bin\Release\net8.0\Garnet.common.dll" target="lib\net8.0" />
<file src="libs\common\bin\Release\net8.0\Garnet.common.pdb" target="lib\net8.0" />
<file src="libs\common\bin\Release\net8.0\Garnet.common.xml" target="lib\net8.0" />
Expand Down
12 changes: 12 additions & 0 deletions Garnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleModule", "playground\SampleModule\SampleModule.csproj", "{A8CA619E-8F13-4EF8-943F-2D5E3FEBFB3F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GarnetJSON", "playground\GarnetJSON\GarnetJSON.csproj", "{2C8F1F5D-31E5-4D00-A46E-F3B1D9BC098F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MigrateBench", "playground\MigrateBench\MigrateBench.csproj", "{6B66B394-E410-4B61-9A5A-1595FF6F5E08}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hosting", "hosting", "{01823EA4-4446-4D66-B268-DFEE55951964}"
Expand All @@ -105,6 +106,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Windows", "Windows", "{6977
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Garnet.worker", "hosting\Windows\Garnet.worker\Garnet.worker.csproj", "{DF2DD03E-87EE-482A-9FBA-6C8FBC23BDC5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Garnet.resources", "libs\resources\Garnet.resources.csproj", "{A48412B4-FD60-467E-A5D9-F155CAB4F907}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -313,6 +316,14 @@ Global
{DF2DD03E-87EE-482A-9FBA-6C8FBC23BDC5}.Release|Any CPU.Build.0 = Release|Any CPU
{DF2DD03E-87EE-482A-9FBA-6C8FBC23BDC5}.Release|x64.ActiveCfg = Release|Any CPU
{DF2DD03E-87EE-482A-9FBA-6C8FBC23BDC5}.Release|x64.Build.0 = Release|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Debug|x64.ActiveCfg = Debug|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Debug|x64.Build.0 = Debug|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Release|Any CPU.Build.0 = Release|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Release|x64.ActiveCfg = Release|Any CPU
{A48412B4-FD60-467E-A5D9-F155CAB4F907}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -346,6 +357,7 @@ Global
{6B66B394-E410-4B61-9A5A-1595FF6F5E08} = {69A71E2C-00E3-42F3-854E-BE157A24834E}
{697766CD-2046-46D9-958A-0FD3B46C98D4} = {01823EA4-4446-4D66-B268-DFEE55951964}
{DF2DD03E-87EE-482A-9FBA-6C8FBC23BDC5} = {697766CD-2046-46D9-958A-0FD3B46C98D4}
{A48412B4-FD60-467E-A5D9-F155CAB4F907} = {147FCE31-EC09-4C90-8E4D-37CA87ED18C3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2C02C405-4798-41CA-AF98-61EDFEF6772E}
Expand Down
4 changes: 2 additions & 2 deletions libs/common/EnumUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public static bool TryParseEnumFromDescription<T>(string strVal, out T val) wher

private static void AddTypeToCache<T>()
{
var valToDesc = new Dictionary<string, string>();
var descToVals = new Dictionary<string, List<string>>();
var valToDesc = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
var descToVals = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);

foreach (var flagFieldInfo in typeof(T).GetFields())
{
Expand Down
7 changes: 5 additions & 2 deletions libs/common/StreamProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,22 @@ public class StreamProviderFactory
/// </summary>
/// <param name="locationType">Type of location of files the stream provider reads from / writes to</param>
/// <param name="connectionString">Connection string to Azure Storage, if applicable</param>
/// <param name="resourceAssembly">Assembly from which to load the embedded resource, if applicable</param>
/// <param name="resourceAssembly">Assembly from which to load the embedded resource, if applicable.</param>
/// <returns>StreamProvider instance</returns>
public static IStreamProvider GetStreamProvider(FileLocationType locationType, string connectionString = null, Assembly resourceAssembly = null)
{
switch (locationType)
{
case FileLocationType.AzureStorage:
if (string.IsNullOrEmpty(connectionString))
throw new ArgumentException("Azure Storage connection string is required to read/write settings to Azure Storage", nameof(connectionString));
throw new ArgumentException("Azure Storage connection string is required to read/write to Azure Storage", nameof(connectionString));
return new AzureStreamProvider(connectionString);
case FileLocationType.Local:
return new LocalFileStreamProvider();
case FileLocationType.EmbeddedResource:
if (resourceAssembly == null)
throw new ArgumentException(
"Assembly is required to read from embedded resource", nameof(resourceAssembly));
return new EmbeddedResourceStreamProvider(resourceAssembly);
default:
throw new NotImplementedException();
Expand Down
19 changes: 19 additions & 0 deletions libs/resources/Garnet.resources.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<None Remove="RespCommandsDocs.json" />
<None Remove="RespCommandsInfo.json" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="RespCommandsDocs.json" />
<EmbeddedResource Include="RespCommandsInfo.json" />
</ItemGroup>

</Project>
Loading

0 comments on commit dd89054

Please sign in to comment.