fetch

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(
	ctx context.Context,
	cfg Config,
	logger zerolog.Logger,
	conns dbconn.OrderedConns,
	blobStore datablobstorage.Store,
	tableFilter utils.FilterConfig,
	testingKnobs testutils.FetchTestingKnobs,
) (retErr error)

func GetColumnTypes added in v0.1.1

func GetColumnTypes(
	ctx context.Context,
	logger zerolog.Logger,
	conn dbconn.Conn,
	table dbtable.DBTable,
	skipUnsupportedTypeErr bool,
) (columnsWithType, error)

func GetConstraints added in v0.1.1

func GetConstraints(
	ctx context.Context, logger zerolog.Logger, conn dbconn.Conn, table dbtable.DBTable,
) ([]string, error)

func GetCreateTableStmt added in v0.1.1

func GetCreateTableStmt(
	ctx context.Context, logger zerolog.Logger, conn dbconn.Conn, table dbtable.DBTable,
) (string, error)

func GetDropTableStmt added in v0.1.1

func GetDropTableStmt(table dbtable.DBTable) (string, error)

func IsClearContinuationTokenMode added in v0.1.1

func IsClearContinuationTokenMode(cfg Config) bool

IsClearContinuationTokenMode determines if we must clear continuation tokens from the _molt_fetch_exceptions table. This is to ensure that there is only ever one set of active tokens at a time.

func IsImportCopyOnlyMode added in v0.1.1

func IsImportCopyOnlyMode(cfg Config) bool

func ListContinuationTokens added in v0.1.1

func ListContinuationTokens(
	ctx context.Context, testOnly bool, targetPgxConn *pgx.Conn, numResults int,
) (string, error)

Types

type Config

type Config struct {
	FlushSize            int
	FlushRows            int
	Cleanup              bool
	UseCopy              bool
	TableConcurrency     int
	Shards               int
	FetchID              string
	ContinuationToken    string
	ContinuationFileName string
	// TestOnly means this fetch attempt is just for test, and hence all time/duration
	// stats are deterministic.
	TestOnly bool

	// The target table handling configs.
	Truncate bool

	DropAndRecreateNewSchema bool

	// NonInteractive relates to if user input should be prompted. If false,
	// user prompting is initiating before certain actions like wiping data.
	// If true, user prompting will be skipped and actions will be confirmed automatically.
	NonInteractive bool

	Compression    compression.Flag
	ExportSettings dataexport.Settings
}

type CopyResult

type CopyResult struct {
	StartTime time.Time
	EndTime   time.Time
}

func Copy

func Copy(
	ctx context.Context,
	baseConn dbconn.Conn,
	logger zerolog.Logger,
	table dbtable.VerifiedTable,
	resources []datablobstorage.Resource,
	isLocal bool,
	isClearContinuationTokenMode bool,
	exceptionLog *status.ExceptionLog,
) (CopyResult, error)

type PGIface added in v0.1.1

type PGIface interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
}

type Pipe added in v0.1.1

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

func NewPipe added in v0.1.1

func NewPipe(b *bytes.Buffer) *Pipe

func (*Pipe) Close added in v0.1.1

func (p *Pipe) Close() error

func (*Pipe) CloseWithError added in v0.1.1

func (p *Pipe) CloseWithError(err error) error

func (*Pipe) Read added in v0.1.1

func (p *Pipe) Read(b []byte) (int, error)

Read from the buffer into b. It blocks if the buffer is empty and waits for the p.c.Signal call from write to wake and check the condition again.

func (*Pipe) Write added in v0.1.1

func (p *Pipe) Write(b []byte) (int, error)

Write copies bytes from b into the buffer and sends a signal to wake the reader that is in a wait state.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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