Documentation
¶
Index ¶
- func InitCommands(conn adbc.Connection, c *config.Conf) error
- func InitTables(conn adbc.Connection, c *config.Conf) error
- func InitUDFs(c *config.Conf) error
- type ErrorPolicy
- type Handler
- type Mark
- type MarkCommitter
- type Message
- type MetadataWriter
- type Metrics
- type PipelineErrorPolicies
- type Sink
- type Source
- type Stats
- type Turbine
- type TurbineOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitCommands ¶
func InitCommands(conn adbc.Connection, c *config.Conf) error
func InitTables ¶
func InitTables(conn adbc.Connection, c *config.Conf) error
InitTables creates the tables that live across the pipeline's lifetime, such as the aggregate tables a tumbling window manager maintains.
func InitUDFs ¶
InitUDFs reports that a config declares UDFs, which turbine does not support. The Python engine registers arbitrary Python callables through conn.create_function; Go has no equivalent, and rather than inventing a plugin mechanism, user-defined functions are left to DuckDB itself (a macro, an extension, or an ATTACHed database that defines them).
This is an error rather than a silent skip: ignoring the block would defer the failure to an unhelpful binder error when the handler SQL calls the function.
Types ¶
type ErrorPolicy ¶
type ErrorPolicy int
const ( PolicyRaise ErrorPolicy = iota PolicyIgnore PolicyDLQ )
func ParseErrorPolicy ¶
func ParseErrorPolicy(s string) (ErrorPolicy, error)
ParseErrorPolicy resolves the configured policy name. Matching the Python engine, the name is case-insensitive and an empty value means RAISE.
type Mark ¶ added in v1.0.4
Mark is the position of the last message the pipeline has finished with in one partition: written to the handler, or dropped by an error policy.
type MarkCommitter ¶ added in v1.0.4
MarkCommitter is implemented by sources that can commit an explicit position. The pipeline prefers it to Commit, because a source that reads ahead of the pipeline -- the Kafka source polls into a buffer -- has fetched messages the pipeline has not processed, and committing "everything fetched" commits those too. Marks are keyed by topic then partition.
type Message ¶
type Message struct {
Value []byte
Topic string
Partition int32
Offset int64
// LeaderEpoch is the Kafka leader epoch the record was read under. It is
// carried through so a commit can name it, which lets the broker detect
// log truncation. Only meaningful when HasMetadata is true; a source with
// no positions leaves it zero along with the rest.
LeaderEpoch int32
}
Message is one record from a source, with whatever provenance the source knows about it. Only Kafka populates the metadata fields.
func (Message) HasMetadata ¶
HasMetadata reports whether the source supplied provenance for this message. Topic is the discriminator: a Kafka record always has one, and a source that has none leaves it empty.
type MetadataWriter ¶
MetadataWriter is implemented by handlers that can use a message's source metadata. Handlers that only need the payload implement Handler alone and the consume loop hands them the value.
type Metrics ¶
type Metrics struct {
MessageCount metric.Int64Counter
ErrorCount metric.Int64Counter
SourceReadLatency metric.Float64Histogram
SinkFlushLatency metric.Float64Histogram
SinkFlushNumRows metric.Int64Gauge
SinkFlushCount metric.Int64Counter
BatchProcessingLatency metric.Float64Histogram
}
Metrics holds the instruments the pipeline records, mirroring the names, descriptions and units the Python engine exports.
func NewMetrics ¶
func NewMetrics(mp metric.MeterProvider) (*Metrics, error)
NewMetrics builds the instruments from a meter provider. Passing a noop provider yields instruments that record nothing, so the pipeline needs no nil checks.
type PipelineErrorPolicies ¶
type PipelineErrorPolicies struct {
Policy ErrorPolicy
DLQSink Sink
}
type Stats ¶
func (*Stats) AddMessagesConsumed ¶
func (*Stats) GetThroughput ¶
func (*Stats) MessagesConsumed ¶
func (*Stats) SetNumMessagesConsumed ¶
func (*Stats) SetThroughput ¶
type Turbine ¶
type Turbine struct {
// contains filtered or unexported fields
}
func NewTurbine ¶
func (*Turbine) ConsumeLoop ¶
type TurbineOption ¶
type TurbineOption func(turbine *Turbine)
func WithMetrics ¶
func WithMetrics(m *Metrics) TurbineOption
WithMetrics records pipeline instruments through the given provider.
func WithTurbineLogger ¶
func WithTurbineLogger(l *zap.Logger) TurbineOption