Merge pull request #6554 from elsa-workflows/rc/36595_compression

Moved compression to separate feature
This commit is contained in:
raymonddenhaan 2025-04-03 16:12:52 +02:00 committed by GitHub
commit d1cee77fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 37 additions and 18 deletions

View file

@ -2,6 +2,7 @@ using System.Text.Encodings.Web;
using Elsa.Alterations.Extensions;
using Elsa.Alterations.MassTransit.Extensions;
using Elsa.Caching.Options;
using Elsa.Common.Codecs;
using Elsa.Common.DistributedHosting.DistributedLocks;
using Elsa.Common.RecurringTasks;
using Elsa.Common.Serialization;
@ -51,7 +52,6 @@ using Elsa.Workflows.CommitStates.Strategies;
using Elsa.Workflows.IncidentStrategies;
using Elsa.Workflows.LogPersistence;
using Elsa.Workflows.Management;
using Elsa.Workflows.Management.Compression;
using Elsa.Workflows.Management.Stores;
using Elsa.Workflows.Memory;
using Elsa.Workflows.Options;

View file

@ -1,7 +1,7 @@
using System.IO.Compression;
using System.Text;
namespace Elsa.Workflows.Management.Compression;
namespace Elsa.Common.Codecs;
/// <summary>
/// Represents a GZip compression strategy.

View file

@ -1,4 +1,4 @@
namespace Elsa.Workflows.Management.Compression;
namespace Elsa.Common.Codecs;
/// <summary>
/// Represents a compression strategy that does not compress or decompress the input.

View file

@ -1,7 +1,7 @@
using System.Text;
using IronCompress;
namespace Elsa.Workflows.Management.Compression;
namespace Elsa.Common.Codecs;
/// <summary>
/// Represents a ZSTD compression strategy.

View file

@ -1,4 +1,4 @@
namespace Elsa.Workflows.Management;
namespace Elsa.Common;
/// <summary>
/// Represents a compression strategy.

View file

@ -1,4 +1,4 @@
namespace Elsa.Workflows.Management;
namespace Elsa.Common;
/// <summary>
/// Resolves a <see cref="ICompressionCodec"/> from its name.

View file

@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="Cronos" />
<PackageReference Include="DistributedLock.Core" />
<PackageReference Include="IronCompress" />
<PackageReference Include="LinqKit.Core" />
<PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />

View file

@ -0,0 +1,21 @@
using Elsa.Common.Codecs;
using Elsa.Common.Services;
using Elsa.Features.Abstractions;
using Elsa.Features.Services;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Common.Features;
[UsedImplicitly]
public class CompressionFeature(IModule module) : FeatureBase(module)
{
public override void Apply()
{
Services
.AddSingleton<ICompressionCodecResolver, CompressionCodecResolver>()
.AddSingleton<ICompressionCodec, None>()
.AddSingleton<ICompressionCodec, GZip>()
.AddSingleton<ICompressionCodec, Zstd>();
}
}

View file

@ -1,6 +1,6 @@
using Elsa.Workflows.Management.Compression;
using Elsa.Common.Codecs;
namespace Elsa.Workflows.Management.Services;
namespace Elsa.Common.Services;
/// <inheritdoc />
public class CompressionCodecResolver : ICompressionCodecResolver

View file

@ -1,10 +1,11 @@
using System.Diagnostics.CodeAnalysis;
using Elsa.Common;
using Elsa.Common.Codecs;
using Elsa.Common.Entities;
using Elsa.Common.Models;
using Elsa.Extensions;
using Elsa.Workflows;
using Elsa.Workflows.Management;
using Elsa.Workflows.Management.Compression;
using Elsa.Workflows.Management.Entities;
using Elsa.Workflows.Management.Filters;
using Elsa.Workflows.Management.Models;

View file

@ -1,9 +1,9 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using Elsa.Common;
using Elsa.Common.Codecs;
using Elsa.Extensions;
using Elsa.Workflows;
using Elsa.Workflows.Management;
using Elsa.Workflows.Management.Compression;
using Elsa.Workflows.Management.Options;
using Elsa.Workflows.Runtime;
using Elsa.Workflows.Runtime.Entities;

View file

@ -5,6 +5,7 @@ using System.Reflection;
using System.Text.Json;
using System.Text.Json.Nodes;
using Elsa.Caching.Features;
using Elsa.Common.Codecs;
using Elsa.Common.Features;
using Elsa.Expressions.Contracts;
using Elsa.Extensions;
@ -14,10 +15,8 @@ using Elsa.Features.Services;
using Elsa.Workflows.Features;
using Elsa.Workflows.LogPersistence;
using Elsa.Workflows.Management.Activities.WorkflowDefinitionActivity;
using Elsa.Workflows.Management.Compression;
using Elsa.Workflows.Management.Contracts;
using Elsa.Workflows.Management.Entities;
using Elsa.Workflows.Management.Handlers;
using Elsa.Workflows.Management.Handlers.Notifications;
using Elsa.Workflows.Management.Mappers;
using Elsa.Workflows.Management.Materializers;
@ -35,9 +34,10 @@ namespace Elsa.Workflows.Management.Features;
/// <summary>
/// Installs and configures the workflow management feature.
/// </summary>
[DependsOn(typeof(CompressionFeature))]
[DependsOn(typeof(MediatorFeature))]
[DependsOn(typeof(SystemClockFeature))]
[DependsOn(typeof(MemoryCacheFeature))]
[DependsOn(typeof(SystemClockFeature))]
[DependsOn(typeof(WorkflowsFeature))]
[DependsOn(typeof(WorkflowDefinitionsFeature))]
[DependsOn(typeof(WorkflowInstancesFeature))]
@ -234,10 +234,6 @@ public class WorkflowManagementFeature(IModule module) : FeatureBase(module)
.AddScoped<WorkflowDefinitionMapper>()
.AddSingleton<VariableDefinitionMapper>()
.AddSingleton<WorkflowStateMapper>()
.AddSingleton<ICompressionCodecResolver, CompressionCodecResolver>()
.AddSingleton<ICompressionCodec, None>()
.AddSingleton<ICompressionCodec, GZip>()
.AddSingleton<ICompressionCodec, Zstd>()
;
Services