2021-11-01 22:51:41 +08:00
|
|
|
// Licensed to the LF AI & Data foundation under one
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
// distributed with this work for additional information
|
|
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
|
|
// to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance
|
2021-04-19 13:50:12 +08:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2021-11-01 22:51:41 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-04-19 13:50:12 +08:00
|
|
|
//
|
2021-11-01 22:51:41 +08:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2021-04-19 13:50:12 +08:00
|
|
|
|
2021-01-15 14:38:36 +08:00
|
|
|
package indexnode
|
2020-12-10 17:55:55 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-06-30 19:46:14 +08:00
|
|
|
"fmt"
|
2020-12-13 06:48:05 +08:00
|
|
|
|
2021-04-22 14:45:57 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/proto/indexpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/storage"
|
2020-12-10 17:55:55 +08:00
|
|
|
)
|
|
|
|
|
2022-08-25 15:48:54 +08:00
|
|
|
var (
|
2022-10-26 16:11:31 +08:00
|
|
|
errCancel = fmt.Errorf("canceled")
|
|
|
|
diskUsageRatio = 4.0
|
2021-02-07 21:32:37 +08:00
|
|
|
)
|
|
|
|
|
2022-03-21 14:23:24 +08:00
|
|
|
type Blob = storage.Blob
|
|
|
|
|
2022-08-25 15:48:54 +08:00
|
|
|
type task interface {
|
|
|
|
Ctx() context.Context
|
|
|
|
Name() string
|
|
|
|
OnEnqueue(context.Context) error
|
2024-06-06 17:37:51 +08:00
|
|
|
SetState(state indexpb.JobState, failReason string)
|
|
|
|
GetState() indexpb.JobState
|
|
|
|
PreExecute(context.Context) error
|
|
|
|
Execute(context.Context) error
|
|
|
|
PostExecute(context.Context) error
|
2022-08-25 15:48:54 +08:00
|
|
|
Reset()
|
2020-12-10 17:55:55 +08:00
|
|
|
}
|