refactor: rename Batch to Partition and update related types and channels for consistency

This commit is contained in:
2026-04-11 00:09:28 -05:00
parent cd0e53b1d2
commit 9eb9821daf
11 changed files with 69 additions and 48 deletions

View File

@@ -33,7 +33,7 @@ GROUP BY t.name`
return rowsCount, nil
}
func calculateBatchesMssql(ctx context.Context, db *sql.DB, tableInfo config.SourceTableInfo, batchCount int64) ([]models.Batch, error) {
func calculateBatchesMssql(ctx context.Context, db *sql.DB, tableInfo config.SourceTableInfo, batchCount int64) ([]models.Partition, error) {
query := fmt.Sprintf(`
SELECT
MIN([%s]) AS lower_limit,
@@ -58,10 +58,10 @@ ORDER BY batch_id`,
}
defer rows.Close()
batches := make([]models.Batch, 0, batchCount)
batches := make([]models.Partition, 0, batchCount)
for rows.Next() {
batch := models.Batch{
batch := models.Partition{
Id: uuid.New(),
ShouldUseRange: true,
RetryCounter: 0,
@@ -82,7 +82,7 @@ ORDER BY batch_id`,
return batches, nil
}
func batchGeneratorMssql(ctx context.Context, db *sql.DB, tableInfo config.SourceTableInfo, rowsPerBatch int64) ([]models.Batch, error) {
func batchGeneratorMssql(ctx context.Context, db *sql.DB, tableInfo config.SourceTableInfo, rowsPerBatch int64) ([]models.Partition, error) {
rowsCount, err := estimateTotalRowsMssql(ctx, db, tableInfo)
if err != nil {
return nil, err
@@ -92,7 +92,7 @@ func batchGeneratorMssql(ctx context.Context, db *sql.DB, tableInfo config.Sourc
if rowsCount > rowsPerBatch {
batchCount = rowsCount / rowsPerBatch
} else {
return []models.Batch{{
return []models.Partition{{
Id: uuid.New(),
ShouldUseRange: false,
RetryCounter: 0,