writers

package
v4.0.2-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchWriter

type BatchWriter struct {
	// contains filtered or unexported fields
}

func NewBatchWriter

func NewBatchWriter(client BatchWriterClient, opts ...Option) (*BatchWriter, error)

func (*BatchWriter) Close

func (w *BatchWriter) Close(context.Context) error

func (*BatchWriter) Flush

func (w *BatchWriter) Flush(ctx context.Context) error

func (*BatchWriter) Write

func (w *BatchWriter) Write(ctx context.Context, msgs <-chan message.Message) error

type BatchWriterClient

type BatchWriterClient interface {
	MigrateTables(context.Context, []*message.MigrateTable) error
	WriteTableBatch(ctx context.Context, name string, msgs []*message.Insert) error
	DeleteStale(context.Context, []*message.DeleteStale) error
}

type MixedBatchClient

type MixedBatchClient interface {
	MigrateTableBatch(ctx context.Context, messages []*message.MigrateTable, options plugin.WriteOptions) error
	InsertBatch(ctx context.Context, messages []*message.Insert, options plugin.WriteOptions) error
	DeleteStaleBatch(ctx context.Context, messages []*message.DeleteStale, options plugin.WriteOptions) error
}

MixedBatchClient is a client that will receive batches of messages with a mixture of tables.

type MixedBatchWriter

type MixedBatchWriter struct {
	// contains filtered or unexported fields
}

func NewMixedBatchWriter

func NewMixedBatchWriter(client MixedBatchClient, opts ...MixedBatchWriterOption) (*MixedBatchWriter, error)

func (*MixedBatchWriter) Write

func (w *MixedBatchWriter) Write(ctx context.Context, options plugin.WriteOptions, msgChan <-chan message.Message) error

Write starts listening for messages on the msgChan channel and writes them to the client in batches.

type MixedBatchWriterOption

type MixedBatchWriterOption func(writer *MixedBatchWriter)

func WithMixedBatchWriterBatchSize

func WithMixedBatchWriterBatchSize(size int) MixedBatchWriterOption

func WithMixedBatchWriterBatchTimeout

func WithMixedBatchWriterBatchTimeout(timeout time.Duration) MixedBatchWriterOption

func WithMixedBatchWriterLogger

func WithMixedBatchWriterLogger(logger zerolog.Logger) MixedBatchWriterOption

func WithMixedBatchWriterSizeBytes

func WithMixedBatchWriterSizeBytes(size int) MixedBatchWriterOption

type Option

type Option func(*BatchWriter)

func WithBatchSize

func WithBatchSize(size int) Option

func WithBatchSizeBytes

func WithBatchSizeBytes(size int) Option

func WithBatchTimeout

func WithBatchTimeout(timeout time.Duration) Option

func WithLogger

func WithLogger(logger zerolog.Logger) Option

type Writer

type Writer interface {
	Write(ctx context.Context, writeOptions plugin.WriteOptions, res <-chan message.Message) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL