package topicoptions
import "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicoptions"
Index ¶
- Constants
- Variables
- type AlterOption
- func AlterConsumerWithAttributes(name string, attributes map[string]string) AlterOption
- func AlterConsumerWithImportant(name string, important bool) AlterOption
- func AlterConsumerWithReadFrom(name string, readFrom time.Time) AlterOption
- func AlterConsumerWithSupportedCodecs(name string, codecs []topictypes.Codec) AlterOption
- func AlterWithAddConsumers(consumers ...topictypes.Consumer) AlterOption
- func AlterWithAttributes(attributes map[string]string) AlterOption
- func AlterWithDropConsumers(consumersName ...string) AlterOption
- func AlterWithMeteringMode(m topictypes.MeteringMode) AlterOption
- func AlterWithMinActivePartitions(minActivePartitions int64) AlterOption
- func AlterWithPartitionCountLimit(partitionCountLimit int64) AlterOption
- func AlterWithPartitionWriteBurstBytes(burstBytes int64) AlterOption
- func AlterWithPartitionWriteSpeedBytesPerSecond(bytesPerSecond int64) AlterOption
- func AlterWithRetentionPeriod(retentionPeriod time.Duration) AlterOption
- func AlterWithRetentionStorageMB(retentionStorageMB int64) AlterOption
- func AlterWithSupportedCodecs(codecs ...topictypes.Codec) AlterOption
- type CheckErrorRetryArgs
- type CheckErrorRetryFunction
- type CheckErrorRetryResult
- type CommitMode
- type CreateDecoderFunc
- type CreateEncoderFunc
- type CreateOption
- func CreateWithAttributes(attributes map[string]string) CreateOption
- func CreateWithConsumer(consumers ...topictypes.Consumer) CreateOption
- func CreateWithMeteringMode(mode topictypes.MeteringMode) CreateOption
- func CreateWithMinActivePartitions(count int64) CreateOption
- func CreateWithPartitionCountLimit(count int64) CreateOption
- func CreateWithPartitionWriteBurstBytes(partitionWriteBurstBytes int64) CreateOption
- func CreateWithPartitionWriteSpeedBytesPerSecond(partitionWriteSpeedBytesPerSecond int64) CreateOption
- func CreateWithRetentionPeriod(retentionPeriod time.Duration) CreateOption
- func CreateWithRetentionStorageMB(retentionStorageMB int64) CreateOption
- func CreateWithSupportedCodecs(codecs ...topictypes.Codec) CreateOption
- type DescribeOption
- type DropOption
- type GetPartitionStartOffsetFunc
- type GetPartitionStartOffsetRequest
- type GetPartitionStartOffsetResponse
- type OnWriterInitResponseCallback
- type ReadSelector
- type ReadSelectors
- type ReaderOption
- func WithAddDecoder(codec topictypes.Codec, decoderCreate CreateDecoderFunc) ReaderOption
- func WithBatchReadMaxCount(count int) ReaderOption
- func WithBatchReadMinCount(count int) ReaderOption
- func WithCommitCountTrigger(count int) ReaderOption
- func WithCommitMode(mode CommitMode) ReaderOption
- func WithCommitTimeLagTrigger(lag time.Duration) ReaderOption
- func WithCommonConfig(common config.Common) ReaderOption
- func WithGetPartitionStartOffset(f GetPartitionStartOffsetFunc) ReaderOption
- func WithMessagesBufferSize(size int) ReaderOption
- func WithReaderCheckRetryErrorFunction(callback CheckErrorRetryFunction) ReaderOption
- func WithReaderOperationCancelAfter(cancelAfter time.Duration) ReaderOption
- func WithReaderOperationTimeout(timeout time.Duration) ReaderOption
- func WithReaderStartTimeout(timeout time.Duration) ReaderOption
- func WithReaderTrace(t trace.Topic) ReaderOption
- func WithReaderUpdateTokenInterval(interval time.Duration) ReaderOption
- type TopicOption
- func WithOperationCancelAfter(operationCancelAfter time.Duration) TopicOption
- func WithOperationTimeout(operationTimeout time.Duration) TopicOption
- func WithTrace(trace trace.Topic, opts ...trace.TopicComposeOption) TopicOption
- type WithOnWriterConnectedInfo
- type WriteSessionMetadata
- type WriterOption
- func WithCodec(codec topictypes.Codec) WriterOption
- func WithCodecAutoSelect() WriterOption
- func WithOnWriterFirstConnected(f OnWriterInitResponseCallback) WriterOption
- func WithPartitionID(partitionID int64) WriterOption
- func WithProducerID(producerID string) WriterOption
- func WithSyncWrite(sync bool) WriterOption
- func WithWriteSessionMeta(meta map[string]string) WriterOption
- func WithWriterAddEncoder(codec topictypes.Codec, f CreateEncoderFunc) WriterOption
- func WithWriterCheckRetryErrorFunction(callback CheckErrorRetryFunction) WriterOption
- func WithWriterCompressorCount(num int) WriterOption
- func WithWriterMaxQueueLen(num int) WriterOption
- func WithWriterMessageMaxBytesSize(size int) WriterOption
- func WithWriterSetAutoCreatedAt(val bool) WriterOption
- func WithWriterSetAutoSeqNo(val bool) WriterOption
- func WithWriterStartTimeout(timeout time.Duration) WriterOption
- func WithWriterTrace(t trace.Topic) WriterOption
- func WithWriterUpdateTokenInterval(interval time.Duration) WriterOption
Examples ¶
Constants ¶
const ( // CommitModeAsync - commit return true if commit success add to internal send buffer (but not sent to server) // now it is grpc buffer, in feature it may be internal sdk buffer CommitModeAsync = topicreaderinternal.CommitModeAsync // default // CommitModeNone - reader will not be commit operation CommitModeNone = topicreaderinternal.CommitModeNone // CommitModeSync - commit return true when sdk receive ack of commit from server // The mode needs strong ordering client code for prevent deadlock. // Example: // Good: // CommitOffset(1) // CommitOffset(2) // // Deadlock: // CommitOffset(2) - server will wait commit offset 1 before send ack about offset 1 and 2 committed. // CommitOffset(1) CommitModeSync = topicreaderinternal.CommitModeSync )
Variables ¶
var ( CheckErrorRetryDecisionDefault = topic.PublicRetryDecisionDefault // Apply default behavior for the error CheckErrorRetryDecisionRetry = topic.PublicRetryDecisionRetry // Do once more retry CheckErrorRetryDecisionStop = topic.PublicRetryDecisionStop // Do not retry )
Types ¶
type AlterOption ¶
type AlterOption interface { ApplyAlterOption(req *rawtopic.AlterTopicRequest) }
AlterOption
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterConsumerWithAttributes ¶
func AlterConsumerWithAttributes(name string, attributes map[string]string) AlterOption
AlterConsumerWithAttributes
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterConsumerWithImportant ¶
func AlterConsumerWithImportant(name string, important bool) AlterOption
AlterConsumerWithImportant
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterConsumerWithReadFrom ¶
func AlterConsumerWithReadFrom(name string, readFrom time.Time) AlterOption
AlterConsumerWithReadFrom
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterConsumerWithSupportedCodecs ¶
func AlterConsumerWithSupportedCodecs(name string, codecs []topictypes.Codec) AlterOption
AlterConsumerWithSupportedCodecs
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithAddConsumers ¶
func AlterWithAddConsumers(consumers ...topictypes.Consumer) AlterOption
AlterWithAddConsumers
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithAttributes ¶
func AlterWithAttributes(attributes map[string]string) AlterOption
AlterWithAttributes
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithDropConsumers ¶
func AlterWithDropConsumers(consumersName ...string) AlterOption
AlterWithDropConsumers
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithMeteringMode ¶
func AlterWithMeteringMode(m topictypes.MeteringMode) AlterOption
AlterWithMeteringMode
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithMinActivePartitions ¶
func AlterWithMinActivePartitions(minActivePartitions int64) AlterOption
AlterWithMinActivePartitions
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithPartitionCountLimit ¶
func AlterWithPartitionCountLimit(partitionCountLimit int64) AlterOption
AlterWithPartitionCountLimit
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithPartitionWriteBurstBytes ¶
func AlterWithPartitionWriteBurstBytes(burstBytes int64) AlterOption
AlterWithPartitionWriteBurstBytes
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithPartitionWriteSpeedBytesPerSecond ¶
func AlterWithPartitionWriteSpeedBytesPerSecond(bytesPerSecond int64) AlterOption
AlterWithPartitionWriteSpeedBytesPerSecond
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithRetentionPeriod ¶
func AlterWithRetentionPeriod(retentionPeriod time.Duration) AlterOption
AlterWithRetentionPeriod
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithRetentionStorageMB ¶
func AlterWithRetentionStorageMB(retentionStorageMB int64) AlterOption
AlterWithRetentionStorageMB
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func AlterWithSupportedCodecs ¶
func AlterWithSupportedCodecs(codecs ...topictypes.Codec) AlterOption
AlterWithSupportedCodecs
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type CheckErrorRetryArgs ¶
type CheckErrorRetryArgs = topic.PublicCheckErrorRetryArgs
type CheckErrorRetryFunction ¶
type CheckErrorRetryFunction = topic.PublicCheckErrorRetryFunction
type CheckErrorRetryResult ¶
type CheckErrorRetryResult = topic.PublicCheckRetryResult
type CommitMode ¶
type CommitMode = topicreaderinternal.PublicCommitMode
CommitMode
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type CreateDecoderFunc ¶
type CreateDecoderFunc = topicreaderinternal.PublicCreateDecoderFunc
CreateDecoderFunc
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type CreateEncoderFunc ¶
type CreateEncoderFunc = topicwriterinternal.PublicCreateEncoderFunc
type CreateOption ¶
type CreateOption interface { ApplyCreateOption(request *rawtopic.CreateTopicRequest) }
CreateOption
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithAttributes ¶
func CreateWithAttributes(attributes map[string]string) CreateOption
CreateWithAttributes
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithConsumer ¶
func CreateWithConsumer(consumers ...topictypes.Consumer) CreateOption
CreateWithConsumer
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithMeteringMode ¶
func CreateWithMeteringMode(mode topictypes.MeteringMode) CreateOption
CreateWithMeteringMode
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithMinActivePartitions ¶
func CreateWithMinActivePartitions(count int64) CreateOption
CreateWithMinActivePartitions
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithPartitionCountLimit ¶
func CreateWithPartitionCountLimit(count int64) CreateOption
CreateWithPartitionCountLimit
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithPartitionWriteBurstBytes ¶
func CreateWithPartitionWriteBurstBytes(partitionWriteBurstBytes int64) CreateOption
CreateWithPartitionWriteBurstBytes
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithPartitionWriteSpeedBytesPerSecond ¶
func CreateWithPartitionWriteSpeedBytesPerSecond(partitionWriteSpeedBytesPerSecond int64) CreateOption
CreateWithPartitionWriteSpeedBytesPerSecond
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithRetentionPeriod ¶
func CreateWithRetentionPeriod(retentionPeriod time.Duration) CreateOption
CreateWithRetentionPeriod
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithRetentionStorageMB ¶
func CreateWithRetentionStorageMB(retentionStorageMB int64) CreateOption
CreateWithRetentionStorageMB
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func CreateWithSupportedCodecs ¶
func CreateWithSupportedCodecs(codecs ...topictypes.Codec) CreateOption
CreateWithSupportedCodecs
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type DescribeOption ¶
type DescribeOption func(req *rawtopic.DescribeTopicRequest)
DescribeOption
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type DropOption ¶
type DropOption interface { ApplyDropOption(request *rawtopic.DropTopicRequest) }
DropOption
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type GetPartitionStartOffsetFunc ¶
type GetPartitionStartOffsetFunc = topicreaderinternal.PublicGetPartitionStartOffsetFunc
GetPartitionStartOffsetFunc
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type GetPartitionStartOffsetRequest ¶
type GetPartitionStartOffsetRequest = topicreaderinternal.PublicGetPartitionStartOffsetRequest
GetPartitionStartOffsetRequest
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type GetPartitionStartOffsetResponse ¶
type GetPartitionStartOffsetResponse = topicreaderinternal.PublicGetPartitionStartOffsetResponse
GetPartitionStartOffsetResponse
type OnWriterInitResponseCallback ¶
type OnWriterInitResponseCallback = topicwriterinternal.PublicOnWriterInitResponseCallback
OnWriterInitResponseCallback
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type ReadSelector ¶
type ReadSelector = topicreaderinternal.PublicReadSelector
ReadSelector
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type ReadSelectors ¶
type ReadSelectors []ReadSelector
ReadSelectors
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func ReadTopic ¶
func ReadTopic(path string) ReadSelectors
ReadTopic create simple selector for read topics
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type ReaderOption ¶
type ReaderOption = topicreaderinternal.PublicReaderOption
ReaderOption
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithAddDecoder ¶
func WithAddDecoder(codec topictypes.Codec, decoderCreate CreateDecoderFunc) ReaderOption
WithAddDecoder
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithBatchReadMaxCount ¶
func WithBatchReadMaxCount(count int) ReaderOption
WithBatchReadMaxCount
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithBatchReadMinCount ¶
func WithBatchReadMinCount(count int) ReaderOption
WithBatchReadMinCount prefer min count messages in batch sometimes batch can contain fewer messages, for example if local buffer is full and SDK can't receive more messages
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithCommitCountTrigger ¶
func WithCommitCountTrigger(count int) ReaderOption
WithCommitCountTrigger set count trigger for send batch to server if count > 0 and sdk count of buffered commits >= count - send commit request to server 0 mean no count limit and use timer lag trigger only
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithCommitMode ¶
func WithCommitMode(mode CommitMode) ReaderOption
WithCommitMode
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithCommitTimeLagTrigger ¶
func WithCommitTimeLagTrigger(lag time.Duration) ReaderOption
WithCommitTimeLagTrigger set time lag from first commit message before send commit to server for accumulate many similar-time commits to one server request 0 mean no additional lag and send commit soon as possible Default value: 1 second
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithCommonConfig ¶
func WithCommonConfig(common config.Common) ReaderOption
WithCommonConfig
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithGetPartitionStartOffset ¶
func WithGetPartitionStartOffset(f GetPartitionStartOffsetFunc) ReaderOption
WithGetPartitionStartOffset
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithMessagesBufferSize ¶
func WithMessagesBufferSize(size int) ReaderOption
WithMessagesBufferSize
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithReaderCheckRetryErrorFunction ¶
func WithReaderCheckRetryErrorFunction(callback CheckErrorRetryFunction) ReaderOption
WithReaderCheckRetryErrorFunction can override default error retry policy use CheckErrorRetryDecisionDefault for use default behavior for the error callback func must be fast and deterministic: always result same result for same error - it can be called few times for every error
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
Code:
Example¶
{
var db *ydb.Driver
reader, err := db.Topic().StartReader(
"consumer",
topicoptions.ReadTopic("topic"),
topicoptions.WithReaderCheckRetryErrorFunction(
func(errInfo topicoptions.CheckErrorRetryArgs) topicoptions.CheckErrorRetryResult {
// Retry not found operations
if ydb.IsOperationErrorNotFoundError(errInfo.Error) {
return topicoptions.CheckErrorRetryDecisionRetry
}
// and use default behavior for all other errors
return topicoptions.CheckErrorRetryDecisionDefault
}),
)
_, _ = reader, err
}
func WithReaderOperationCancelAfter ¶
func WithReaderOperationCancelAfter(cancelAfter time.Duration) ReaderOption
WithReaderOperationCancelAfter
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithReaderOperationTimeout ¶
func WithReaderOperationTimeout(timeout time.Duration) ReaderOption
WithReaderOperationTimeout
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithReaderStartTimeout ¶
func WithReaderStartTimeout(timeout time.Duration) ReaderOption
WithReaderStartTimeout mean timeout for connect to reader stream and work some time without errors
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithReaderTrace ¶
func WithReaderTrace(t trace.Topic) ReaderOption
WithReaderTrace
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithReaderUpdateTokenInterval ¶
func WithReaderUpdateTokenInterval(interval time.Duration) ReaderOption
WithReaderUpdateTokenInterval
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type TopicOption ¶
TopicOption
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithOperationCancelAfter ¶
func WithOperationCancelAfter(operationCancelAfter time.Duration) TopicOption
WithOperationCancelAfter set the maximum amount of time a YDB server will process an operation. After timeout exceeds YDB will try to cancel operation and if it succeeds appropriate error will be returned to the client; otherwise processing will be continued. If OperationCancelAfter is zero then no timeout is used.
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithOperationTimeout ¶
func WithOperationTimeout(operationTimeout time.Duration) TopicOption
WithOperationTimeout set the maximum amount of time a YDB server will process an operation. After timeout exceeds YDB will try to cancel operation and regardless of the cancellation appropriate error will be returned to the client. If OperationTimeout is zero then no timeout is used.
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithTrace ¶
func WithTrace(trace trace.Topic, opts ...trace.TopicComposeOption) TopicOption
WithTrace defines trace over persqueue client calls
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type WithOnWriterConnectedInfo ¶
type WithOnWriterConnectedInfo = topicwriterinternal.PublicWithOnWriterConnectedInfo
WithOnWriterConnectedInfo present information, received from server
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
type WriteSessionMetadata ¶
type WriterOption ¶
type WriterOption = topicwriterinternal.PublicWriterOption
func WithCodec ¶
func WithCodec(codec topictypes.Codec) WriterOption
WithCodec disable codec auto select and force set codec for the write session
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithCodecAutoSelect ¶
func WithCodecAutoSelect() WriterOption
WithCodecAutoSelect - auto select best codec for messages stream enabled by default if option enabled - send a batch of messages for every allowed codec (for prevent delayed bad codec accident) then from time to time measure all codecs and select codec with the smallest result messages size
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithOnWriterFirstConnected ¶
func WithOnWriterFirstConnected(f OnWriterInitResponseCallback) WriterOption
WithOnWriterFirstConnected set callback f, which will called once - after first successfully init topic writer stream
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithPartitionID ¶
func WithPartitionID(partitionID int64) WriterOption
WithPartitionID set direct partition id on write session level
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithProducerID ¶
func WithProducerID(producerID string) WriterOption
WithProducerID set producer for write session
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithSyncWrite ¶
func WithSyncWrite(sync bool) WriterOption
WithSyncWrite - when enabled every Write call wait ack from server for all messages from the call disabled by default
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriteSessionMeta ¶
func WithWriteSessionMeta(meta map[string]string) WriterOption
WithWriteSessionMeta set session metadata
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterAddEncoder ¶
func WithWriterAddEncoder(codec topictypes.Codec, f CreateEncoderFunc) WriterOption
WithWriterAddEncoder add custom codec implementation to writer
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterCheckRetryErrorFunction ¶
func WithWriterCheckRetryErrorFunction(callback CheckErrorRetryFunction) WriterOption
WithWriterCheckRetryErrorFunction can override default error retry policy use CheckErrorRetryDecisionDefault for use default behavior for the error callback func must be fast and deterministic: always result same result for same error - it can be called few times for every error
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
Code:
Example¶
{
var db *ydb.Driver
writer, err := db.Topic().StartWriter(
"",
topicoptions.WithWriterCheckRetryErrorFunction(
func(errInfo topicoptions.CheckErrorRetryArgs) topicoptions.CheckErrorRetryResult {
// Retry for all transport errors
if ydb.IsTransportError(errInfo.Error) {
return topicoptions.CheckErrorRetryDecisionRetry
}
// and use default behavior for all other errors
return topicoptions.CheckErrorRetryDecisionDefault
}),
)
_, _ = writer, err
}
func WithWriterCompressorCount ¶
func WithWriterCompressorCount(num int) WriterOption
WithWriterCompressorCount set max count of goroutine for compress messages must be more zero
panic if num <= 0
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterMaxQueueLen ¶
func WithWriterMaxQueueLen(num int) WriterOption
WithWriterMaxQueueLen set max len of queue for wait ack
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterMessageMaxBytesSize ¶
func WithWriterMessageMaxBytesSize(size int) WriterOption
WithWriterMessageMaxBytesSize set max body size of one message in bytes
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterSetAutoCreatedAt ¶
func WithWriterSetAutoCreatedAt(val bool) WriterOption
WithWriterSetAutoCreatedAt set messages CreatedAt by SDK enabled by default if enabled - Message.CreatedAt field must be zero
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterSetAutoSeqNo ¶
func WithWriterSetAutoSeqNo(val bool) WriterOption
WithWriterSetAutoSeqNo set messages SeqNo by SDK enabled by default if enabled - Message.SeqNo field must be zero
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterStartTimeout ¶
func WithWriterStartTimeout(timeout time.Duration) WriterOption
WithWriterStartTimeout mean timeout for connect to writer stream and work some time without errors
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterTrace ¶
func WithWriterTrace(t trace.Topic) WriterOption
WithWriterTrace
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithWriterUpdateTokenInterval ¶
func WithWriterUpdateTokenInterval(interval time.Duration) WriterOption
WithWriterUpdateTokenInterval
Experimental
Notice: This API is EXPERIMENTAL and may be changed or removed in a later release.
Source Files ¶
topicoptions.go topicoptions_alter.go topicoptions_create.go topicoptions_describe.go topicoptions_drop.go topicoptions_reader.go topicoptions_topic.go topicoptions_writer.go
- Version
- v3.48.2
- Published
- Jun 16, 2023
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 3 minutes ago –
Tools for package owners.