Changes
This commit is contained in:
@@ -5,7 +5,6 @@ using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
||||
{
|
||||
/// <summary>Shared bookkeeping of the audio processing activities.</summary>
|
||||
internal static class TrackAudioStatus
|
||||
{
|
||||
public static async Task<Track> LoadAsync(IDatabase database, Guid trackId, CancellationToken cancellationToken) =>
|
||||
|
||||
-4
@@ -8,7 +8,6 @@ using Musify.Infrastructure.MassTransit.Arguments;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit.Activities.LifeCycle
|
||||
{
|
||||
/// <summary>Sets the life-cycle status of an entity (removing, failed, ...). A missing entity is skipped.</summary>
|
||||
internal abstract class MarkLifeCycleActivity<TEntity>(IDatabase database, ILogger logger)
|
||||
: IExecuteActivity<MarkLifeCycleArguments>
|
||||
where TEntity : class, IHasLifeCycle
|
||||
@@ -33,7 +32,6 @@ namespace Musify.Infrastructure.MassTransit.Activities.LifeCycle
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Deletes an entity row. A missing entity is skipped.</summary>
|
||||
internal abstract class DeleteEntityActivity<TEntity>(IDatabase database, ILogger logger)
|
||||
: IExecuteActivity<DeleteEntityArguments>
|
||||
where TEntity : class, IHasLifeCycle
|
||||
@@ -58,8 +56,6 @@ namespace Musify.Infrastructure.MassTransit.Activities.LifeCycle
|
||||
}
|
||||
}
|
||||
|
||||
// One concrete activity per entity keeps a separate queue for each of them:
|
||||
// the endpoint name is the kebab-cased class name.
|
||||
internal sealed class MarkTrackLifeCycleActivity(IDatabase database, ILogger<MarkTrackLifeCycleActivity> logger)
|
||||
: MarkLifeCycleActivity<Track>(database, logger)
|
||||
{
|
||||
|
||||
-2
@@ -12,7 +12,6 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
|
||||
{
|
||||
internal sealed record PictureNames(string? Original, string? Small, string? Medium, string? Large);
|
||||
|
||||
/// <summary>Stores the processed picture names on the owner and reports it; compensation restores the previous names.</summary>
|
||||
internal abstract class UpdatePicturesActivity<TEntity>(
|
||||
IDatabase database,
|
||||
IPublishEndpoint publishEndpoint,
|
||||
@@ -24,7 +23,6 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
|
||||
|
||||
protected abstract Task<TEntity?> FindAsync(Guid id, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>Reads the current names; throws when the entity has no pending picture.</summary>
|
||||
protected abstract PictureNames Read(TEntity entity);
|
||||
|
||||
protected abstract void Write(TEntity entity, PictureNames names, bool succeeded);
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Musify.Infrastructure.MassTransit.Consumers
|
||||
{
|
||||
internal static class ProcessingFailedCleanup
|
||||
{
|
||||
/// <summary>Removes whatever files were left behind and marks the entity as failed.</summary>
|
||||
public static Task ExecuteAsync(
|
||||
IBus bus,
|
||||
Guid subjectId,
|
||||
|
||||
-2
@@ -8,7 +8,6 @@ using Musify.Infrastructure.MassTransit.Arguments;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
||||
{
|
||||
/// <summary>Marks an entity as removing, deletes its files from the bucket and finally deletes its row.</summary>
|
||||
public class DeleteRoutingSlipBuilder(
|
||||
IDatabase database,
|
||||
TrackConfiguration trackConfiguration,
|
||||
@@ -48,7 +47,6 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
||||
routes.BuildOriginalPicturePath(userId, track.Pictures.OriginalName));
|
||||
}
|
||||
|
||||
// Unprocessed tracks still point at the shared preset pictures, which must never be deleted.
|
||||
if (track.Pictures.IsProcessed)
|
||||
{
|
||||
builder.AddRemoveFile(ActivityNames.RemoveTrackSmallPicture, bucket, routes.BuildPicturePath(PictureSize.Small, track.Pictures.SmallName));
|
||||
|
||||
-4
@@ -8,10 +8,6 @@ using Musify.Infrastructure.MassTransit.Arguments;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
||||
{
|
||||
/// <summary>
|
||||
/// Moves an uploaded album/playlist picture to its final key, consumes the upload intent and hands over to the picture workflow.
|
||||
/// Creation faults mark the whole entity as failed; update faults only report the picture as failed.
|
||||
/// </summary>
|
||||
public class PictureSourceRoutingSlipBuilder
|
||||
{
|
||||
public RoutingSlipBuilder Build(CreateAlbumResourcesEvent message, Guid? correlationId) =>
|
||||
|
||||
-1
@@ -8,7 +8,6 @@ using Musify.Infrastructure.MassTransit.Arguments;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
||||
{
|
||||
/// <summary>Downloads a picture, resizes it to the three sizes, uploads them and records the result on the owner.</summary>
|
||||
public class PictureWorkflowRoutingSlipBuilder(WorkerConfiguration workerConfiguration)
|
||||
{
|
||||
public RoutingSlipBuilder Build(UpdateTrackPictureEvent message, Guid? correlationId) =>
|
||||
|
||||
@@ -6,14 +6,12 @@ using Musify.Infrastructure.MassTransit.Consumers;
|
||||
|
||||
namespace Musify.Infrastructure.MassTransit.RoutingSlip
|
||||
{
|
||||
/// <summary>Shared building blocks for every routing slip in the worker.</summary>
|
||||
internal static class RoutingSlips
|
||||
{
|
||||
public static Uri ExecuteUri(string endpointName) => new($"queue:{endpointName}_execute");
|
||||
|
||||
public static Uri ConsumerUri(string queueName) => new($"queue:{queueName}");
|
||||
|
||||
/// <summary>A new slip that carries the correlation id and always cleans its temporary directory up.</summary>
|
||||
public static RoutingSlipBuilder Create(Guid? correlationId)
|
||||
{
|
||||
var builder = new RoutingSlipBuilder(NewId.NextGuid());
|
||||
@@ -32,7 +30,6 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>Publishes a failure event for the subject when the slip faults.</summary>
|
||||
public static RoutingSlipBuilder TrackFaults(
|
||||
this RoutingSlipBuilder builder, Guid subjectId, string processKind)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user