mongodb

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient

func GetClient(ctx context.Context, uri string) (*mongo.Client, error)

GetClient returns the shared client for uri, dialling it on first use.

It takes a context because the verification ping below has to be bounded by whatever the caller allowed. It previously built its own 10s context from Background and ignored the caller's entirely, so a source Read or a readiness Ping with a two-second budget still waited ten — and the driver's own server-selection timeout could stretch that further.

Types

type MongoDBSource

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

MongoDBSource implements the hermod.Source interface for MongoDB Change Streams.

func NewMongoDBSource

func NewMongoDBSource(uri, database, collection string, useCDC bool) *MongoDBSource

func (*MongoDBSource) Ack

func (m *MongoDBSource) Ack(ctx context.Context, msg hermod.Message) error

func (*MongoDBSource) Close

func (m *MongoDBSource) Close() error

func (*MongoDBSource) DiscoverColumns

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

func (*MongoDBSource) DiscoverDatabases

func (m *MongoDBSource) DiscoverDatabases(ctx context.Context) ([]string, error)

func (*MongoDBSource) DiscoverTables

func (m *MongoDBSource) DiscoverTables(ctx context.Context) ([]string, error)

func (*MongoDBSource) GetState

func (m *MongoDBSource) GetState() map[string]string

func (*MongoDBSource) IsReady

func (m *MongoDBSource) IsReady(ctx context.Context) error

func (*MongoDBSource) Ping

func (m *MongoDBSource) Ping(ctx context.Context) error

func (*MongoDBSource) Read

func (m *MongoDBSource) Read(ctx context.Context) (hermod.Message, error)

func (*MongoDBSource) Sample

func (m *MongoDBSource) Sample(ctx context.Context, table string) (hermod.Message, error)

func (*MongoDBSource) SetInitialLoad

func (m *MongoDBSource) SetInitialLoad(enabled bool)

SetInitialLoad asks for a one-time backfill of the watched collection before the change stream is tailed.

It runs only when the source has no record of having run before, so enabling it on a workflow that is already streaming does nothing until that record is cleared. See initialLoadComplete for what the record is and why the resume token cannot serve as one.

func (*MongoDBSource) SetLogger

func (m *MongoDBSource) SetLogger(logger hermod.Logger)

SetLogger installs the logger the engine propagates to sources that accept one. The backfill reports what it could not carry across through it.

func (*MongoDBSource) SetState

func (m *MongoDBSource) SetState(state map[string]string)

func (*MongoDBSource) Snapshot

func (m *MongoDBSource) Snapshot(ctx context.Context, tables ...string) error

Jump to

Keyboard shortcuts

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