factory

package
v1.18.8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 112 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectionString

func BuildConnectionString(cfg map[string]string, sourceType string) string

func CreateFCMSink added in v1.18.4

func CreateFCMSink(cfg SinkConfig) (*sinkfcm.Sink, error)

CreateFCMSink builds the FCM sink a stored configuration describes, without the tracing and retry decorators CreateSink wraps it in. It is for the editor's test send, which needs the sink's own SendTest; the decorators forward Write and the discovery calls, not that. Secrets must already be resolved.

func CreateMLDatasetSink added in v1.18.0

func CreateMLDatasetSink(cfg SinkConfig, w *worker.Client) (hermod.Sink, error)

CreateMLDatasetSink builds a Collect Dataset sink on the ML worker w, with the decorators CreateSink puts on every sink. The registry builds it here rather than through CreateSink so the sink reaches the worker training uses.

func CreateSink

func CreateSink(cfg SinkConfig) (hermod.Sink, error)

func CreateSinkForPreview added in v1.8.1

func CreateSinkForPreview(cfg SinkConfig) (hermod.Sink, error)

CreateSinkForPreview builds a sink without the tracing and retry decorators, for a caller that renders a sink's templates rather than writes through it. The decorators wrap the sink in a type the caller cannot look inside, and a preview never sends, so neither of them is wanted.

func CreateSinkForTransactionGroup

func CreateSinkForTransactionGroup(cfg SinkConfig) (hermod.Sink, error)

CreateSinkForTransactionGroup builds a sink for membership of a transactional group, without the tracing and retry decorators.

Two reasons, and either alone would be enough.

The decorators forward Write, WriteBatch and the discovery calls, but not Begin, Commit, Prepare or CommitPrepared. A decorated sink therefore does not satisfy hermod.TwoPhaseCommit, and a group refuses to start when a member does not — so every group built through the registry failed at startup, while the tests that construct sinks directly passed.

The second reason is why forwarding them through the decorators would be the wrong fix. Retrying a failed Write inside a prepared transaction is not a retry of an idempotent operation: the transaction may already be aborted, and a write that did land would be applied twice within the same prepared transaction. Failure handling for a group belongs to the coordinator, which rolls every participant back together. A member that quietly retried underneath it would be making that decision on its own.

func CreateSource

func CreateSource(cfg SourceConfig) (hermod.Source, error)

func DLQRecoveryCapableSinkTypes added in v1.8.1

func DLQRecoveryCapableSinkTypes() []string

DLQRecoveryCapableSinkTypes returns the sink types usable as a dead-letter sink that the engine can also drain. The result is a copy: callers sort and filter it.

func PreviewFCMMessage added in v1.17.0

func PreviewFCMMessage(cfg SinkConfig, msg hermod.Message) (sinkfcm.Preview, error)

PreviewFCMMessage reports what an FCM sink stored as cfg would send for msg.

It does not go through CreateSinkForPreview: building the sink itself needs the service account, and a preview authenticates to nothing. What it shares with the worker's path is everything that shapes the message — the config parser and the formatter — so the size it reports is the size a run sends.

func SupportsDLQRecovery added in v1.8.1

func SupportsDLQRecovery(sinkType string) bool

SupportsDLQRecovery reports whether a dead-letter sink of this type can be read back for PrioritizeDLQ or an on-demand drain.

func SupportsTwoPhaseCommit

func SupportsTwoPhaseCommit(sinkType string) bool

SupportsTwoPhaseCommit reports whether a sink of this type can be a member of a transactional group.

func TwoPhaseCapableSinkTypes

func TwoPhaseCapableSinkTypes() []string

TwoPhaseCapableSinkTypes returns the sink types that can join a transactional group. The result is a copy: callers sort and filter it.

Types

type SinkConfig

type SinkConfig struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	// VHost is the vhost the sink belongs to; see SourceConfig.VHost.
	VHost  string           `json:"vhost,omitempty"`
	Config hermod.StringMap `json:"config"`
}

type SourceConfig

type SourceConfig struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	// VHost is the vhost the source belongs to: a `secret:NAME` in its config
	// is resolved from that vhost's secrets first.
	VHost              string           `json:"vhost,omitempty"`
	Config             hermod.StringMap `json:"config"`
	State              hermod.StringMap `json:"state"`
	ReconnectIntervals []time.Duration  `json:"-"`
}

Jump to

Keyboard shortcuts

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