@@ -12,11 +12,11 @@ import (
1212)
1313
1414var (
15- errUnexpectedNilStreamReadMessageReadResponse = xerrors .Wrap (errors .New ("ydb: unexpected nil Ydb_Topic.StreamReadMessage_ReadResponse" )) //nolint:lll
16- errNilPartitionData = xerrors .Wrap (errors .New ("ydb: unexpected nil partition data" ))
17- errUnexpectedNilBatchInPartitionData = xerrors .Wrap (errors .New ("ydb: unexpected nil batch in partition data" )) //nolint:lll
18- errUnexpectedMessageNilInPartitionData = xerrors .Wrap (errors .New ("ydb: unexpected message nil in partition data" )) //nolint:lll
19- errUnexpectedProtobufInOffsets = xerrors . Wrap ( errors . New ( "ydb: unexpected protobuf nil offsets" ))
15+ errUnexpectedNilStreamReadMessageReadResponse = xerrors .Wrap (errors .New ("ydb: unexpected nil Ydb_Topic.StreamReadMessage_ReadResponse" )) //nolint:lll
16+ errNilPartitionData = xerrors .Wrap (errors .New ("ydb: unexpected nil partition data" ))
17+ errUnexpectedNilBatchInPartitionData = xerrors .Wrap (errors .New ("ydb: unexpected nil batch in partition data" )) //nolint:lll
18+ errUnexpectedMessageNilInPartitionData = xerrors .Wrap (errors .New ("ydb: unexpected message nil in partition data" )) //nolint:lll
19+
2020 errUnexpectedProtoNilStartPartitionSessionRequest = xerrors .Wrap (errors .New ("ydb: unexpected proto nil start partition session request" )) //nolint:lll
2121 errUnexpectedNilPartitionSession = xerrors .Wrap (errors .New ("ydb: unexpected proto nil partition session in start partition session request" )) //nolint:lll
2222 errUnexpectedGrpcNilStopPartitionSessionRequest = xerrors .Wrap (errors .New ("ydb: unexpected grpc nil stop partition session request" )) //nolint:lll
@@ -32,22 +32,8 @@ func (id PartitionSessionID) ToInt64() int64 {
3232 return int64 (id )
3333}
3434
35- type Offset int64
36-
37- func NewOffset (v int64 ) Offset {
38- return Offset (v )
39- }
40-
41- func (offset * Offset ) FromInt64 (v int64 ) {
42- * offset = Offset (v )
43- }
44-
45- func (offset Offset ) ToInt64 () int64 {
46- return int64 (offset )
47- }
48-
4935type OptionalOffset struct {
50- Offset Offset
36+ Offset rawtopiccommon. Offset
5137 HasValue bool
5238}
5339
@@ -286,7 +272,7 @@ type Batch struct {
286272}
287273
288274type MessageData struct {
289- Offset Offset
275+ Offset rawtopiccommon. Offset
290276 SeqNo int64
291277 CreatedAt time.Time
292278 Data []byte
@@ -330,30 +316,7 @@ func (r *CommitOffsetRequest) toProto() *Ydb_Topic.StreamReadMessage_CommitOffse
330316
331317type PartitionCommitOffset struct {
332318 PartitionSessionID PartitionSessionID
333- Offsets []OffsetRange
334- }
335-
336- type OffsetRange struct {
337- Start Offset
338- End Offset
339- }
340-
341- func (r * OffsetRange ) FromProto (p * Ydb_Topic.OffsetsRange ) error {
342- if p == nil {
343- return xerrors .WithStackTrace (errUnexpectedProtobufInOffsets )
344- }
345-
346- r .Start .FromInt64 (p .GetStart ())
347- r .End .FromInt64 (p .GetEnd ())
348-
349- return nil
350- }
351-
352- func (r * OffsetRange ) ToProto () * Ydb_Topic.OffsetsRange {
353- return & Ydb_Topic.OffsetsRange {
354- Start : r .Start .ToInt64 (),
355- End : r .End .ToInt64 (),
356- }
319+ Offsets []rawtopiccommon.OffsetRange
357320}
358321
359322type CommitOffsetResponse struct {
@@ -382,7 +345,7 @@ func (r *CommitOffsetResponse) fromProto(proto *Ydb_Topic.StreamReadMessage_Comm
382345
383346type PartitionCommittedOffset struct {
384347 PartitionSessionID PartitionSessionID
385- CommittedOffset Offset
348+ CommittedOffset rawtopiccommon. Offset
386349}
387350
388351//
@@ -407,7 +370,7 @@ type PartitionSessionStatusResponse struct {
407370 rawtopiccommon.ServerMessageMetadata
408371
409372 PartitionSessionID PartitionSessionID
410- PartitionOffsets OffsetRange
373+ PartitionOffsets rawtopiccommon. OffsetRange
411374 WriteTimeHighWatermark time.Time
412375}
413376
@@ -433,8 +396,8 @@ type StartPartitionSessionRequest struct {
433396 rawtopiccommon.ServerMessageMetadata
434397
435398 PartitionSession PartitionSession
436- CommittedOffset Offset
437- PartitionOffsets OffsetRange
399+ CommittedOffset rawtopiccommon. Offset
400+ PartitionOffsets rawtopiccommon. OffsetRange
438401}
439402
440403func (r * StartPartitionSessionRequest ) fromProto (p * Ydb_Topic.StreamReadMessage_StartPartitionSessionRequest ) error {
@@ -489,7 +452,7 @@ type StopPartitionSessionRequest struct {
489452
490453 PartitionSessionID PartitionSessionID
491454 Graceful bool
492- CommittedOffset Offset
455+ CommittedOffset rawtopiccommon. Offset
493456}
494457
495458func (r * StopPartitionSessionRequest ) fromProto (proto * Ydb_Topic.StreamReadMessage_StopPartitionSessionRequest ) error {
0 commit comments