@@ -61,12 +61,12 @@ func (r *ReaderManager) CreateReaders(ctx context.Context, streams []types.Strea
6161 return r .waitForConsumerGroupJoin (consumerGroupID )
6262}
6363
64- // GetReaders returns the created readers
64+ // GetReader returns the created readers
6565func (r * ReaderManager ) GetReader (readerID int ) * kgo.Client {
6666 return r .readers [readerID ].reader
6767}
6868
69- // GetReaders returns the created readers
69+ // GetReaderCount returns the created readers count
7070func (r * ReaderManager ) GetReaderCount () int {
7171 return len (r .readers )
7272}
@@ -125,7 +125,7 @@ func (r *ReaderManager) SetPartitions(ctx context.Context, stream types.StreamIn
125125 continue
126126 }
127127
128- committedOffset , hasCommittedOffset := committedTopicOffsets [int ( partition .Partition ) ]
128+ committedOffset , hasCommittedOffset := committedTopicOffsets [partition .Partition ]
129129
130130 // check if the partition has any messages at all, if not then skip
131131 if startOffset .Offset >= endOffset .Offset {
@@ -141,7 +141,7 @@ func (r *ReaderManager) SetPartitions(ctx context.Context, stream types.StreamIn
141141
142142 r .partitionIndex [fmt .Sprintf ("%s:%d" , topic , partition .Partition )] = types.PartitionMetaData {
143143 Stream : stream ,
144- PartitionID : int ( partition .Partition ) ,
144+ PartitionID : partition .Partition ,
145145 EndOffset : endOffset .Offset ,
146146 }
147147 }
@@ -163,19 +163,19 @@ func (r *ReaderManager) GetTopicMetadata(ctx context.Context, topic string) (*ka
163163}
164164
165165// FetchCommittedOffsets fetches committed offsets for a topic
166- func (r * ReaderManager ) FetchCommittedOffsets (ctx context.Context , topic string , partitions map [int32 ]kadm.PartitionDetail ) (map [int ]int64 , error ) {
166+ func (r * ReaderManager ) FetchCommittedOffsets (ctx context.Context , topic string , partitions map [int32 ]kadm.PartitionDetail ) (map [int32 ]int64 , error ) {
167167 offsets , err := r .config .AdminClient .FetchOffsets (ctx , r .config .ConsumerGroupID )
168168 if err != nil {
169169 return nil , fmt .Errorf ("could not fetch committed offsets for group %s" , r .config .ConsumerGroupID )
170170 }
171171
172- committedTopicOffsets := make (map [int ]int64 )
172+ committedTopicOffsets := make (map [int32 ]int64 )
173173 for _ , partitionDetail := range partitions {
174174 offset , exists := offsets .Lookup (topic , partitionDetail .Partition )
175175 if ! exists {
176176 continue
177177 }
178- committedTopicOffsets [int ( partitionDetail .Partition ) ] = offset .At
178+ committedTopicOffsets [partitionDetail .Partition ] = offset .At
179179 }
180180 return committedTopicOffsets , nil
181181}
@@ -334,11 +334,6 @@ func (r *ReaderManager) CreateReader(streams []types.StreamInterface, consumerGr
334334 return reader , nil
335335}
336336
337- // GenerationID returns the consumer-group generation stored after CreateReaders join wait.
338- func (r * ReaderManager ) GenerationID () int32 {
339- return r .generationID .Load ()
340- }
341-
342337// RebalanceDetected is true when the client's group generation differs from the stored baseline.
343338func (r * ReaderManager ) RebalanceDetected (client * kgo.Client ) bool {
344339 _ , generationID := client .GroupMetadata ()
@@ -383,7 +378,6 @@ func (r *ReaderManager) waitForConsumerGroupJoin(consumerGroupID string) error {
383378 } else if expectedGenerationID < 0 {
384379 expectedGenerationID = generationID
385380 }
386-
387381 }
388382
389383 if allReadersReady && expectedGenerationID >= 0 {
0 commit comments