changestream

package
v0.0.0-...-6dcaeb9 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs the changestream worker, using the resource names defined in the supplied config.

Types

type ChangeStream

type ChangeStream interface {
	EventQueue(string) (EventQueue, error)
}

ChangeStream represents an interface for getting an event queue for a particular namespace.

type DBGetter

type DBGetter = coredatabase.DBGetter

DBGetter describes the ability to supply a sql.DB reference for a particular database.

type EventQueue

type EventQueue interface {
	// Subscribe returns a new subscription to listen to changes from the
	// database change log.
	Subscribe(...changestream.SubscriptionOption) (changestream.Subscription, error)
}

EventQueue represents an interface for managing subscriptions to listen to changes from the database change log.

type EventQueueWorker

type EventQueueWorker interface {
	worker.Worker
	EventQueue() EventQueue
}

EventQueueWorker represents a worker for subscribing to events from the database change log.

func NewEventQueueWorker

func NewEventQueueWorker(db coredatabase.TrackedDB, fileNotifier FileNotifier, clock clock.Clock, logger Logger) (EventQueueWorker, error)

NewEventQueueWorker creates a new EventQueueWorker.

type EventQueueWorkerFn

type EventQueueWorkerFn = func(coredatabase.TrackedDB, FileNotifier, clock.Clock, Logger) (EventQueueWorker, error)

EventQueueWorkerFn is an alias function that allows the creation of EventQueueWorker.

type FileNotifier

type FileNotifier interface {
	// Changes returns a channel if a file was created or deleted.
	Changes() (<-chan bool, error)
}

FileNotifier represents a way to watch for changes in a namespace folder directory.

type FileNotifyWatcher

type FileNotifyWatcher = filenotifywatcher.FileNotifyWatcher

FileNotifyWatcher is the interface that the worker uses to interact with the file notify watcher.

type Logger

type Logger interface {
	Errorf(message string, args ...interface{})
	Warningf(message string, args ...interface{})
	Infof(message string, args ...interface{})
	Debugf(message string, args ...interface{})
	Tracef(message string, args ...interface{})
	IsTraceEnabled() bool
}

Logger represents the logging methods called.

type ManifoldConfig

type ManifoldConfig struct {
	DBAccessor        string
	FileNotifyWatcher string

	Clock               clock.Clock
	Logger              Logger
	NewEventQueueWorker EventQueueWorkerFn
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

func (ManifoldConfig) Validate

func (cfg ManifoldConfig) Validate() error

type WorkerConfig

type WorkerConfig struct {
	DBGetter            DBGetter
	FileNotifyWatcher   FileNotifyWatcher
	Clock               clock.Clock
	Logger              Logger
	NewEventQueueWorker EventQueueWorkerFn
}

WorkerConfig encapsulates the configuration options for the changestream worker.

func (*WorkerConfig) Validate

func (c *WorkerConfig) Validate() error

Validate ensures that the config values are valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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