Documentation
¶
Index ¶
- func Destroy(ctx context.Context, config *InitConfig) error
- func Init(ctx context.Context, config *InitConfig) error
- func Run(ctx context.Context, logger loglib.Logger, config *Config, init bool, ...) error
- func Snapshot(ctx context.Context, logger loglib.Logger, config *Config, ...) error
- type Config
- func (c *Config) AccessTableSelection() TableSelection
- func (c *Config) GetInitConfig(opts ...InitOption) *InitConfig
- func (c *Config) IsValid() error
- func (c *Config) PostgresReplicationSlot() string
- func (c *Config) ReplicationTableSelection() TableSelection
- func (c *Config) RequiredTables() []string
- func (c *Config) SnapshotConnectionDemand() (demand uint, ok bool)
- func (c *Config) SnapshotTableSelection() TableSelection
- func (c *Config) SourcePostgresURL() string
- type ConfigStatus
- type InitConfig
- type InitOption
- type InitStatus
- type KafkaListenerConfig
- type KafkaProcessorConfig
- type ListenerConfig
- type MigrationStatus
- type PostgresListenerConfig
- type PostgresProcessorConfig
- type ProcessorConfig
- type ReplicationSlotStatus
- type SanitizeConfig
- type SchemaStatus
- type SearchProcessorConfig
- type SourceStatus
- type Status
- type StatusChecker
- type StatusErrors
- type StdoutProcessorConfig
- type TableSelection
- type TransformationRulesStatus
- type WebhookProcessorConfig
- type WebhookSubscriptionStoreConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Destroy ¶ added in v0.8.0
func Destroy(ctx context.Context, config *InitConfig) error
Destroy removes the pgstream state from the postgres database provided, as well as removing the replication slot.
func Init ¶
func Init(ctx context.Context, config *InitConfig) error
Init initialises the pgstream state in the postgres database provided, along with creating the relevant replication slot if it doesn't already exist.
Types ¶
type Config ¶
type Config struct {
Listener ListenerConfig
Processor ProcessorConfig
}
func (*Config) AccessTableSelection ¶ added in v1.2.0
func (c *Config) AccessTableSelection() TableSelection
func (*Config) GetInitConfig ¶ added in v1.0.0
func (c *Config) GetInitConfig(opts ...InitOption) *InitConfig
func (*Config) PostgresReplicationSlot ¶ added in v0.5.0
func (*Config) ReplicationTableSelection ¶ added in v1.2.0
func (c *Config) ReplicationTableSelection() TableSelection
func (*Config) RequiredTables ¶ added in v0.6.4
func (*Config) SnapshotConnectionDemand ¶ added in v1.2.0
SnapshotConnectionDemand reports the peak number of concurrent source connections the data snapshot will open (snapshot_workers × table_workers, with defaults applied), and whether a data snapshot is configured at all. Callers use ok to gate the resources preflight check: there's no demand to size when no data snapshot runs.
func (*Config) SnapshotTableSelection ¶ added in v1.2.0
func (c *Config) SnapshotTableSelection() TableSelection
func (*Config) SourcePostgresURL ¶ added in v0.5.0
type ConfigStatus ¶ added in v0.5.0
func (*ConfigStatus) PrettyPrint ¶ added in v0.5.0
func (cs *ConfigStatus) PrettyPrint() string
type InitConfig ¶ added in v1.0.0
type InitOption ¶ added in v1.0.0
type InitOption func(*InitConfig)
func WithMigrationsOnly ¶ added in v1.0.0
func WithMigrationsOnly() InitOption
func WithUpgrade ¶ added in v1.1.0
func WithUpgrade() InitOption
type InitStatus ¶ added in v0.5.0
type InitStatus struct {
PgstreamSchema *SchemaStatus
Migrations []MigrationStatus
ReplicationSlot *ReplicationSlotStatus
}
func (*InitStatus) GetErrors ¶ added in v0.5.0
func (is *InitStatus) GetErrors() []string
GetErrors aggregates all errors from the initialisation status.
func (*InitStatus) PrettyPrint ¶ added in v0.5.0
func (is *InitStatus) PrettyPrint() string
type KafkaListenerConfig ¶
type KafkaListenerConfig struct {
Reader kafka.ReaderConfig
Checkpointer kafkacheckpoint.Config
}
type KafkaProcessorConfig ¶
type KafkaProcessorConfig struct {
Writer *kafkaprocessor.Config
}
type ListenerConfig ¶
type ListenerConfig struct {
Postgres *PostgresListenerConfig
Kafka *KafkaListenerConfig
}
func (*ListenerConfig) IsValid ¶ added in v0.5.0
func (c *ListenerConfig) IsValid() error
type MigrationStatus ¶ added in v0.5.0
type PostgresListenerConfig ¶
type PostgresListenerConfig struct {
URL string
Replication pgreplication.Config
RetryPolicy backoff.Config
Snapshot *snapshotbuilder.SnapshotListenerConfig
}
type PostgresProcessorConfig ¶ added in v0.4.0
type ProcessorConfig ¶
type ProcessorConfig struct {
Kafka *KafkaProcessorConfig
Search *SearchProcessorConfig
Webhook *WebhookProcessorConfig
Postgres *PostgresProcessorConfig
Stdout *StdoutProcessorConfig
Injector *injector.Config
Transformer *transformer.Config
Filter *filter.Config
Sanitize *SanitizeConfig
}
func (*ProcessorConfig) IsValid ¶ added in v0.5.0
func (c *ProcessorConfig) IsValid() error
type ReplicationSlotStatus ¶ added in v0.5.0
type SanitizeConfig ¶ added in v1.1.0
type SanitizeConfig struct {
StripNullCharBytes bool
}
type SchemaStatus ¶ added in v0.5.0
type SearchProcessorConfig ¶
type SearchProcessorConfig struct {
Indexer search.IndexerConfig
Store store.Config
Retrier search.StoreRetryConfig
}
type SourceStatus ¶ added in v0.5.0
func (*SourceStatus) PrettyPrint ¶ added in v0.5.0
func (ss *SourceStatus) PrettyPrint() string
type Status ¶ added in v0.5.0
type Status struct {
Init *InitStatus
Config *ConfigStatus
TransformationRules *TransformationRulesStatus
Source *SourceStatus
}
func (*Status) GetErrors ¶ added in v0.5.0
func (s *Status) GetErrors() StatusErrors
func (*Status) PrettyPrint ¶ added in v0.5.0
type StatusChecker ¶ added in v0.5.0
type StatusChecker struct {
// contains filtered or unexported fields
}
StatusChecker is responsible for validating the status of the pgstream setup in a PostgreSQL database. It performs checks on the source database connection, initialization status (schema, migrations, replication slot), and transformation rules. It provides detailed status information, including errors, to help diagnose issues with the pgstream configuration and setup.
func NewStatusChecker ¶ added in v0.5.0
func NewStatusChecker() *StatusChecker
func (*StatusChecker) Status ¶ added in v0.5.0
Status retrieves the overall status of the pgstream setup, including the source database connection status, initialization status (schema, migrations, replication slot), and transformation rules validation status. It returns a detailed status report that includes any errors encountered during the checks, helping to diagnose issues with the pgstream configuration and setup.
func (*StatusChecker) TransformationRulesStatus ¶ added in v0.9.4
func (s *StatusChecker) TransformationRulesStatus(ctx context.Context, config *Config) (*TransformationRulesStatus, error)
TransformationRulesStatus validates that the transformation rules provided in the configuration are valid, in line with the validation performed during the pgstream run/snapshot commands.
type StatusErrors ¶ added in v0.5.0
func (StatusErrors) Keys ¶ added in v0.5.0
func (se StatusErrors) Keys() []string
type StdoutProcessorConfig ¶ added in v1.1.0
type StdoutProcessorConfig struct{}
type TableSelection ¶ added in v1.2.0
type TableSelection struct {
// contains filtered or unexported fields
}
TableSelection captures the include/exclude filter pgstream applies to the WAL stream. Empty include means "every user table is in scope"; exclude names tables to skip. Include and exclude are mutually exclusive at the source-config level (validated by the filter package).
func NewTableSelection ¶ added in v1.2.0
func NewTableSelection(include, exclude []string) (TableSelection, error)
func (TableSelection) Exclude ¶ added in v1.2.0
func (s TableSelection) Exclude() []string
func (TableSelection) Include ¶ added in v1.2.0
func (s TableSelection) Include() []string
func (TableSelection) IsTableInScope ¶ added in v1.2.0
func (s TableSelection) IsTableInScope(schema, table string) bool
IsTableInScope mirrors the precedence the wal filter applies to data (DML) events: exclude beats everything, an exact include entry beats a schema-only match, and a schema-only match beats a wildcard include.
func (TableSelection) IsUnfiltered ¶ added in v1.2.0
func (s TableSelection) IsUnfiltered() bool
type TransformationRulesStatus ¶ added in v0.5.0
func (*TransformationRulesStatus) PrettyPrint ¶ added in v0.5.0
func (trs *TransformationRulesStatus) PrettyPrint() string
type WebhookProcessorConfig ¶
type WebhookProcessorConfig struct {
Notifier notifier.Config
SubscriptionServer server.Config
SubscriptionStore WebhookSubscriptionStoreConfig
}