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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- Changed signature of the `TopicClient.DropTopic` method.

## v0.15.1
- Fixed Writer: possible creation of a session after `DisposeAsync()`, which this could happen when there are canceled tasks in `InFlightMessages`.
- Dev: `Writer.MoveNext()` changed exception on cancelToken from `WriterException` to `TaskCanceledException`.
Expand Down
4 changes: 2 additions & 2 deletions examples/src/Topic/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ await topicClient.CreateTopic(new CreateTopicSettings
{
await message.CommitAsync();
}
catch (Exception e)
catch (ReaderException e)
{
logger.LogError(e, "Failed commit message");
}
Expand All @@ -81,4 +81,4 @@ await topicClient.CreateTopic(new CreateTopicSettings

await writerJob;
await readerJob;
await topicClient.DropTopic(new DropTopicSettings { Path = topicName });
await topicClient.DropTopic(topicName);
22 changes: 0 additions & 22 deletions src/Ydb.Sdk/src/Services/Topic/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,6 @@ public class PartitioningSettings
public long MaxActivePartitions { get; set; }
}

/// <summary>
/// Drop topic request sent from client to server.
/// </summary>
public class DropTopicSettings : OperationSettings
{
/// <summary>
/// Topic path.
/// </summary>
public string Path { get; set; } = string.Empty;
}

/// <summary>
/// Update existing topic request sent from client to server.
/// </summary>
public class AlterTopicSettings : OperationSettings
{
/// <summary>
/// Topic path.
/// </summary>
public string Path { get; set; } = string.Empty;
}

public enum Codec
{
Unspecified = Ydb.Topic.Codec.Unspecified,
Expand Down
8 changes: 4 additions & 4 deletions src/Ydb.Sdk/src/Services/Topic/TopicClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public async Task CreateTopic(CreateTopicSettings settings)
Status.FromProto(response.Operation.Status, response.Operation.Issues).EnsureSuccess();
}

public async Task DropTopic(DropTopicSettings settings)
public async Task DropTopic(string topicName, GrpcRequestSettings? settings = null)
{
var protoSettings = new DropTopicRequest
{
Path = settings.Path,
OperationParams = settings.MakeOperationParams()
Path = topicName
};

var response = await _driver.UnaryCall(TopicService.DropTopicMethod, protoSettings, settings);
var response = await _driver.UnaryCall(TopicService.DropTopicMethod, protoSettings,
settings ?? new GrpcRequestSettings());

Status.FromProto(response.Operation.Status, response.Operation.Issues).EnsureSuccess();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ydb.Sdk/tests/Topic/ReaderIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public async Task StressTest_WhenReadingThenCommiting_ReturnMessages()

await readerNext.DisposeAsync();

await topicClient.DropTopic(new DropTopicSettings { Path = _topicName });
await topicClient.DropTopic(_topicName);
}
}
4 changes: 2 additions & 2 deletions src/Ydb.Sdk/tests/Topic/WriterIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task WriteAsync_WhenOneMessage_ReturnWritten()

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

await topicClient.DropTopic(new DropTopicSettings { Path = _topicName });
await topicClient.DropTopic(_topicName);
}

[Fact]
Expand Down Expand Up @@ -127,6 +127,6 @@ await initStream.Write(new StreamReadMessage.Types.FromClient

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

await topicClient.DropTopic(new DropTopicSettings { Path = topicName });
await topicClient.DropTopic(topicName);
}
}
Loading