github.com/ydb-platform/ydb-go-sdk/v3@v3.89.2/topic/topicreader/batch_options.go (about) 1 package topicreader 2 3 import "github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicreaderinternal" 4 5 // WithBatchMaxCount max messages within batch 6 type WithBatchMaxCount int 7 8 var _ ReadBatchOption = WithBatchMaxCount(0) 9 10 // Apply implements ReadBatchOption interface 11 func (count WithBatchMaxCount) Apply( 12 options topicreaderinternal.ReadMessageBatchOptions, 13 ) topicreaderinternal.ReadMessageBatchOptions { 14 options.MaxCount = int(count) 15 16 return options 17 } 18 19 // WithBatchPreferMinCount set prefer min count for batch size. Sometime result batch can be less then count 20 // for example if internal buffer full and can't receive more messages or server stop send messages in partition 21 // 22 // count must be 1 or greater 23 // it will panic if count < 1 24 // 25 // Deprecated: was experimental and not actual now. 26 // The option will be removed for simplify code internals. 27 // Will be removed after Oct 2024. 28 // Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated 29 type WithBatchPreferMinCount int 30 31 // Apply implements ReadBatchOption interface 32 func (count WithBatchPreferMinCount) Apply( 33 options topicreaderinternal.ReadMessageBatchOptions, 34 ) topicreaderinternal.ReadMessageBatchOptions { 35 if count < 1 { 36 panic("ydb: min batch size must be 1 or greater") 37 } 38 options.MinCount = int(count) 39 40 return options 41 }