From 4b5e632d9cc109e0b1c566199ee2baef6bb0309a Mon Sep 17 00:00:00 2001 From: Hayley Campbell Date: Fri, 11 Feb 2022 15:02:38 +0100 Subject: [PATCH] Align persistent subscription names with RFC - Rename `MaxCheckpointCount` to `CheckPointUpperBound` - Rename `MinCheckpointCount` to `CheckPointLowerBound` - Rename `NamedConsumerStrategy` to `ConsumerStrategyName` --- samples/persistent-subscriptions/Program.cs | 2 +- ...orePersistentSubscriptionsClient.Create.cs | 6 ++--- ...orePersistentSubscriptionsClient.Update.cs | 6 ++--- .../PersistentSubscriptionSettings.cs | 24 +++++++++---------- .../update_existing_with_check_point.cs | 2 +- ...date_existing_with_check_point_filtered.cs | 2 +- .../when_writing_and_filtering_out_events.cs | 2 +- .../update_existing_with_check_point.cs | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/samples/persistent-subscriptions/Program.cs b/samples/persistent-subscriptions/Program.cs index d3562d41f..0b62e2eef 100644 --- a/samples/persistent-subscriptions/Program.cs +++ b/samples/persistent-subscriptions/Program.cs @@ -95,7 +95,7 @@ static async Task UpdatePersistentSubscription(EventStorePersistentSubscriptions var userCredentials = new UserCredentials("admin", "changeit"); var settings = new PersistentSubscriptionSettings( resolveLinkTos: true, - minCheckPointCount: 20); + checkPointLowerBound: 20); await client.UpdateAsync( "test-stream", diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs b/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs index 420905fbc..b0e746383 100644 --- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs +++ b/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Create.cs @@ -206,11 +206,11 @@ private async Task CreateInternalAsync(string streamName, string groupName, IEve ResolveLinks = settings.ResolveLinkTos, HistoryBufferSize = settings.HistoryBufferSize, LiveBufferSize = settings.LiveBufferSize, - MaxCheckpointCount = settings.MaxCheckPointCount, + MaxCheckpointCount = settings.CheckPointUpperBound, MaxRetryCount = settings.MaxRetryCount, MaxSubscriberCount = settings.MaxSubscriberCount, - MinCheckpointCount = settings.MinCheckPointCount, - NamedConsumerStrategy = NamedConsumerStrategyToCreateProto[settings.NamedConsumerStrategy], + MinCheckpointCount = settings.CheckPointLowerBound, + NamedConsumerStrategy = NamedConsumerStrategyToCreateProto[settings.ConsumerStrategyName], ReadBatchSize = settings.ReadBatchSize } } diff --git a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs b/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs index 7d47d3236..6f51cd513 100644 --- a/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs +++ b/src/EventStore.Client.PersistentSubscriptions/EventStorePersistentSubscriptionsClient.Update.cs @@ -131,12 +131,12 @@ public async Task UpdateAsync(string streamName, string groupName, PersistentSub ResolveLinks = settings.ResolveLinkTos, HistoryBufferSize = settings.HistoryBufferSize, LiveBufferSize = settings.LiveBufferSize, - MaxCheckpointCount = settings.MaxCheckPointCount, + MaxCheckpointCount = settings.CheckPointUpperBound, MaxRetryCount = settings.MaxRetryCount, MaxSubscriberCount = settings.MaxSubscriberCount, - MinCheckpointCount = settings.MinCheckPointCount, + MinCheckpointCount = settings.CheckPointLowerBound, NamedConsumerStrategy = - NamedConsumerStrategyToUpdateProto[settings.NamedConsumerStrategy], + NamedConsumerStrategyToUpdateProto[settings.ConsumerStrategyName], ReadBatchSize = settings.ReadBatchSize } } diff --git a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionSettings.cs b/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionSettings.cs index 3ebc09df8..bf541a6ea 100644 --- a/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionSettings.cs +++ b/src/EventStore.Client.PersistentSubscriptions/PersistentSubscriptionSettings.cs @@ -52,14 +52,14 @@ public sealed class PersistentSubscriptionSettings { public readonly TimeSpan CheckPointAfter; /// - /// The minimum number of messages to write to a checkpoint. + /// The minimum number of messages to process before a checkpoint may be written. /// - public readonly int MinCheckPointCount; + public readonly int CheckPointLowerBound; /// /// The maximum number of messages not checkpointed before forcing a checkpoint. /// - public readonly int MaxCheckPointCount; + public readonly int CheckPointUpperBound; /// /// The maximum number of subscribers allowed. @@ -69,7 +69,7 @@ public sealed class PersistentSubscriptionSettings { /// /// The strategy to use for distributing events to client consumers. See for system supported strategies. /// - public readonly string NamedConsumerStrategy; + public readonly string ConsumerStrategyName; /// /// Constructs a new . @@ -83,16 +83,16 @@ public sealed class PersistentSubscriptionSettings { /// /// /// - /// - /// + /// + /// /// - /// + /// /// public PersistentSubscriptionSettings(bool resolveLinkTos = false, IPosition? startFrom = null, bool extraStatistics = false, TimeSpan? messageTimeout = null, int maxRetryCount = 10, int liveBufferSize = 500, int readBatchSize = 20, int historyBufferSize = 500, - TimeSpan? checkPointAfter = null, int minCheckPointCount = 10, int maxCheckPointCount = 1000, - int maxSubscriberCount = 0, string namedConsumerStrategy = SystemConsumerStrategies.RoundRobin) { + TimeSpan? checkPointAfter = null, int checkPointLowerBound = 10, int checkPointUpperBound = 1000, + int maxSubscriberCount = 0, string consumerStrategyName = SystemConsumerStrategies.RoundRobin) { messageTimeout ??= TimeSpan.FromSeconds(30); checkPointAfter ??= TimeSpan.FromSeconds(2); @@ -117,10 +117,10 @@ public PersistentSubscriptionSettings(bool resolveLinkTos = false, IPosition? st ReadBatchSize = readBatchSize; HistoryBufferSize = historyBufferSize; CheckPointAfter = checkPointAfter.Value; - MinCheckPointCount = minCheckPointCount; - MaxCheckPointCount = maxCheckPointCount; + CheckPointLowerBound = checkPointLowerBound; + CheckPointUpperBound = checkPointUpperBound; MaxSubscriberCount = maxSubscriberCount; - NamedConsumerStrategy = namedConsumerStrategy; + ConsumerStrategyName = consumerStrategyName; } } } diff --git a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point.cs b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point.cs index 49f1a1fbe..7f39259e4 100644 --- a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point.cs +++ b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point.cs @@ -50,7 +50,7 @@ protected override async Task Given() { await Client.CreateToAllAsync(Group, new PersistentSubscriptionSettings( - minCheckPointCount: 5, + checkPointLowerBound: 5, checkPointAfter: TimeSpan.FromSeconds(1), startFrom: Position.Start), TestCredentials.Root); diff --git a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point_filtered.cs b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point_filtered.cs index f16616568..3508ac561 100644 --- a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point_filtered.cs +++ b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/update_existing_with_check_point_filtered.cs @@ -51,7 +51,7 @@ protected override async Task Given() { await Client.CreateToAllAsync(Group, StreamFilter.Prefix("test"), new PersistentSubscriptionSettings( - minCheckPointCount: 5, + checkPointLowerBound: 5, checkPointAfter: TimeSpan.FromSeconds(1), startFrom: Position.Start), TestCredentials.Root); diff --git a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/when_writing_and_filtering_out_events.cs b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/when_writing_and_filtering_out_events.cs index 632f13be1..abfa9680a 100644 --- a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/when_writing_and_filtering_out_events.cs +++ b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToAll/when_writing_and_filtering_out_events.cs @@ -54,7 +54,7 @@ protected override async Task Given() { await Client.CreateToAllAsync(Group, StreamFilter.Prefix("test"), new PersistentSubscriptionSettings( - minCheckPointCount: 5, + checkPointLowerBound: 5, checkPointAfter: TimeSpan.FromSeconds(1), startFrom: Position.Start), TestCredentials.Root); diff --git a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToStream/update_existing_with_check_point.cs b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToStream/update_existing_with_check_point.cs index b5bd5f8af..b8c6a09cf 100644 --- a/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToStream/update_existing_with_check_point.cs +++ b/test/EventStore.Client.PersistentSubscriptions.Tests/SubscriptionToStream/update_existing_with_check_point.cs @@ -51,7 +51,7 @@ protected override async Task Given() { await Client.CreateAsync(Stream, Group, new PersistentSubscriptionSettings( - minCheckPointCount: 5, + checkPointLowerBound: 5, checkPointAfter: TimeSpan.FromSeconds(1), startFrom: StreamPosition.Start), TestCredentials.Root);