// ForbidPurge implements PurgeInterceptor.ForbidPurge.
ForbidPurge implements PurgeInterceptor.ForbidPurge.
// ForbidPurge implements PurgeInterceptor . ForbidPurge .
func (w *SourceWorker) ForbidPurge() (bool, string) {
	if w.closed.Load() {
		return false, ""
	}
	for _, st := range w.subTaskHolder.getAllSubTasks() {
		stage := st.Stage()
		if stage == pb.Stage_New || stage == pb.Stage_Paused {
			return true, fmt.Sprintf("sub task %s current stage is %s", st.cfg.Name, stage.String())
		}
	}
	return false, ""
}
func ( w * SourceWorker ) ForbidPurge ( ) ( bool , string ) { if w . closed . Load ( ) { return false , " " } for _ , st := range w . subTaskHolder . getAllSubTasks ( ) { stage := st . Stage ( ) if stage == pb . Stage_New || stage == pb . Stage_Paused { return true , fmt . Sprintf ( " " , st . cfg . Name , stage . String ( ) ) } } return false , " " }
ForbidPurge implements PurgeInterceptor.ForbidPurge.
ForbidPurge implements PurgeInterceptor . ForbidPurge .
// forbid purging if some sub tasks are paused, so we can debug the system easily // This function is not protected by `w.RWMutex`, which may lead to sub tasks information // not up to date, but do not affect correctness.