2020-11-03 14:53:36 +08:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb"
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/util/typeutil"
|
|
|
|
)
|
|
|
|
|
|
|
|
//type TimeStamp uint64
|
|
|
|
|
|
|
|
type task interface {
|
|
|
|
Id() int64 // return ReqId
|
2020-11-04 16:01:28 +08:00
|
|
|
Type() internalpb.ReqType
|
2020-11-03 14:53:36 +08:00
|
|
|
GetTs() typeutil.Timestamp
|
|
|
|
SetTs(ts typeutil.Timestamp)
|
|
|
|
PreExecute() error
|
|
|
|
Execute() error
|
|
|
|
PostExecute() error
|
|
|
|
WaitToFinish() error
|
|
|
|
Notify() error
|
|
|
|
}
|
|
|
|
|
|
|
|
type baseTask struct {
|
2020-11-04 16:01:28 +08:00
|
|
|
ReqType internalpb.ReqType
|
2020-11-03 14:53:36 +08:00
|
|
|
ReqId int64
|
|
|
|
Ts typeutil.Timestamp
|
|
|
|
ProxyId int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bt *baseTask) Id() int64 {
|
|
|
|
return bt.ReqId
|
|
|
|
}
|
|
|
|
|
2020-11-04 16:01:28 +08:00
|
|
|
func (bt *baseTask) Type() internalpb.ReqType {
|
2020-11-03 14:53:36 +08:00
|
|
|
return bt.ReqType
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bt *baseTask) GetTs() typeutil.Timestamp {
|
|
|
|
return bt.Ts
|
|
|
|
}
|
|
|
|
|
|
|
|
func (bt *baseTask) SetTs(ts typeutil.Timestamp) {
|
|
|
|
bt.Ts = ts
|
|
|
|
}
|