github.com/qjfoidnh/BaiduPCS-Go@v0.0.0-20231011165705-caa18a3765f3/pcsutil/taskframework/taskinfo.go (about)

     1  package taskframework
     2  
     3  type (
     4  	TaskInfo struct {
     5  		id       string
     6  		maxRetry int
     7  		retry    int
     8  	}
     9  
    10  	TaskInfoItem struct {
    11  		Info *TaskInfo
    12  		Unit TaskUnit
    13  	}
    14  )
    15  
    16  // IsExceedRetry 重试次数达到限制
    17  func (t *TaskInfo) IsExceedRetry() bool {
    18  	return t.retry >= t.maxRetry
    19  }
    20  
    21  func (t *TaskInfo) Id() string {
    22  	return t.id
    23  }
    24  
    25  func (t *TaskInfo) MaxRetry() int {
    26  	return t.maxRetry
    27  }
    28  
    29  func (t *TaskInfo) SetMaxRetry(maxRetry int) {
    30  	t.maxRetry = maxRetry
    31  }
    32  
    33  func (t *TaskInfo) Retry() int {
    34  	return t.retry
    35  }