Skip to content

Commit 6718229

Browse files
committed
add desrialize message type
1 parent 6c61d5f commit 6718229

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

ydb/_grpc/grpcwrapper/ydb_topic.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,22 @@ class PartitionSessionStatusRequest:
592592
partition_session_id: int
593593

594594
@dataclass
595-
class PartitionSessionStatusResponse:
595+
class PartitionSessionStatusResponse(IFromProto):
596596
partition_session_id: int
597597
partition_offsets: "OffsetsRange"
598598
committed_offset: int
599599
write_time_high_watermark: float
600600

601+
@staticmethod
602+
def from_proto(msg: ydb_topic_pb2.StreamReadMessage.PartitionSessionStatusResponse) -> "StreamReadMessage.PartitionSessionStatusResponse":
603+
return StreamReadMessage.PartitionSessionStatusResponse(
604+
partition_session_id=msg.partition_session_id,
605+
partition_offsets=OffsetsRange.from_proto(msg.partition_offsets),
606+
committed_offset=msg.committed_offset,
607+
write_time_high_watermark=msg.write_time_high_watermark,
608+
)
609+
610+
601611
@dataclass
602612
class StartPartitionSessionRequest(IFromProto):
603613
partition_session: "StreamReadMessage.PartitionSession"
@@ -694,14 +704,21 @@ def from_proto(
694704
return StreamReadMessage.FromServer(
695705
server_status=server_status,
696706
server_message=StreamReadMessage.StartPartitionSessionRequest.from_proto(
697-
msg.start_partition_session_request
707+
msg.start_partition_session_request,
698708
),
699709
)
700710
elif mess_type == "update_token_response":
701711
return StreamReadMessage.FromServer(
702712
server_status=server_status,
703713
server_message=UpdateTokenResponse.from_proto(msg.update_token_response),
704714
)
715+
elif mess_type == "partition_session_status_response":
716+
return StreamReadMessage.FromServer(
717+
server_status=server_status,
718+
server_message=StreamReadMessage.PartitionSessionStatusResponse.from_proto(
719+
msg.partition_session_status_response
720+
)
721+
)
705722

706723
# todo replace exception to log
707724
raise NotImplementedError()

0 commit comments

Comments
 (0)