Skip to content

Commit 037497a

Browse files
dev: change drop topic signature (#283)
1 parent b273d39 commit 037497a

File tree

6 files changed

+11
-31
lines changed

6 files changed

+11
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- Changed signature of the `TopicClient.DropTopic` method.
2+
13
## v0.15.1
24
- Fixed Writer: possible creation of a session after `DisposeAsync()`, which this could happen when there are canceled tasks in `InFlightMessages`.
35
- Dev: `Writer.MoveNext()` changed exception on cancelToken from `WriterException` to `TaskCanceledException`.

examples/src/Topic/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ await topicClient.CreateTopic(new CreateTopicSettings
6868
{
6969
await message.CommitAsync();
7070
}
71-
catch (Exception e)
71+
catch (ReaderException e)
7272
{
7373
logger.LogError(e, "Failed commit message");
7474
}
@@ -81,4 +81,4 @@ await topicClient.CreateTopic(new CreateTopicSettings
8181

8282
await writerJob;
8383
await readerJob;
84-
await topicClient.DropTopic(new DropTopicSettings { Path = topicName });
84+
await topicClient.DropTopic(topicName);

src/Ydb.Sdk/src/Services/Topic/Settings.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,6 @@ public class PartitioningSettings
8282
public long MaxActivePartitions { get; set; }
8383
}
8484

85-
/// <summary>
86-
/// Drop topic request sent from client to server.
87-
/// </summary>
88-
public class DropTopicSettings : OperationSettings
89-
{
90-
/// <summary>
91-
/// Topic path.
92-
/// </summary>
93-
public string Path { get; set; } = string.Empty;
94-
}
95-
96-
/// <summary>
97-
/// Update existing topic request sent from client to server.
98-
/// </summary>
99-
public class AlterTopicSettings : OperationSettings
100-
{
101-
/// <summary>
102-
/// Topic path.
103-
/// </summary>
104-
public string Path { get; set; } = string.Empty;
105-
}
106-
10785
public enum Codec
10886
{
10987
Unspecified = Ydb.Topic.Codec.Unspecified,

src/Ydb.Sdk/src/Services/Topic/TopicClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ public async Task CreateTopic(CreateTopicSettings settings)
7373
Status.FromProto(response.Operation.Status, response.Operation.Issues).EnsureSuccess();
7474
}
7575

76-
public async Task DropTopic(DropTopicSettings settings)
76+
public async Task DropTopic(string topicName, GrpcRequestSettings? settings = null)
7777
{
7878
var protoSettings = new DropTopicRequest
7979
{
80-
Path = settings.Path,
81-
OperationParams = settings.MakeOperationParams()
80+
Path = topicName
8281
};
8382

84-
var response = await _driver.UnaryCall(TopicService.DropTopicMethod, protoSettings, settings);
83+
var response = await _driver.UnaryCall(TopicService.DropTopicMethod, protoSettings,
84+
settings ?? new GrpcRequestSettings());
8585

8686
Status.FromProto(response.Operation.Status, response.Operation.Issues).EnsureSuccess();
8787
}

src/Ydb.Sdk/tests/Topic/ReaderIntegrationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ public async Task StressTest_WhenReadingThenCommiting_ReturnMessages()
6161

6262
await readerNext.DisposeAsync();
6363

64-
await topicClient.DropTopic(new DropTopicSettings { Path = _topicName });
64+
await topicClient.DropTopic(_topicName);
6565
}
6666
}

src/Ydb.Sdk/tests/Topic/WriterIntegrationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task WriteAsync_WhenOneMessage_ReturnWritten()
3636

3737
Assert.Equal(PersistenceStatus.Written, result.Status);
3838

39-
await topicClient.DropTopic(new DropTopicSettings { Path = _topicName });
39+
await topicClient.DropTopic(_topicName);
4040
}
4141

4242
[Fact]
@@ -127,6 +127,6 @@ await initStream.Write(new StreamReadMessage.Types.FromClient
127127

128128
Assert.Equal(messageCount * (messageCount - 1) / 2, ans);
129129

130-
await topicClient.DropTopic(new DropTopicSettings { Path = topicName });
130+
await topicClient.DropTopic(topicName);
131131
}
132132
}

0 commit comments

Comments
 (0)