Skip to content

Commit 47b8872

Browse files
committed
change confirm, change session info
1 parent c0e6e9e commit 47b8872

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

examples/topic/topicreader/topicreader_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (h *TopicEventsHandler) OnStartPartitionSessionRequest(
6363
h.m.Unlock()
6464

6565
log.Printf("Started read partition %v/%v", event.PartitionSession.TopicPath, event.PartitionSession.PartitionID)
66-
event.Confirm(
66+
event.ConfirmWithParams(
6767
topiclistener.StartPartitionSessionConfirm{}.
6868
WithReadOffet(offset).
6969
WithCommitOffset(offset),

internal/topic/topiclistenerinternal/event_handler.go

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,12 @@ type PublicStartPartitionSessionEvent struct {
5656
// Confirm
5757
//
5858
// Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
59-
func (e *PublicStartPartitionSessionEvent) Confirm(opts ...PublicStartPartitionSessionConfirm) {
60-
switch len(opts) {
61-
case 0:
62-
e.respChan <- PublicStartPartitionSessionConfirm{}
63-
case 1:
64-
e.respChan <- opts[0]
65-
default:
66-
panic("Confirm accept only zero or one confirm parameters")
67-
}
59+
func (e *PublicStartPartitionSessionEvent) Confirm() {
60+
e.ConfirmWithParams(PublicStartPartitionSessionConfirm{})
61+
}
62+
63+
func (e *PublicStartPartitionSessionEvent) ConfirmWithParams(p PublicStartPartitionSessionConfirm) {
64+
e.respChan <- p
6865
}
6966

7067
// PublicStartPartitionSessionConfirm
@@ -117,15 +114,8 @@ type PublicStopPartitionSessionEvent struct {
117114
// Confirm
118115
//
119116
// Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
120-
func (e *PublicStopPartitionSessionEvent) Confirm(options ...PublicStopPartitionSessionConfirm) {
121-
switch len(options) {
122-
case 0:
123-
e.resp <- PublicStopPartitionSessionConfirm{}
124-
case 1:
125-
e.resp <- options[0]
126-
default:
127-
panic("Confirm accept only zero or one confirm parameters")
128-
}
117+
func (e *PublicStopPartitionSessionEvent) Confirm() {
118+
e.resp <- PublicStopPartitionSessionConfirm{}
129119
}
130120

131121
// PublicStopPartitionSessionConfirm

0 commit comments

Comments
 (0)