db_proto

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupDatabaseSchema

func SetupDatabaseSchema(
	ctx context.Context,
	dsnString string,
	schemaName string,
	outputModuleName string,
	rootMessageDescriptor protoreflect.MessageDescriptor,
	options SinkerFactoryOptions,
	logger *zap.Logger,
	tracer logging.Tracer,
) (protosql.Database, error)

SetupDatabaseSchema constructs the target Database for the given DSN and output message descriptor and ensures its schema exists: on a fresh database it creates the schema, tables and system tables and records the sink info hash; on an existing one it reconciles the sink info hash when a compatible migration is available. It returns the ready (but not opened) Database so callers can either start a sinker (run path) or stop right after schema setup (setup command). It is idempotent: on a database that is already set up with a matching hash, it performs no schema changes.

Types

type Holder

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

type Sinker

type Sinker struct {
	*sink.Sinker
	// contains filtered or unexported fields
}

func NewSinker

func NewSinker(rootMessageDescriptor protoreflect.MessageDescriptor, sink *sink.Sinker, db sql.Database, useTransaction bool, useConstraints bool, blockBatchSize int, parallel bool, stats *stats.Stats, logger *zap.Logger) *Sinker

func (*Sinker) HandleBlockScopedData

func (s *Sinker) HandleBlockScopedData(ctx context.Context, data *pbsubstreamsrpc.BlockScopedData, isLive *bool, cursor *sink.Cursor) (err error)

func (*Sinker) HandleBlockUndoSignal

func (s *Sinker) HandleBlockUndoSignal(ctx context.Context, undoSignal *pbsubstreamsrpc.BlockUndoSignal, cursor *sink.Cursor) (err error)

func (*Sinker) LogStats

func (s *Sinker) LogStats()

func (*Sinker) Run

func (s *Sinker) Run(ctx context.Context) error

type SinkerFactoryClickhouse

type SinkerFactoryClickhouse struct {
	SinkInfoFolder  string
	CursorFilePath  string
	QueryRetryCount int
	QueryRetrySleep time.Duration
}

type SinkerFactoryFunc

type SinkerFactoryFunc func(ctx context.Context, dsnString, schemaName string, logger *zap.Logger, tracer logging.Tracer) (*Sinker, error)

func SinkerFactory

func SinkerFactory(
	baseSink *sink.Sinker,
	outputModuleName string,
	rootMessageDescriptor protoreflect.MessageDescriptor,
	options SinkerFactoryOptions,
) SinkerFactoryFunc

type SinkerFactoryOptions

type SinkerFactoryOptions struct {
	UseProtoOption  bool
	UseConstraints  bool
	UseTransactions bool
	BlockBatchSize  int
	Parallel        bool
	Encoding        bytes.Encoding
	Clickhouse      SinkerFactoryClickhouse
}

func (SinkerFactoryOptions) Defaults

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

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