Documentation
¶
Overview ¶
Package copier copies rows from one table to another. it makes use of tableinfo.Chunker, and does the parallelism and retries here. It fails on the first error.
Index ¶
- type Copier
- type CopierConfig
- type Unbuffered
- func (c *Unbuffered) CopyChunk(ctx context.Context, chunk *table.Chunk) error
- func (c *Unbuffered) GetChunker() table.Chunker
- func (c *Unbuffered) GetETA() string
- func (c *Unbuffered) GetProgress() string
- func (c *Unbuffered) GetThrottler() throttler.Throttler
- func (c *Unbuffered) Run(ctx context.Context) error
- func (c *Unbuffered) SetThrottler(throttler throttler.Throttler)
- func (c *Unbuffered) StartTime() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Copier ¶
type Copier interface {
Run(ctx context.Context) error
GetETA() string
GetChunker() table.Chunker
SetThrottler(throttler throttler.Throttler)
GetThrottler() throttler.Throttler
StartTime() time.Time
GetProgress() string
}
Copier is the interface which copiers use. Currently we only have one implementation, which we call unbuffered because it uses INSERT .. SELECT without any intermediate buffering in spirit. In future we may have another implementation, see: https://github.com/block/spirit/issues/451
type CopierConfig ¶
type CopierConfig struct {
Concurrency int
TargetChunkTime time.Duration
Throttler throttler.Throttler
Logger *slog.Logger
MetricsSink metrics.Sink
DBConfig *dbconn.DBConfig
UseExperimentalBufferedCopier bool
Applier applier.Applier
}
func NewCopierDefaultConfig ¶
func NewCopierDefaultConfig() *CopierConfig
NewCopierDefaultConfig returns a default config for the copier.
type Unbuffered ¶
func (*Unbuffered) CopyChunk ¶
CopyChunk copies a chunk from the table to the newTable. it is public so it can be used in tests incrementally.
func (*Unbuffered) GetChunker ¶
func (c *Unbuffered) GetChunker() table.Chunker
GetChunker returns the chunker for accessing progress information
func (*Unbuffered) GetETA ¶
func (c *Unbuffered) GetETA() string
func (*Unbuffered) GetProgress ¶
func (c *Unbuffered) GetProgress() string
GetProgress returns the progress of the copier
func (*Unbuffered) GetThrottler ¶
func (c *Unbuffered) GetThrottler() throttler.Throttler
func (*Unbuffered) SetThrottler ¶
func (c *Unbuffered) SetThrottler(throttler throttler.Throttler)
func (*Unbuffered) StartTime ¶
func (c *Unbuffered) StartTime() time.Time