sink

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCircuitOpen = errors.New("circuit breaker is open")

ErrCircuitOpen is returned when the circuit breaker is open and rejecting requests.

Functions

This section is empty.

Types

type BatchBufferSink

type BatchBufferSink struct {
	hermod.Sink
	// contains filtered or unexported fields
}

BatchBufferSink coalesces messages before writing to the underlying sink.

func NewBatchBufferSink

func NewBatchBufferSink(s hermod.Sink, batchSize int, maxWaitTime time.Duration) *BatchBufferSink

func (*BatchBufferSink) Close

func (s *BatchBufferSink) Close() error

func (*BatchBufferSink) Write

func (s *BatchBufferSink) Write(ctx context.Context, msg hermod.Message) error

type CircuitBreakerSink

type CircuitBreakerSink struct {
	hermod.Sink
	// contains filtered or unexported fields
}

func NewCircuitBreakerSink

func NewCircuitBreakerSink(s hermod.Sink, threshold int, timeout time.Duration) *CircuitBreakerSink

func (*CircuitBreakerSink) Write

func (*CircuitBreakerSink) WriteBatch

func (s *CircuitBreakerSink) WriteBatch(ctx context.Context, msgs []hermod.Message) error

WriteBatch routes batch writes through the circuit breaker. Without this method the embedded BatchSink's WriteBatch would be promoted directly, bypassing the breaker entirely.

type RetrySink

type RetrySink struct {
	hermod.Sink
	// contains filtered or unexported fields
}

RetrySink wraps a Sink and adds retry logic.

func NewRetrySink

func NewRetrySink(s hermod.Sink, maxRetries int, retryInterval time.Duration, logger hermod.Logger) *RetrySink

func (*RetrySink) DiscoverColumns

func (s *RetrySink) DiscoverColumns(ctx context.Context, table string) ([]hermod.ColumnInfo, error)

func (*RetrySink) DiscoverDatabases

func (s *RetrySink) DiscoverDatabases(ctx context.Context) ([]string, error)

func (*RetrySink) DiscoverTables

func (s *RetrySink) DiscoverTables(ctx context.Context) ([]string, error)

func (*RetrySink) ExecuteSQL

func (s *RetrySink) ExecuteSQL(ctx context.Context, query string) ([]map[string]any, error)

func (*RetrySink) Write

func (s *RetrySink) Write(ctx context.Context, msg hermod.Message) error

func (*RetrySink) WriteBatch

func (s *RetrySink) WriteBatch(ctx context.Context, msgs []hermod.Message) error

type TracingSink

type TracingSink struct {
	hermod.Sink
	// contains filtered or unexported fields
}

TracingSink wraps a Sink and adds OpenTelemetry tracing.

func NewTracingSink

func NewTracingSink(s hermod.Sink, sinkID string) *TracingSink

func (*TracingSink) DiscoverColumns

func (s *TracingSink) DiscoverColumns(ctx context.Context, table string) ([]hermod.ColumnInfo, error)

func (*TracingSink) DiscoverDatabases

func (s *TracingSink) DiscoverDatabases(ctx context.Context) ([]string, error)

func (*TracingSink) DiscoverTables

func (s *TracingSink) DiscoverTables(ctx context.Context) ([]string, error)

func (*TracingSink) ExecuteSQL

func (s *TracingSink) ExecuteSQL(ctx context.Context, query string) ([]map[string]any, error)

func (*TracingSink) Write

func (s *TracingSink) Write(ctx context.Context, msg hermod.Message) error

func (*TracingSink) WriteBatch

func (s *TracingSink) WriteBatch(ctx context.Context, msgs []hermod.Message) error

Directories

Path Synopsis
Package txgroup writes to several sinks inside one distributed transaction.
Package txgroup writes to several sinks inside one distributed transaction.

Jump to

Keyboard shortcuts

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