Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/Paramore.Brighter.DynamoDb/DynamoDbTableBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public async Task EnsureTablesReady(IEnumerable<string> tableNames, TableStatus

return tableCheck.Any(kv => kv.Value) ?
(true, tableCheck.Where(tbl => tbl.Value).Select(tbl => tbl.Key)) :
(false, Enumerable.Empty<string>());
(false, []);

}

Expand Down Expand Up @@ -197,12 +197,10 @@ private static bool AddKeyUsedFields(CreateTableRequest tableRequest, AttributeD
return false;
}

private class DynamoDbTableStatus
private sealed class DynamoDbTableStatus
{
public string TableName { get; set; }
public string TableName { get; init; }
public bool IsReady { get; set; }
}

}
}

4 changes: 1 addition & 3 deletions src/Paramore.Brighter.DynamoDb/DynamoDbTableFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ THE SOFTWARE. */
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DataModel;
using Amazon.DynamoDBv2.Model;
Expand Down Expand Up @@ -401,7 +399,7 @@ private ScalarAttributeType GetDynamoDbType(Type propertyType, bool hasConverter
throw new NotSupportedException($"We can't convert {propertyType.Name} to a DynamoDb type. Avoid marking as an attribute and see if the lib can figure it out");
}

private class GlobalSecondaryIndexDetails
private sealed class GlobalSecondaryIndexDetails
{
public PropertyInfo Prop { get; set; }
public CustomAttributeData Attribute { get; set; }
Expand Down
24 changes: 9 additions & 15 deletions src/Paramore.Brighter.Inbox.DynamoDB/KeyIdContextExpression.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
using System;
using System.Collections.Generic;
using Amazon.DynamoDBv2.DocumentModel;

namespace Paramore.Brighter.Inbox.DynamoDB
{
internal class KeyIdContextExpression
internal sealed class KeyIdContextExpression
{
private Expression _expression;

public KeyIdContextExpression()
private readonly Expression _expression = new()
{
_expression = new Expression();
_expression.ExpressionStatement = "CommandId = :v_CommandId and ContextKey = :v_ContextKey";
}
ExpressionStatement = "CommandId = :v_CommandId and ContextKey = :v_ContextKey"
};

public Expression Generate(string id, string contextKey)
{
var values = new Dictionary<string, DynamoDBEntry>();
values.Add(":v_CommandId", id);
values.Add(":v_ContextKey", contextKey);

_expression.ExpressionAttributeValues = values;
_expression.ExpressionAttributeValues = new Dictionary<string, DynamoDBEntry>(capacity: 2)
{
{ ":v_CommandId", id },
{ ":v_ContextKey", contextKey }
};

return _expression;

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace Paramore.Brighter.MessagingGateway.AWSSQS
/// Class HeaderResult.
/// </summary>
/// <typeparam name="TResult">The type of the t result.</typeparam>
internal class HeaderResult<TResult>
internal sealed class HeaderResult<TResult>
{
/// <summary>
/// Initializes a new instance of the <see cref="HeaderResult{TResult}"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.AWSSQS;

internal class SqsInlineMessageCreator : SqsMessageCreatorBase, ISqsMessageCreator
internal sealed class SqsInlineMessageCreator : SqsMessageCreatorBase, ISqsMessageCreator
{
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<SqsInlineMessageCreator>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal enum ARNAmazonSNS
SubscriptionId = 6
}

internal class SqsMessageCreator : SqsMessageCreatorBase, ISqsMessageCreator
internal sealed class SqsMessageCreator : SqsMessageCreatorBase, ISqsMessageCreator
{
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<SqsMessageCreator>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.AWSSQS
{
internal class SqsMessageCreatorFactory
internal sealed class SqsMessageCreatorFactory
{
public static ISqsMessageCreator Create(bool rawMessageDelivery)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace Paramore.Brighter.MessagingGateway.AWSSQS
/// <summary>
/// The <see cref="ValidateTopicByName"/> class is responsible for validating an AWS SNS topic by its name.
/// </summary>
internal class ValidateTopicByName : IValidateTopic
internal sealed class ValidateTopicByName : IValidateTopic
{
private readonly AmazonSimpleNotificationServiceClient _snsClient;
private readonly SnsSqsType _type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Paramore.Brighter.MessagingGateway.AzureServiceBus.AzureServiceBusWrappers
{
internal class BrokeredMessageWrapper : IBrokeredMessageWrapper
internal sealed class BrokeredMessageWrapper : IBrokeredMessageWrapper
{
private readonly ServiceBusReceivedMessage _brokeredMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.AzureServiceBus.AzureServiceBusWrappers
{
internal class ServiceBusReceiverProvider(IServiceBusClientProvider clientProvider) : IServiceBusReceiverProvider
internal sealed class ServiceBusReceiverProvider(IServiceBusClientProvider clientProvider) : IServiceBusReceiverProvider
{
private readonly ServiceBusClient _client = clientProvider.GetServiceBusClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Paramore.Brighter.MessagingGateway.AzureServiceBus.AzureServiceBusWrap
/// <summary>
/// Wraps the <see cref="ServiceBusReceiver"/> to provide additional functionality.
/// </summary>
internal class ServiceBusReceiverWrapper : IServiceBusReceiverWrapper
internal sealed class ServiceBusReceiverWrapper : IServiceBusReceiverWrapper
{
private readonly ServiceBusReceiver _messageReceiver;
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<ServiceBusReceiverWrapper>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Paramore.Brighter.MessagingGateway.AzureServiceBus.AzureServiceBusWrappers
{
internal class ServiceBusSenderProvider : IServiceBusSenderProvider
internal sealed class ServiceBusSenderProvider : IServiceBusSenderProvider
{
private readonly ServiceBusClient _client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Paramore.Brighter.MessagingGateway.AzureServiceBus.AzureServiceBusWrappers
{
internal class ServiceBusSenderWrapper : IServiceBusSenderWrapper
internal sealed class ServiceBusSenderWrapper : IServiceBusSenderWrapper
{
private readonly ServiceBusSender _serviceBusSender;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Paramore.Brighter.MessagingGateway.Kafka
/// what do we need to know to process a message
/// </summary>
/// <typeparam name="TResult">The type of the t result.</typeparam>
internal class HeaderResult<TResult>
internal sealed class HeaderResult<TResult>
{
/// <summary>
/// Initializes a new instance of the <see cref="HeaderResult{TResult}"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.Kafka
{
internal class KafkaMessagePublisher
internal sealed class KafkaMessagePublisher
{
private readonly IProducer<string, byte[]> _producer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Paramore.Brighter.MessagingGateway.RMQ.Async
/// Class HeaderResult.
/// </summary>
/// <typeparam name="TResult">The type of the t result.</typeparam>
internal class HeaderResult<TResult>
internal sealed class HeaderResult<TResult>
{
/// <summary>
/// Initializes a new instance of the <see cref="HeaderResult{TResult}"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.RMQ.Async;

internal class RmqMessageCreator
internal sealed class RmqMessageCreator
{
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<RmqMessageCreator>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ private static string GetConnectionId(ConnectionFactory connectionFactory)
$"{connectionFactory.UserName}.{connectionFactory.Password}.{connectionFactory.HostName}.{connectionFactory.Port}.{connectionFactory.VirtualHost}"
.ToLowerInvariant();

private record PooledConnection(IConnection Connection, AsyncEventHandler<ShutdownEventArgs> ShutdownHandler);
private sealed record PooledConnection(IConnection Connection, AsyncEventHandler<ShutdownEventArgs> ShutdownHandler);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Paramore.Brighter.MessagingGateway.RMQ.Async;
/// <summary>
/// Class RmqMessagePublisher.
/// </summary>
internal class RmqMessagePublisher
internal sealed class RmqMessagePublisher
{
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<RmqMessagePublisher>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Paramore.Brighter.MessagingGateway.RMQ.Sync
/// Class HeaderResult.
/// </summary>
/// <typeparam name="TResult">The type of the t result.</typeparam>
internal class HeaderResult<TResult>
internal sealed class HeaderResult<TResult>
{
/// <summary>
/// Initializes a new instance of the <see cref="HeaderResult{TResult}"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.RMQ.Sync
{
internal class RmqMessageCreator
internal sealed class RmqMessageCreator
{
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<RmqMessageCreator>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private static void DelayReconnecting()
}


class PooledConnection
sealed class PooledConnection
{
public IConnection? Connection { get; set; }
public EventHandler<ShutdownEventArgs>? ShutdownHandler { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Paramore.Brighter.MessagingGateway.RMQ.Sync
/// <summary>
/// Class RmqMessagePublisher.
/// </summary>
internal class RmqMessagePublisher
internal sealed class RmqMessagePublisher
{
private static readonly ILogger s_logger = ApplicationLogging.CreateLogger<RmqMessagePublisher>();
private static readonly string[] _headersToReset =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.MessagingGateway.Redis
{
internal class HeaderNames
internal static class HeaderNames
{
/// <summary>
/// The bag for user defined contents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Paramore.Brighter.Outbox.DynamoDB
{
internal class BrighterDynamoDBFilter
internal sealed class BrighterDynamoDBFilter
{
public QueryOperator Operator { get; }
public IEnumerable<string> Values { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.Outbox.DynamoDB;

internal class DispatchedAllTopicsQueryContext
internal sealed class DispatchedAllTopicsQueryContext
{
public int NextPage { get; private set; }
public string LastEvaluatedKey { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.Outbox.DynamoDB;

internal class DispatchedMessagesQueryResult
internal sealed class DispatchedMessagesQueryResult
{
public IEnumerable<MessageItem> Messages { get; private set; }
public string PaginationToken { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.Outbox.DynamoDB;

internal class DispatchedTopicQueryContext
internal sealed class DispatchedTopicQueryContext
{
public int NextPage { get; private set; }
public string LastEvaluatedKey { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

namespace Paramore.Brighter.Outbox.DynamoDB
{
internal class KeyTopicDeliveredTimeExpression
internal sealed class KeyTopicDeliveredTimeExpression
{
private readonly Expression _expression;

public KeyTopicDeliveredTimeExpression()
private readonly Expression _expression = new()
{
_expression = new Expression { ExpressionStatement = "Topic = :v_Topic and DeliveryTime < :v_SinceTime" };
}
ExpressionStatement = "Topic = :v_Topic and DeliveryTime < :v_SinceTime"
};

public override string ToString()
{
Expand All @@ -20,11 +18,11 @@ public override string ToString()

public Expression Generate(string topicName, DateTimeOffset sinceTime)
{
var values = new Dictionary<string, DynamoDBEntry>();
values.Add(":v_Topic", topicName);
values.Add(":v_SinceTime", sinceTime.Ticks);

_expression.ExpressionAttributeValues = values;
_expression.ExpressionAttributeValues = new Dictionary<string, DynamoDBEntry>(capacity: 2)
{
{ ":v_Topic", topicName },
{ ":v_SinceTime", sinceTime.Ticks }
};

return _expression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

namespace Paramore.Brighter.Outbox.DynamoDB
{
internal class KeyTopicOutstandingCreatedTimeExpression
internal sealed class KeyTopicOutstandingCreatedTimeExpression
{
private readonly Expression _expression;

public KeyTopicOutstandingCreatedTimeExpression()
private readonly Expression _expression = new()
{
_expression = new Expression { ExpressionStatement = "TopicShard = :v_TopicShard and OutstandingCreatedTime < :v_OutstandingCreatedTime" };
}
ExpressionStatement = "TopicShard = :v_TopicShard and OutstandingCreatedTime < :v_OutstandingCreatedTime"
};

public override string ToString()
{
Expand All @@ -20,11 +18,11 @@ public override string ToString()

public Expression Generate(string topicName, DateTimeOffset createdTime, int shard)
{
var values = new Dictionary<string, DynamoDBEntry>();
values.Add(":v_TopicShard", $"{topicName}_{shard}");
values.Add(":v_OutstandingCreatedTime", createdTime.Ticks);

_expression.ExpressionAttributeValues = values;
_expression.ExpressionAttributeValues = new Dictionary<string, DynamoDBEntry>(capacity: 2)
{
{ ":v_TopicShard", $"{topicName}_{shard}" },
{ ":v_OutstandingCreatedTime", createdTime.Ticks }
};

return _expression;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.Outbox.DynamoDB;

internal class OutstandingAllTopicsQueryContext
internal sealed class OutstandingAllTopicsQueryContext
{
public int NextPage { get; private set; }
public string LastEvaluatedKey { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE. */

namespace Paramore.Brighter.Outbox.DynamoDB;

internal class OutstandingMessagesQueryResult
internal sealed class OutstandingMessagesQueryResult
{
public IEnumerable<MessageItem> Messages { get; private set; }
public int ShardNumber { get; private set; }
Expand Down
Loading