func NewGCWorker(store kv.Storage) (*GCWorker, error) {
	session, err := tidb.CreateSession(store)
	if err != nil {
		return nil, errors.Trace(err)
	}
	ver, err := store.CurrentVersion()
	if err != nil {
		return nil, errors.Trace(err)
	}
	hostName, err := os.Hostname()
	if err != nil {
		hostName = "unknown"
	}
	worker := &GCWorker{
		uuid:        strconv.FormatUint(ver.Ver, 16),
		desc:        fmt.Sprintf("host:%s, pid:%d, start at %s", hostName, os.Getpid(), time.Now()),
		store:       store.(*tikvStore),
		session:     session,
		gcIsRunning: false,
		lastFinish:  time.Now(),
		quit:        make(chan struct{}),
		done:        make(chan error),
	}
	go worker.start()
	return worker, nil
}
// NewGCWorker creates a GCWorker instance.
NewGCWorker creates a GCWorker instance.
// NewGCWorker creates a GCWorker instance .
func NewGCWorker(store kv.Storage) (*GCWorker, error) {
	session, err := tidb.CreateSession(store)
	if err != nil {
		return nil, errors.Trace(err)
	}
	ver, err := store.CurrentVersion()
	if err != nil {
		return nil, errors.Trace(err)
	}
	hostName, err := os.Hostname()
	if err != nil {
		hostName = "unknown"
	}
	worker := &GCWorker{
		uuid:        strconv.FormatUint(ver.Ver, 16),
		desc:        fmt.Sprintf("host:%s, pid:%d, start at %s", hostName, os.Getpid(), time.Now()),
		store:       store.(*tikvStore),
		session:     session,
		gcIsRunning: false,
		lastFinish:  time.Now(),
		quit:        make(chan struct{}),
		done:        make(chan error),
	}
	go worker.start()
	return worker, nil
}
func NewGCWorker ( store kv . Storage ) ( * GCWorker , error ) { session , err := tidb . CreateSession ( store ) if err != nil { return nil , errors . Trace ( err ) } ver , err := store . CurrentVersion ( ) if err != nil { return nil , errors . Trace ( err ) } hostName , err := os . Hostname ( ) if err != nil { hostName = " " } worker := & GCWorker { uuid : strconv . FormatUint ( ver . Ver , 16 ) , desc : fmt . Sprintf ( " " , hostName , os . Getpid ( ) , time . Now ( ) ) , store : store . ( * tikvStore ) , session : session , gcIsRunning : false , lastFinish : time . Now ( ) , quit : make ( chan struct { } ) , done : make ( chan error ) , } go worker . start ( ) return worker , nil }
NewGCWorker creates a GCWorker instance.
NewGCWorker creates a GCWorker instance .