-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
087c2b2
commit 3c503b8
Showing
4 changed files
with
198 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System.Collections.Immutable; | ||
using Google.Protobuf; | ||
using Google.Protobuf.Collections; | ||
using Google.Protobuf.WellKnownTypes; | ||
using Ydb.Topic; | ||
|
||
namespace Ydb.Sdk.Services.Topic.Reader; | ||
|
||
internal class InternalMessage | ||
{ | ||
public InternalMessage( | ||
ByteString data, | ||
string topic, | ||
long partitionId, | ||
string producerId, | ||
OffsetsRange offsetsRange, | ||
Timestamp createdAt, | ||
RepeatedField<MetadataItem> metadataItems, | ||
int dataSize) | ||
{ | ||
Data = data; | ||
Topic = topic; | ||
PartitionId = partitionId; | ||
ProducerId = producerId; | ||
OffsetsRange = offsetsRange; | ||
CreatedAt = createdAt; | ||
MetadataItems = metadataItems; | ||
DataSize = dataSize; | ||
} | ||
|
||
private ByteString Data { get; } | ||
|
||
private string Topic { get; } | ||
|
||
private long PartitionId { get; } | ||
|
||
private string ProducerId { get; } | ||
|
||
private OffsetsRange OffsetsRange { get; } | ||
|
||
private Timestamp CreatedAt { get; } | ||
|
||
private RepeatedField<MetadataItem> MetadataItems { get; } | ||
|
||
private int DataSize { get; } | ||
Check warning on line 45 in src/Ydb.Sdk/src/Services/Topic/Reader/InternalMessage.cs GitHub Actions / Inspection (./src/YdbSdk.sln)
|
||
|
||
internal Message<TValue> ToPublicMessage<TValue>(IDeserializer<TValue> deserializer, ReaderSession readerSession) | ||
{ | ||
return new Message<TValue>( | ||
data: deserializer.Deserialize(Data.ToByteArray()), | ||
topic: Topic, | ||
partitionId: PartitionId, | ||
producerId: ProducerId, | ||
createdAt: CreatedAt.ToDateTime(), | ||
metadata: MetadataItems.Select(item => new Metadata(item.Key, item.Value.ToByteArray())).ToImmutableArray(), | ||
offsetsRange: OffsetsRange, | ||
readerSession: readerSession | ||
); | ||
} | ||
} | ||
|
||
internal class InternalBatchMessage | ||
{ | ||
public InternalBatchMessage( | ||
OffsetsRange batchOffsetsRange, | ||
Queue<InternalMessage> internalMessages, | ||
ReaderSession readerSession) | ||
{ | ||
BatchOffsetsRange = batchOffsetsRange; | ||
InternalMessages = internalMessages; | ||
ReaderSession = readerSession; | ||
} | ||
|
||
internal OffsetsRange BatchOffsetsRange { get; } | ||
|
||
internal Queue<InternalMessage> InternalMessages { get; } | ||
|
||
internal ReaderSession ReaderSession { get; } | ||
} | ||
|
||
internal record CommitSending( | ||
OffsetsRange OffsetsRange, | ||
long PartitionSessionId, | ||
TaskCompletionSource<TopicPartitionOffset> TcsTopicPartitionOffset | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.