func (p *Plan) ShouldProceed() bool {
	return p.nextMint < p.config.Maxt
}
ShouldProceed reports whether the fetching process should proceeds further. If any time-range is left to be
fetched from the provided time-range, it returns true, else false.
package planner
import (
	"context"
	"fmt"
	"os"
	"sync"
	"sync/atomic"
	"time"
	"github.com/prometheus/common/config"
	"github.com/prometheus/prometheus/pkg/labels"
	"github.com/prometheus/prometheus/pkg/timestamp"
	"github.com/schollz/progressbar/v3"
	"github.com/timescale/promscale/pkg/log"
	"github.com/timescale/promscale/pkg/migration-tool/utils"
)
const numStepsWriter = 5  
var (
	second = time.Second.Milliseconds()
	minute = time.Minute.Milliseconds()
)
type Config struct {
	Mint                 int64
	Maxt                 int64
	SlabSizeLimitBytes   int64
	NumStores            int
	ProgressEnabled      bool
	JobName              string
	ProgressMetricName   string  
	ProgressClientConfig utils.ClientConfig
	HTTPConfig           config.HTTPClientConfig
	LaIncrement          time.Duration
	MaxReadDuration      time.Duration
	HumanReadableTime    bool
}
type Plan struct {
	config *Config
	slabCounts         int64  
	pbarMux            *sync.Mutex
	nextMint           int64
	lastNumBytes       int64
	lastTimeRangeDelta int64
	deltaIncRegion     int64  
	Quiet         bool    
	TestCheckFunc func()  
}
func Init(config *Config) (*Plan, bool, error) {
	var found bool
	if config.ProgressEnabled {
		if config.ProgressClientConfig.URL == "" {
			return nil, false, fmt.Errorf("read url for remote-write storage should be provided when progress metric is enabled")
		}
		lastPushedMaxt, found, err := config.fetchLastPushedMaxt()
		if err != nil {
			return nil, false, fmt.Errorf("init plan: %w", err)
		}
		if found && lastPushedMaxt > config.Mint && lastPushedMaxt <= config.Maxt {
			config.Mint = lastPushedMaxt
			timeRange := fmt.Sprintf("time-range: %d mins", (config.Maxt-lastPushedMaxt+1)/minute)
			log.Warn("msg", fmt.Sprintf("Resuming from where we left off. Last push was on %d. "+
				"Resuming from mint: %d to maxt: %d %s", lastPushedMaxt, config.Mint, config.Maxt, timeRange))
		}
	} else {
		log.Info("msg", "Resuming from where we left off is turned off. Starting at the beginning of the provided time-range.")
	}
	if config.Mint >= config.Maxt && found {
		log.Info("msg", "mint greater than or equal to maxt. Migration is already complete.")
		return nil, false, nil
	} else if config.Mint >= config.Maxt && !found {
		return nil, false, fmt.Errorf("mint cannot be greater than maxt: mint %d maxt %d", config.Mint, config.Mint)
	}
	plan := &Plan{
		config:         config,
		pbarMux:        new(sync.Mutex),
		nextMint:       config.Mint,
		deltaIncRegion: config.SlabSizeLimitBytes / 2,  
	}
	return plan, true, nil
}
func (c *Config) fetchLastPushedMaxt() (lastPushedMaxt int64, found bool, err error) {
	query, err := utils.CreatePrombQuery(c.Mint, c.Maxt, []*labels.Matcher{
		labels.MustNewMatcher(labels.MatchEqual, labels.MetricName, c.ProgressMetricName),
		labels.MustNewMatcher(labels.MatchEqual, utils.LabelJob, c.JobName),
	})
	if err != nil {
		return -1, false, fmt.Errorf("fetch-last-pushed-maxt create promb query: %w", err)
	}
	readClient, err := utils.NewClient("reader-last-maxt-pushed", c.ProgressClientConfig, c.HTTPConfig)
	if err != nil {
		return -1, false, fmt.Errorf("create fetch-last-pushed-maxt reader: %w", err)
	}
	result, _, _, err := readClient.Read(context.Background(), query, "")
	if err != nil {
		return -1, false, fmt.Errorf("fetch-last-pushed-maxt query result: %w", err)
	}
	ts := result.Timeseries
	if len(ts) == 0 {
		return -1, false, nil
	}
	for _, series := range ts {
		for i := len(series.Samples) - 1; i >= 0; i-- {
			if series.Samples[i].Timestamp > lastPushedMaxt {
				lastPushedMaxt = series.Samples[i].Timestamp
			}
		}
	}
	if lastPushedMaxt == 0 {
		return -1, false, nil
	}
	return lastPushedMaxt, true, nil
}
func (p *Plan) DecrementSlabCount() {
	atomic.AddInt64(&p.slabCounts, -1)
}