package topicoptions

import "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicoptions"

Index

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
)

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 CommitMode

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

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

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 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 WithReaderTrace

func WithReaderTrace(tracer 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

type TopicOption func(c *topic.Config)

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 WriteSessionMetadata map[string]string

type WriterOption

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 WithMessageGroupID

func WithMessageGroupID(groupID string) WriterOption

WithMessageGroupID set message groupid on write session level

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 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 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 WithWriterTrace

func WithWriterTrace(tracer 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.41.0
Published
Dec 15, 2022
Platform
linux/amd64
Imports
10 packages
Last checked
26 minutes ago

Tools for package owners.