Documentation
¶
Overview ¶
Package sink defines the Sink interface and implementations for writing processed records out of the StreamForge pipeline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSink ¶
type FileSink struct {
// contains filtered or unexported fields
}
FileSink writes records to a file, one record per line.
func NewFileSink ¶
NewFileSink creates a sink that appends records to the given file path.
type KafkaSink ¶
type KafkaSink struct {
// contains filtered or unexported fields
}
KafkaSink writes records to a Kafka topic.
func NewKafkaSink ¶
func NewKafkaSink(cfg KafkaSinkConfig) *KafkaSink
NewKafkaSink creates a new Kafka producer sink.
type KafkaSinkConfig ¶
KafkaSinkConfig holds configuration for a Kafka sink.
type MemorySink ¶
type MemorySink struct {
// contains filtered or unexported fields
}
MemorySink collects records in memory. Useful for testing.
func NewMemorySink ¶
func NewMemorySink() *MemorySink
NewMemorySink creates a new in-memory sink for testing.
func (*MemorySink) Records ¶
func (m *MemorySink) Records() []*record.Record
Records returns a copy of all collected records.
type Sink ¶
type Sink interface {
// Open initializes the sink.
Open(ctx context.Context) error
// Write outputs a single record.
Write(ctx context.Context, record *record.Record) error
// Flush ensures all buffered writes are committed.
Flush(ctx context.Context) error
// Close releases resources.
Close() error
}
Sink is the interface for writing processed records to an external system.
type StdoutOption ¶
type StdoutOption func(*StdoutSink)
StdoutOption configures the stdout sink.
func WithWriter ¶
func WithWriter(w io.Writer) StdoutOption
WithWriter sets a custom writer instead of os.Stdout.
type StdoutSink ¶
type StdoutSink struct {
// contains filtered or unexported fields
}
StdoutSink writes records to standard output (or a configurable writer).
func NewStdoutSink ¶
func NewStdoutSink(opts ...StdoutOption) *StdoutSink
NewStdoutSink creates a sink that writes records to stdout.