Skip to content

Commit

Permalink
Revert "feat(*): upgrade all deps libraries (#24)"
Browse files Browse the repository at this point in the history
This reverts commit f4264f4.
  • Loading branch information
jonathansant committed Feb 2, 2024
1 parent f4264f4 commit 91cbf5e
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 136 deletions.
10 changes: 5 additions & 5 deletions DeflateCompressionTest/DeflateCompressionTest.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<!-- Shared Package Versions -->
Expand Down
7 changes: 0 additions & 7 deletions NuGet.Config

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator.MSBuild" Version="3.7.1">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator.MSBuild" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand All @@ -18,9 +18,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Orleans.Core" Version="3.7.1" />
<PackageReference Include="Microsoft.Orleans.OrleansProviders" Version="3.7.1" />
<PackageReference Include="Microsoft.Orleans.TestingHost" Version="3.7.1" />
<PackageReference Include="Microsoft.Orleans.Core" Version="3.2.0" />
<PackageReference Include="Microsoft.Orleans.OrleansProviders" Version="3.2.0" />
<PackageReference Include="Microsoft.Orleans.TestingHost" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public RedisOrleansSerializerCompressedSegmentedTest(ITestOutputHelper output) :

[Fact]
public async Task Test()
=> await PerformTest("SerializerCompressedSegmentedTest");
{
await PerformTest("SerializerCompressedSegmentedTest");
}
}

public class SiloBuilderConfiguratorOrleansSerializerDeflateCompressionSegmentedTest : RedisSegmentTests<SiloConfigurator.SiloBuilderConfiguratorOrleansSerializerDeflateCompressionSegmented>
Expand Down
11 changes: 6 additions & 5 deletions Orleans.Persistence.Redis.E2E/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ public Task DisposeAsync()

protected static async Task FlushDb()
{
await using var connection = await ConnectAsync(new ConfigurationOptions
using (var connection = await ConnectAsync(new ConfigurationOptions
{
EndPoints = { "localhost" },
AllowAdmin = true
});

var server = connection.GetServer("localhost:6379");
await server.FlushAllDatabasesAsync();
}))
{
var server = connection.GetServer("localhost:6379");
await server.FlushAllDatabasesAsync();
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Orleans.Persistence.Redis/Compression/BrotliCompression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public byte[] Decompress(byte[] bytes)
{
using var memoryStream = new MemoryStream(bytes);
using var outputStream = new MemoryStream();
using (var decompressStream = new BrotliStream(memoryStream, CompressionMode.Decompress))
using (var decompressStream = new Brotli.BrotliStream(memoryStream, CompressionMode.Decompress))
{
decompressStream.CopyTo(outputStream);
}
Expand All @@ -20,7 +20,7 @@ public byte[] Decompress(byte[] bytes)
public byte[] Compress(byte[] bytes)
{
using var memoryStream = new MemoryStream();
using (var brotliStream = new BrotliStream(memoryStream, CompressionMode.Compress))
using (var brotliStream = new Brotli.BrotliStream(memoryStream, CompressionMode.Compress))
{
brotliStream.Write(bytes, 0, bytes.Length);
}
Expand Down
93 changes: 8 additions & 85 deletions Orleans.Persistence.Redis/Config/RedisSiloHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
using Orleans.Persistence.Redis.Core;
using Orleans.Persistence.Redis.Serialization;
using Orleans.Providers;
using Orleans.Runtime;
using Orleans.Serialization;
using Orleans.Storage;
using System;
using Orleans.Runtime;
using JsonSerializer = Orleans.Persistence.Redis.Serialization.JsonSerializer;
using OrleansSerializer = Orleans.Persistence.Redis.Serialization.OrleansSerializer;

Expand Down Expand Up @@ -103,86 +102,10 @@ Func<IServiceProvider, object[]> cfg

private static IGrainStorage CreateRedisStorage(IServiceProvider services, string name)
{
public static RedisStorageSiloHostBuilderOptionsBuilder AddRedisGrainStorage(
this ISiloHostBuilder builder,
string name
) => new RedisStorageSiloHostBuilderOptionsBuilder(builder, name);

public static RedisStorageSiloHostBuilderOptionsBuilder AddRedisGrainStorageAsDefault(
this ISiloHostBuilder builder
) => builder.AddRedisGrainStorage("Default");

internal static IServiceCollection AddRedisGrainStorage(
this IServiceCollection services,
string name,
Action<OptionsBuilder<RedisStorageOptions>> configureOptions = null
)
{
configureOptions?.Invoke(services.AddOptions<RedisStorageOptions>(name));
// services.AddTransient<IConfigurationValidator>(sp => new DynamoDBGrainStorageOptionsValidator(sp.GetService<IOptionsSnapshot<RedisStorageOptions>>().Get(name), name));
services.AddSingletonNamedService(name, CreateStateStore);
services.ConfigureNamedOptionForLogging<RedisStorageOptions>(name);
services.TryAddSingleton(sp =>
sp.GetServiceByName<IGrainStorage>(ProviderConstants.DEFAULT_STORAGE_PROVIDER_NAME));

return services
.AddSingletonNamedService(name, CreateDbConnection)
.AddSingletonNamedService(name, CreateRedisStorage)
.AddSingletonNamedService(name, (provider, n)
=> (ILifecycleParticipant<ISiloLifecycle>)provider.GetRequiredServiceByName<IGrainStorage>(n));
}

internal static ISiloHostBuilder AddRedisDefaultSerializer(this ISiloHostBuilder builder, string name)
=> builder.AddRedisSerializer<OrleansSerializer>(name);

internal static ISiloHostBuilder AddRedisDefaultBrotliSerializer(this ISiloHostBuilder builder, string name)
=> builder.AddRedisSerializer<BrotliSerializer>(name);

internal static ISiloHostBuilder AddRedisDefaultHumanReadableSerializer(this ISiloHostBuilder builder,
string name)
=> builder.AddRedisHumanReadableSerializer<JsonSerializer>(
name,
provider => new object[] { RedisDefaultJsonSerializerSettings.Get(provider) });

internal static ISiloHostBuilder AddRedisSerializer<TSerializer>(this ISiloHostBuilder builder, string name,
params object[] settings)
where TSerializer : ISerializer
=> builder.ConfigureServices(services =>
services.AddSingletonNamedService<ISerializer>(name, (provider, n)
=> ActivatorUtilities.CreateInstance<TSerializer>(provider, settings))
);

internal static ISiloHostBuilder AddRedisHumanReadableSerializer<TSerializer>(this ISiloHostBuilder builder,
string name, params object[] settings)
where TSerializer : IHumanReadableSerializer
=> builder.ConfigureServices(services =>
services.AddSingletonNamedService<IHumanReadableSerializer>(name, (provider, n)
=> ActivatorUtilities.CreateInstance<TSerializer>(provider, settings))
);

internal static ISiloHostBuilder AddRedisHumanReadableSerializer<TSerializer>(
this ISiloHostBuilder builder,
string name,
Func<IServiceProvider, object[]> cfg
) where TSerializer : IHumanReadableSerializer
=> builder.ConfigureServices(services =>
services.AddSingletonNamedService<IHumanReadableSerializer>(name, (provider, n)
=> ActivatorUtilities.CreateInstance<TSerializer>(provider, cfg?.Invoke(provider)))
);

internal static ISiloHostBuilder AddCompression<TCompression>(this ISiloHostBuilder builder, string name)
where TCompression : ICompression =>
builder.ConfigureServices(services =>
services.AddSingletonNamedService<ICompression>(name, (provider, n)
=> ActivatorUtilities.CreateInstance<TCompression>(provider)));

private static IGrainStorage CreateRedisStorage(IServiceProvider services, string name)
{
var store = services.GetRequiredServiceByName<IGrainStateStore>(name);
var connection = services.GetRequiredServiceByName<DbConnection>(name);
return ActivatorUtilities.CreateInstance<RedisGrainStorage>(services, name, store, connection);
}
}
var store = services.GetRequiredServiceByName<IGrainStateStore>(name);
var connection = services.GetRequiredServiceByName<DbConnection>(name);
return ActivatorUtilities.CreateInstance<RedisGrainStorage>(services, name, store, connection);
}

private static IGrainStateStore CreateStateStore(IServiceProvider provider, string name)
{
Expand All @@ -192,16 +115,16 @@ private static IGrainStateStore CreateStateStore(IServiceProvider provider, stri
var options = provider.GetRequiredService<IOptionsSnapshot<RedisStorageOptions>>();
var logger = provider.GetRequiredService<ILogger<GrainStateStore>>();

return ActivatorUtilities.CreateInstance<GrainStateStore>(
provider,
return ActivatorUtilities.CreateInstance<GrainStateStore>(
provider,
name,
connection,
options.Get(name),
serializer,
humanReadableSerializer,
logger,
provider
);
);
}

private static DbConnection CreateDbConnection(IServiceProvider provider, string name)
Expand Down
3 changes: 1 addition & 2 deletions Orleans.Persistence.Redis/Core/GrainStateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Orleans.Runtime;

namespace Orleans.Persistence.Redis.Core
{
Expand All @@ -22,7 +21,7 @@ internal class Segments
public int NoOfSegments { get; set; }
}

public class GrainStateStore : IGrainStateStore
internal class GrainStateStore : IGrainStateStore
{
private readonly DbConnection _connection;
private readonly ISerializer _serializer;
Expand Down
13 changes: 6 additions & 7 deletions Orleans.Persistence.Redis/Orleans.Persistence.Redis.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Sucrose.Orleans.Persistence.Redis</PackageId>
<Product>Sucrose.Orleans.Persistence.Redis</Product>
<RepositoryUrl>https://github.com/jonathansant/Orleans.Persistence.Redis</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<!--<PackageReference Include="Brotli.NET" Version="2.1.1" />-->
<PackageReference Include="MessagePack" Version="2.5.140" />
<PackageReference Include="Microsoft.Orleans.OrleansProviders" Version="3.7.1" />
<PackageReference Include="StackExchange.Redis" Version="2.7.17" />
<PackageReference Include="Brotli.NET" Version="2.1.1" />
<PackageReference Include="MessagePack" Version="2.1.143" />
<PackageReference Include="Microsoft.Orleans.OrleansProviders" Version="3.2.0" />
<PackageReference Include="StackExchange.Redis" Version="2.2.62" />
<PackageReference Include="System.Data.HashFunction.xxHash" Version="2.0.0" />
<PackageReference Include="ByteSize" Version="2.1.2" />
<!--<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />-->
<PackageReference Include="ByteSize" Version="2.0.0" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion Orleans.Persistence.Redis/Serialization/BrotliSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Orleans.Serialization;
using Brotli;
using Orleans.Serialization;
using System;
using System.IO;
using System.IO.Compression;
Expand Down
4 changes: 2 additions & 2 deletions Samples/RedisApp/RedisApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="2.7.17" />
<PackageReference Include="StackExchange.Redis" Version="2.1.58" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions Samples/TestClient/TestClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Orleans.Client" Version="3.7.1" />
<PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="3.7.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.5" />
<PackageReference Include="Microsoft.Orleans.Client" Version="3.2.0" />
<PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions Samples/TestGrains/TestGrains.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="3.7.1" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator.MSBuild" Version="3.7.1" PrivateAssets="all">
<PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="3.2.0" />
<PackageReference Include="Microsoft.Orleans.OrleansCodeGenerator.Build" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Samples/TestSilo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Orleans;
using Orleans.Configuration;
using Orleans.Hosting;
using Orleans.Persistence.Redis.Config;
using System;
using System.Net;
using System.Reflection;
Expand Down
8 changes: 4 additions & 4 deletions Samples/TestSilo/TestSilo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="3.7.1" />
<PackageReference Include="Microsoft.Orleans.Server" Version="3.7.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.5" />
<PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="3.2.0" />
<PackageReference Include="Microsoft.Orleans.Server" Version="3.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 91cbf5e

Please sign in to comment.