conduit

package
v0.13.0-nightly.20241019 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 62 Imported by: 1

Documentation

Overview

Package conduit wires up everything under the hood of a Conduit instance including metrics, telemetry, logging, and server construction. It should only ever interact with the Orchestrator, never individual services. All of that responsibility should be left to the Orchestrator.

Index

Constants

View Source
const (
	DBTypeBadger   = "badger"
	DBTypePostgres = "postgres"
	DBTypeInMemory = "inmemory"
	DBTypeSQLite   = "sqlite"

	SchemaRegistryTypeConfluent = "confluent"
	SchemaRegistryTypeBuiltin   = "builtin"
)

Variables

This section is empty.

Functions

func Serve added in v0.7.2

func Serve(cfg Config)

Serve is a shortcut for Entrypoint.Serve.

func Version

func Version(appendOSArch bool) string

Types

type Config

type Config struct {
	DB struct {
		// When Driver is specified it takes precedence over other DB related
		// fields.
		Driver database.DB

		Type   string
		Badger struct {
			Path string
		}
		Postgres struct {
			ConnectionString string
			Table            string
		}
		SQLite struct {
			Path  string
			Table string
		}
	}

	API struct {
		Enabled bool

		HTTP struct {
			Address string
		}
		GRPC struct {
			Address string
		}
	}

	Log struct {
		NewLogger func(level, format string) log.CtxLogger
		Level     string
		Format    string
	}

	Connectors struct {
		Path string
	}

	Processors struct {
		Path string
	}

	Pipelines struct {
		Path           string
		ExitOnDegraded bool
		ErrorRecovery  struct {
			// MinDelay is the minimum delay before restart: Default: 1 second
			MinDelay time.Duration
			// MaxDelay is the maximum delay before restart: Default: 10 minutes
			MaxDelay time.Duration
			// BackoffFactor is the factor by which the delay is multiplied after each restart: Default: 2
			BackoffFactor int
			// MaxRetries is the maximum number of restarts before the pipeline is considered unhealthy: Default: -1 (infinite)
			MaxRetries int64
			// MaxRetriesWindow is the duration window in which the max retries are counted: Default: 5 minutes
			MaxRetriesWindow time.Duration
		}
	}

	ConnectorPlugins map[string]sdk.Connector

	SchemaRegistry struct {
		Type string

		Confluent struct {
			ConnectionString string
		}
	}
	// contains filtered or unexported fields
}

Config holds all configurable values for Conduit.

func DefaultConfig added in v0.7.2

func DefaultConfig() Config

func (Config) Validate

func (c Config) Validate() error

type Entrypoint added in v0.7.2

type Entrypoint struct{}

Entrypoint provides methods related to the Conduit entrypoint (parsing config, managing interrupt signals etc.).

func (*Entrypoint) CancelOnInterrupt added in v0.7.2

func (*Entrypoint) CancelOnInterrupt(ctx context.Context) context.Context

CancelOnInterrupt returns a context that is canceled when the interrupt signal is received. * After the first signal the function will continue to listen * On the second signal executes a hard exit, without waiting for a graceful shutdown.

func (*Entrypoint) Flags added in v0.7.2

func (*Entrypoint) Flags(cfg *Config) *flag.FlagSet

Flags returns a flag set that, when parsed, stores the values in the provided config struct.

func (*Entrypoint) ParseConfig added in v0.7.2

func (e *Entrypoint) ParseConfig(flags *flag.FlagSet)

func (*Entrypoint) Serve added in v0.7.2

func (e *Entrypoint) Serve(cfg Config)

Serve is the entrypoint for Conduit. It is a convenience function if you want to tweak the Conduit CLI and inject different default values or built-in plugins while retaining the same flags and exit behavior. You can adjust the default values by setting the corresponding field in Config. The default config can be retrieved with DefaultConfig. The config will be populated with values parsed from:

  • command line flags (highest priority)
  • environment variables
  • config file (lowest priority)

func (*Entrypoint) Splash added in v0.7.2

func (*Entrypoint) Splash() string

type Runtime

type Runtime struct {
	Config Config

	DB               database.DB
	Orchestrator     *orchestrator.Orchestrator
	ProvisionService *provisioning.Service
	SchemaRegistry   schemaregistry.Registry

	// Ready will be closed when Runtime has successfully started
	Ready chan struct{}
	// contains filtered or unexported fields
}

Runtime sets up all services for serving and monitoring a Conduit instance.

func NewRuntime

func NewRuntime(cfg Config) (*Runtime, error)

NewRuntime sets up a Runtime instance and primes it for start.

func (*Runtime) Run

func (r *Runtime) Run(ctx context.Context) (err error)

Run initializes all of Conduit's underlying services and starts the GRPC and HTTP APIs. This function blocks until the supplied context is cancelled or one of the services experiences a fatal error.

Jump to

Keyboard shortcuts

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