mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
enhance: add file resource api (#43766)
relate: https://github.com/milvus-io/milvus/issues/43687 Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
parent
5b83975d39
commit
eca51ed2c6
2
go.mod
2
go.mod
@ -21,7 +21,7 @@ require (
|
|||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||||
github.com/klauspost/compress v1.17.9
|
github.com/klauspost/compress v1.17.9
|
||||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
|
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.1-0.20250806032933-1b94535b80c3
|
||||||
github.com/minio/minio-go/v7 v7.0.73
|
github.com/minio/minio-go/v7 v7.0.73
|
||||||
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
||||||
github.com/pingcap/log v1.1.1-0.20221015072633-39906604fb81
|
github.com/pingcap/log v1.1.1-0.20221015072633-39906604fb81
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -740,8 +740,8 @@ github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6 h1:YHMFI6L
|
|||||||
github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg=
|
github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg=
|
||||||
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8=
|
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8=
|
||||||
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4=
|
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4=
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0 h1:SJLdKkifvPDT31jw0hzC7/KSlZ5tv5AhPt77jNHMAQY=
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.1-0.20250806032933-1b94535b80c3 h1:AK0kGIj/nUiGkSodqtaOJPLeIvEYV2HICr8eaChQ4RA=
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.1-0.20250806032933-1b94535b80c3/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
||||||
github.com/milvus-io/pulsar-client-go v0.12.1 h1:O2JZp1tsYiO7C0MQ4hrUY/aJXnn2Gry6hpm7UodghmE=
|
github.com/milvus-io/pulsar-client-go v0.12.1 h1:O2JZp1tsYiO7C0MQ4hrUY/aJXnn2Gry6hpm7UodghmE=
|
||||||
github.com/milvus-io/pulsar-client-go v0.12.1/go.mod h1:dkutuH4oS2pXiGm+Ti7fQZ4MRjrMPZ8IJeEGAWMeckk=
|
github.com/milvus-io/pulsar-client-go v0.12.1/go.mod h1:dkutuH4oS2pXiGm+Ti7fQZ4MRjrMPZ8IJeEGAWMeckk=
|
||||||
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs=
|
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs=
|
||||||
|
|||||||
@ -45,6 +45,12 @@ func NewGlobalIDAllocator(key string, base kv.TxnKV) *GlobalIDAllocator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewTestGlobalIDAllocator(allocator tso.Allocator) *GlobalIDAllocator {
|
||||||
|
return &GlobalIDAllocator{
|
||||||
|
allocator: allocator,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize will initialize the created global TSO allocator.
|
// Initialize will initialize the created global TSO allocator.
|
||||||
func (gia *GlobalIDAllocator) Initialize() error {
|
func (gia *GlobalIDAllocator) Initialize() error {
|
||||||
return gia.allocator.Initialize()
|
return gia.allocator.Initialize()
|
||||||
|
|||||||
@ -1081,3 +1081,18 @@ func (s *mixCoordImpl) ListLoadedSegments(ctx context.Context, req *querypb.List
|
|||||||
func (s *mixCoordImpl) FlushAll(ctx context.Context, req *datapb.FlushAllRequest) (*datapb.FlushAllResponse, error) {
|
func (s *mixCoordImpl) FlushAll(ctx context.Context, req *datapb.FlushAllRequest) (*datapb.FlushAllResponse, error) {
|
||||||
return s.datacoordServer.FlushAll(ctx, req)
|
return s.datacoordServer.FlushAll(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource
|
||||||
|
func (s *mixCoordImpl) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return s.datacoordServer.AddFileResource(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource
|
||||||
|
func (s *mixCoordImpl) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return s.datacoordServer.RemoveFileResource(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources list file resources
|
||||||
|
func (s *mixCoordImpl) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
return s.datacoordServer.ListFileResources(ctx, req)
|
||||||
|
}
|
||||||
|
|||||||
@ -64,6 +64,7 @@ func (s *ImportCheckerSuite) SetupTest() {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
s.alloc = allocator.NewMockAllocator(s.T())
|
s.alloc = allocator.NewMockAllocator(s.T())
|
||||||
|
|
||||||
@ -574,6 +575,7 @@ func TestImportCheckerCompaction(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
alloc := allocator.NewMockAllocator(t)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,7 @@ func (s *ImportInspectorSuite) SetupTest() {
|
|||||||
s.catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
s.catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
s.catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
s.catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
s.catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
s.catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
s.catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
s.cluster = NewMockCluster(s.T())
|
s.cluster = NewMockCluster(s.T())
|
||||||
s.alloc = allocator.NewMockAllocator(s.T())
|
s.alloc = allocator.NewMockAllocator(s.T())
|
||||||
|
|||||||
@ -133,6 +133,7 @@ func TestImportUtil_NewImportTasks(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
broker := broker.NewMockBroker(t)
|
broker := broker.NewMockBroker(t)
|
||||||
broker.EXPECT().ShowCollectionIDs(mock.Anything).Return(nil, nil)
|
broker.EXPECT().ShowCollectionIDs(mock.Anything).Return(nil, nil)
|
||||||
@ -205,6 +206,7 @@ func TestImportUtil_NewImportTasksWithDataTt(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
broker := broker2.NewMockBroker(t)
|
broker := broker2.NewMockBroker(t)
|
||||||
broker.EXPECT().ShowCollectionIDs(mock.Anything).Return(&rootcoordpb.ShowCollectionIDsResponse{}, nil)
|
broker.EXPECT().ShowCollectionIDs(mock.Anything).Return(&rootcoordpb.ShowCollectionIDsResponse{}, nil)
|
||||||
@ -265,6 +267,7 @@ func TestImportUtil_AssembleRequest(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
alloc := allocator.NewMockAllocator(t)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
alloc.EXPECT().AllocN(mock.Anything).RunAndReturn(func(n int64) (int64, int64, error) {
|
alloc.EXPECT().AllocN(mock.Anything).RunAndReturn(func(n int64) (int64, int64, error) {
|
||||||
@ -340,6 +343,7 @@ func TestImportUtil_AssembleRequestWithDataTt(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
alloc := allocator.NewMockAllocator(t)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
alloc.EXPECT().AllocN(mock.Anything).RunAndReturn(func(n int64) (int64, int64, error) {
|
alloc.EXPECT().AllocN(mock.Anything).RunAndReturn(func(n int64) (int64, int64, error) {
|
||||||
@ -424,6 +428,7 @@ func TestImportUtil_CheckDiskQuota(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
importMeta, err := NewImportMeta(context.TODO(), catalog, nil, nil)
|
importMeta, err := NewImportMeta(context.TODO(), catalog, nil, nil)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -611,6 +616,7 @@ func TestImportUtil_GetImportProgress(t *testing.T) {
|
|||||||
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListCompactionTask(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListPartitionStatsInfos(mock.Anything).Return(nil, nil)
|
||||||
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
catalog.EXPECT().ListStatsTasks(mock.Anything).Return(nil, nil)
|
||||||
|
catalog.EXPECT().ListFileResource(mock.Anything).Return(nil, nil)
|
||||||
|
|
||||||
importMeta, err := NewImportMeta(context.TODO(), catalog, nil, nil)
|
importMeta, err := NewImportMeta(context.TODO(), catalog, nil, nil)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
||||||
"github.com/milvus-io/milvus/internal/datacoord/broker"
|
"github.com/milvus-io/milvus/internal/datacoord/broker"
|
||||||
"github.com/milvus-io/milvus/internal/metastore"
|
"github.com/milvus-io/milvus/internal/metastore"
|
||||||
|
"github.com/milvus-io/milvus/internal/metastore/model"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
"github.com/milvus-io/milvus/internal/util/segmentutil"
|
"github.com/milvus-io/milvus/internal/util/segmentutil"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/common"
|
"github.com/milvus-io/milvus/pkg/v2/common"
|
||||||
@ -98,6 +99,10 @@ type meta struct {
|
|||||||
partitionStatsMeta *partitionStatsMeta
|
partitionStatsMeta *partitionStatsMeta
|
||||||
compactionTaskMeta *compactionTaskMeta
|
compactionTaskMeta *compactionTaskMeta
|
||||||
statsTaskMeta *statsTaskMeta
|
statsTaskMeta *statsTaskMeta
|
||||||
|
|
||||||
|
// File Resource Meta
|
||||||
|
resourceMeta map[string]*model.FileResource
|
||||||
|
resourceLock lock.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meta) GetIndexMeta() *indexMeta {
|
func (m *meta) GetIndexMeta() *indexMeta {
|
||||||
@ -190,6 +195,7 @@ func newMeta(ctx context.Context, catalog metastore.DataCoordCatalog, chunkManag
|
|||||||
partitionStatsMeta: psm,
|
partitionStatsMeta: psm,
|
||||||
compactionTaskMeta: ctm,
|
compactionTaskMeta: ctm,
|
||||||
statsTaskMeta: stm,
|
statsTaskMeta: stm,
|
||||||
|
resourceMeta: make(map[string]*model.FileResource),
|
||||||
}
|
}
|
||||||
err = mt.reloadFromKV(ctx, broker)
|
err = mt.reloadFromKV(ctx, broker)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -297,6 +303,11 @@ func (m *meta) reloadFromKV(ctx context.Context, broker broker.Broker) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load FileResource meta
|
||||||
|
if err := m.reloadFileResourceMeta(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
log.Ctx(ctx).Info("DataCoord meta reloadFromKV done", zap.Int("numSegments", numSegments), zap.Duration("duration", record.ElapseSpan()))
|
log.Ctx(ctx).Info("DataCoord meta reloadFromKV done", zap.Int("numSegments", numSegments), zap.Duration("duration", record.ElapseSpan()))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2325,3 +2336,63 @@ func contains(arr []int64, target int64) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reloadFileResourceMeta load file resource meta from catalog
|
||||||
|
func (m *meta) reloadFileResourceMeta(ctx context.Context) error {
|
||||||
|
m.resourceLock.Lock()
|
||||||
|
defer m.resourceLock.Unlock()
|
||||||
|
|
||||||
|
resources, err := m.catalog.ListFileResource(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
m.resourceMeta = make(map[string]*model.FileResource)
|
||||||
|
for _, resource := range resources {
|
||||||
|
m.resourceMeta[resource.Name] = resource
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource to meta
|
||||||
|
func (m *meta) AddFileResource(ctx context.Context, resource *model.FileResource) error {
|
||||||
|
m.resourceLock.Lock()
|
||||||
|
defer m.resourceLock.Unlock()
|
||||||
|
|
||||||
|
if _, ok := m.resourceMeta[resource.Name]; ok {
|
||||||
|
return merr.WrapErrAsInputError(fmt.Errorf("create resource failed: resource name exist"))
|
||||||
|
}
|
||||||
|
|
||||||
|
err := m.catalog.SaveFileResource(ctx, resource)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
m.resourceMeta[resource.Name] = resource
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource from meta
|
||||||
|
func (m *meta) RemoveFileResource(ctx context.Context, name string) error {
|
||||||
|
m.resourceLock.Lock()
|
||||||
|
defer m.resourceLock.Unlock()
|
||||||
|
|
||||||
|
if resource, ok := m.resourceMeta[name]; ok {
|
||||||
|
err := m.catalog.RemoveFileResource(ctx, resource.ID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(m.resourceMeta, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResource list file resources from meta
|
||||||
|
func (m *meta) ListFileResource(ctx context.Context) []*model.FileResource {
|
||||||
|
m.resourceLock.RLock()
|
||||||
|
defer m.resourceLock.RUnlock()
|
||||||
|
|
||||||
|
return lo.Values(m.resourceMeta)
|
||||||
|
}
|
||||||
|
|||||||
@ -128,6 +128,8 @@ func (suite *MetaReloadSuite) TestReloadFromKV() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
|
suite.catalog.EXPECT().ListFileResource(mock.Anything).Return([]*model.FileResource{}, nil)
|
||||||
suite.catalog.EXPECT().ListIndexes(mock.Anything).Return([]*model.Index{}, nil)
|
suite.catalog.EXPECT().ListIndexes(mock.Anything).Return([]*model.Index{}, nil)
|
||||||
suite.catalog.EXPECT().ListSegmentIndexes(mock.Anything).Return([]*model.SegmentIndex{}, nil)
|
suite.catalog.EXPECT().ListSegmentIndexes(mock.Anything).Return([]*model.SegmentIndex{}, nil)
|
||||||
suite.catalog.EXPECT().ListAnalyzeTasks(mock.Anything).Return(nil, nil)
|
suite.catalog.EXPECT().ListAnalyzeTasks(mock.Anything).Return(nil, nil)
|
||||||
@ -173,6 +175,7 @@ func (suite *MetaReloadSuite) TestReloadFromKV() {
|
|||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
|
suite.catalog.EXPECT().ListFileResource(mock.Anything).Return([]*model.FileResource{}, nil)
|
||||||
suite.catalog.EXPECT().ListIndexes(mock.Anything).Return([]*model.Index{}, nil)
|
suite.catalog.EXPECT().ListIndexes(mock.Anything).Return([]*model.Index{}, nil)
|
||||||
suite.catalog.EXPECT().ListSegmentIndexes(mock.Anything).Return([]*model.SegmentIndex{}, nil)
|
suite.catalog.EXPECT().ListSegmentIndexes(mock.Anything).Return([]*model.SegmentIndex{}, nil)
|
||||||
suite.catalog.EXPECT().ListAnalyzeTasks(mock.Anything).Return(nil, nil)
|
suite.catalog.EXPECT().ListAnalyzeTasks(mock.Anything).Return(nil, nil)
|
||||||
|
|||||||
@ -904,6 +904,20 @@ func (s *mockMixCoord) RegisterStreamingCoordGRPCService(server *grpc.Server) {
|
|||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource to datacoord
|
||||||
|
func (s *mockMixCoord) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource from datacoord
|
||||||
|
func (s *mockMixCoord) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *mockMixCoord) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
panic("implement me")
|
||||||
|
}
|
||||||
|
|
||||||
type mockHandler struct {
|
type mockHandler struct {
|
||||||
meta *meta
|
meta *meta
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
|
||||||
"github.com/milvus-io/milvus/internal/coordinator/snmanager"
|
"github.com/milvus-io/milvus/internal/coordinator/snmanager"
|
||||||
"github.com/milvus-io/milvus/internal/metastore/kv/binlog"
|
"github.com/milvus-io/milvus/internal/metastore/kv/binlog"
|
||||||
|
"github.com/milvus-io/milvus/internal/metastore/model"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
"github.com/milvus-io/milvus/internal/util/componentutil"
|
"github.com/milvus-io/milvus/internal/util/componentutil"
|
||||||
"github.com/milvus-io/milvus/internal/util/importutilv2"
|
"github.com/milvus-io/milvus/internal/util/importutilv2"
|
||||||
@ -2031,3 +2032,84 @@ func (s *Server) NotifyDropPartition(ctx context.Context, channel string, partit
|
|||||||
// release all segments of the partition.
|
// release all segments of the partition.
|
||||||
return s.meta.DropSegmentsOfPartition(ctx, partitionIDs)
|
return s.meta.DropSegmentsOfPartition(ctx, partitionIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource to datacoord
|
||||||
|
func (s *Server) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
if err := merr.CheckHealthy(s.GetStateCode()); err != nil {
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Ctx(ctx).Info("receive AddFileResource request",
|
||||||
|
zap.String("name", req.GetName()),
|
||||||
|
zap.String("path", req.GetPath()))
|
||||||
|
|
||||||
|
id, err := s.idAllocator.AllocOne()
|
||||||
|
if err != nil {
|
||||||
|
log.Ctx(ctx).Warn("AddFileResource alloc id failed", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert to model.FileResource
|
||||||
|
resource := &model.FileResource{
|
||||||
|
ID: id,
|
||||||
|
Name: req.GetName(),
|
||||||
|
Path: req.GetPath(),
|
||||||
|
Type: req.GetType(),
|
||||||
|
}
|
||||||
|
|
||||||
|
err = s.meta.AddFileResource(ctx, resource)
|
||||||
|
if err != nil {
|
||||||
|
log.Ctx(ctx).Warn("AddFileResource fail", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Ctx(ctx).Info("AddFileResource success")
|
||||||
|
return merr.Success(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource from datacoord
|
||||||
|
func (s *Server) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
if err := merr.CheckHealthy(s.GetStateCode()); err != nil {
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Ctx(ctx).Info("receive RemoveFileResource request",
|
||||||
|
zap.String("name", req.GetName()))
|
||||||
|
|
||||||
|
err := s.meta.RemoveFileResource(ctx, req.GetName())
|
||||||
|
if err != nil {
|
||||||
|
log.Ctx(ctx).Warn("RemoveFileResource fail", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Ctx(ctx).Info("RemoveFileResource success")
|
||||||
|
return merr.Success(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources list file resources from datacoord
|
||||||
|
func (s *Server) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
if err := merr.CheckHealthy(s.GetStateCode()); err != nil {
|
||||||
|
return &milvuspb.ListFileResourcesResponse{
|
||||||
|
Status: merr.Status(err),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Ctx(ctx).Info("receive ListFileResources request")
|
||||||
|
|
||||||
|
resources := s.meta.ListFileResource(ctx)
|
||||||
|
|
||||||
|
// Convert model.FileResource to milvuspb.FileResourceInfo
|
||||||
|
fileResources := make([]*milvuspb.FileResourceInfo, 0, len(resources))
|
||||||
|
for _, resource := range resources {
|
||||||
|
fileResources = append(fileResources, &milvuspb.FileResourceInfo{
|
||||||
|
Name: resource.Name,
|
||||||
|
Path: resource.Path,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Ctx(ctx).Info("ListFileResources success", zap.Int("count", len(fileResources)))
|
||||||
|
return &milvuspb.ListFileResourcesResponse{
|
||||||
|
Status: merr.Success(),
|
||||||
|
Resources: fileResources,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package datacoord
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
||||||
|
globalIDAllocator "github.com/milvus-io/milvus/internal/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/datacoord/allocator"
|
"github.com/milvus-io/milvus/internal/datacoord/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/datacoord/broker"
|
"github.com/milvus-io/milvus/internal/datacoord/broker"
|
||||||
"github.com/milvus-io/milvus/internal/datacoord/session"
|
"github.com/milvus-io/milvus/internal/datacoord/session"
|
||||||
@ -28,6 +30,7 @@ import (
|
|||||||
mocks2 "github.com/milvus-io/milvus/internal/mocks"
|
mocks2 "github.com/milvus-io/milvus/internal/mocks"
|
||||||
"github.com/milvus-io/milvus/internal/mocks/distributed/mock_streaming"
|
"github.com/milvus-io/milvus/internal/mocks/distributed/mock_streaming"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
|
"github.com/milvus-io/milvus/internal/tso"
|
||||||
"github.com/milvus-io/milvus/internal/types"
|
"github.com/milvus-io/milvus/internal/types"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/log"
|
"github.com/milvus-io/milvus/pkg/v2/log"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/mq/msgstream"
|
"github.com/milvus-io/milvus/pkg/v2/mq/msgstream"
|
||||||
@ -2001,3 +2004,310 @@ func TestFlushAll(t *testing.T) {
|
|||||||
assert.NotEqual(t, commonpb.ErrorCode_Success, resp.GetStatus().GetErrorCode())
|
assert.NotEqual(t, commonpb.ErrorCode_Success, resp.GetStatus().GetErrorCode())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServer_AddFileResource(t *testing.T) {
|
||||||
|
t.Run("success", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
mockAllocator := tso.NewMockAllocator()
|
||||||
|
mockAllocator.GenerateTSOF = func(count uint32) (uint64, error) { return 100, nil }
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
idAllocator: globalIDAllocator.NewTestGlobalIDAllocator(mockAllocator),
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: make(map[string]*model.FileResource),
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Base: &commonpb.MsgBase{},
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
|
||||||
|
mockCatalog.EXPECT().SaveFileResource(mock.Anything, mock.MatchedBy(func(resource *model.FileResource) bool {
|
||||||
|
return resource.Name == "test_resource" && resource.Path == "/path/to/resource"
|
||||||
|
})).Return(nil)
|
||||||
|
|
||||||
|
resp, err := server.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("server not healthy", func(t *testing.T) {
|
||||||
|
server := &Server{}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Abnormal)
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := server.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("allocator error", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
mockAllocator := tso.NewMockAllocator()
|
||||||
|
mockAllocator.GenerateTSOF = func(count uint32) (uint64, error) { return 0, fmt.Errorf("mock error") }
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
idAllocator: globalIDAllocator.NewTestGlobalIDAllocator(mockAllocator),
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: make(map[string]*model.FileResource),
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := server.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("catalog save error", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
mockAllocator := tso.NewMockAllocator()
|
||||||
|
mockAllocator.GenerateTSOF = func(count uint32) (uint64, error) { return 100, nil }
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
idAllocator: globalIDAllocator.NewTestGlobalIDAllocator(mockAllocator),
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: make(map[string]*model.FileResource),
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
mockCatalog.EXPECT().SaveFileResource(mock.Anything, mock.Anything).Return(errors.New("catalog error"))
|
||||||
|
|
||||||
|
resp, err := server.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("resource already exists", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
mockAllocator := tso.NewMockAllocator()
|
||||||
|
mockAllocator.GenerateTSOF = func(count uint32) (uint64, error) { return 100, nil }
|
||||||
|
|
||||||
|
existingResource := &model.FileResource{
|
||||||
|
ID: 1,
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/existing/path",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
idAllocator: globalIDAllocator.NewTestGlobalIDAllocator(mockAllocator),
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: map[string]*model.FileResource{
|
||||||
|
"test_resource": existingResource,
|
||||||
|
},
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := server.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
assert.Contains(t, resp.GetReason(), "resource name exist")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestServer_RemoveFileResource(t *testing.T) {
|
||||||
|
t.Run("success", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
|
||||||
|
existingResource := &model.FileResource{
|
||||||
|
ID: 1,
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: map[string]*model.FileResource{
|
||||||
|
"test_resource": existingResource,
|
||||||
|
},
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Base: &commonpb.MsgBase{},
|
||||||
|
Name: "test_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
mockCatalog.EXPECT().RemoveFileResource(mock.Anything, int64(1)).Return(nil)
|
||||||
|
|
||||||
|
resp, err := server.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("server not healthy", func(t *testing.T) {
|
||||||
|
server := &Server{}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Abnormal)
|
||||||
|
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := server.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("resource not found", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: make(map[string]*model.FileResource),
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Name: "non_existent_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := server.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp)) // Should succeed even if resource doesn't exist
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("catalog remove error", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
|
||||||
|
existingResource := &model.FileResource{
|
||||||
|
ID: 1,
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: map[string]*model.FileResource{
|
||||||
|
"test_resource": existingResource,
|
||||||
|
},
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
mockCatalog.EXPECT().RemoveFileResource(mock.Anything, int64(1)).Return(errors.New("catalog error"))
|
||||||
|
|
||||||
|
resp, err := server.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestServer_ListFileResources(t *testing.T) {
|
||||||
|
t.Run("success with empty list", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: make(map[string]*model.FileResource),
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.ListFileResourcesRequest{
|
||||||
|
Base: &commonpb.MsgBase{},
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := server.ListFileResources(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp.GetStatus()))
|
||||||
|
assert.NotNil(t, resp.GetResources())
|
||||||
|
assert.Equal(t, 0, len(resp.GetResources()))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("success with resources", func(t *testing.T) {
|
||||||
|
mockCatalog := mocks.NewDataCoordCatalog(t)
|
||||||
|
|
||||||
|
resource1 := &model.FileResource{
|
||||||
|
ID: 1,
|
||||||
|
Name: "resource1",
|
||||||
|
Path: "/path/to/resource1",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
resource2 := &model.FileResource{
|
||||||
|
ID: 2,
|
||||||
|
Name: "resource2",
|
||||||
|
Path: "/path/to/resource2",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
meta: &meta{
|
||||||
|
resourceMeta: map[string]*model.FileResource{
|
||||||
|
"resource1": resource1,
|
||||||
|
"resource2": resource2,
|
||||||
|
},
|
||||||
|
catalog: mockCatalog,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
req := &milvuspb.ListFileResourcesRequest{}
|
||||||
|
|
||||||
|
resp, err := server.ListFileResources(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp.GetStatus()))
|
||||||
|
assert.NotNil(t, resp.GetResources())
|
||||||
|
assert.Equal(t, 2, len(resp.GetResources()))
|
||||||
|
|
||||||
|
// Check that both resources are returned
|
||||||
|
resourceNames := make(map[string]bool)
|
||||||
|
for _, resource := range resp.GetResources() {
|
||||||
|
resourceNames[resource.GetName()] = true
|
||||||
|
}
|
||||||
|
assert.True(t, resourceNames["resource1"])
|
||||||
|
assert.True(t, resourceNames["resource2"])
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("server not healthy", func(t *testing.T) {
|
||||||
|
server := &Server{}
|
||||||
|
server.stateCode.Store(commonpb.StateCode_Abnormal)
|
||||||
|
|
||||||
|
req := &milvuspb.ListFileResourcesRequest{}
|
||||||
|
|
||||||
|
resp, err := server.ListFileResources(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp.GetStatus()))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -1860,3 +1860,36 @@ func (c *Client) ListLoadedSegments(ctx context.Context, req *querypb.ListLoaded
|
|||||||
return client.ListLoadedSegments(ctx, req)
|
return client.ListLoadedSegments(ctx, req)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
req = typeutil.Clone(req)
|
||||||
|
commonpbutil.UpdateMsgBase(
|
||||||
|
req.GetBase(),
|
||||||
|
commonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),
|
||||||
|
)
|
||||||
|
return wrapGrpcCall(ctx, c, func(client MixCoordClient) (*commonpb.Status, error) {
|
||||||
|
return client.AddFileResource(ctx, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
req = typeutil.Clone(req)
|
||||||
|
commonpbutil.UpdateMsgBase(
|
||||||
|
req.GetBase(),
|
||||||
|
commonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),
|
||||||
|
)
|
||||||
|
return wrapGrpcCall(ctx, c, func(client MixCoordClient) (*commonpb.Status, error) {
|
||||||
|
return client.RemoveFileResource(ctx, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
req = typeutil.Clone(req)
|
||||||
|
commonpbutil.UpdateMsgBase(
|
||||||
|
req.GetBase(),
|
||||||
|
commonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),
|
||||||
|
)
|
||||||
|
return wrapGrpcCall(ctx, c, func(client MixCoordClient) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
return client.ListFileResources(ctx, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -919,3 +919,18 @@ func (s *Server) GetQuotaMetrics(ctx context.Context, req *internalpb.GetQuotaMe
|
|||||||
func (s *Server) ListLoadedSegments(ctx context.Context, req *querypb.ListLoadedSegmentsRequest) (*querypb.ListLoadedSegmentsResponse, error) {
|
func (s *Server) ListLoadedSegments(ctx context.Context, req *querypb.ListLoadedSegmentsRequest) (*querypb.ListLoadedSegmentsResponse, error) {
|
||||||
return s.mixCoord.ListLoadedSegments(ctx, req)
|
return s.mixCoord.ListLoadedSegments(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource
|
||||||
|
func (s *Server) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return s.mixCoord.AddFileResource(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource
|
||||||
|
func (s *Server) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return s.mixCoord.RemoveFileResource(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources list file resources
|
||||||
|
func (s *Server) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
return s.mixCoord.ListFileResources(ctx, req)
|
||||||
|
}
|
||||||
|
|||||||
@ -1127,3 +1127,18 @@ func (s *Server) GetSegmentsInfo(ctx context.Context, req *internalpb.GetSegment
|
|||||||
func (s *Server) GetQuotaMetrics(ctx context.Context, req *internalpb.GetQuotaMetricsRequest) (*internalpb.GetQuotaMetricsResponse, error) {
|
func (s *Server) GetQuotaMetrics(ctx context.Context, req *internalpb.GetQuotaMetricsRequest) (*internalpb.GetQuotaMetricsResponse, error) {
|
||||||
return s.proxy.GetQuotaMetrics(ctx, req)
|
return s.proxy.GetQuotaMetrics(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource
|
||||||
|
func (s *Server) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return s.proxy.AddFileResource(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource
|
||||||
|
func (s *Server) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return s.proxy.RemoveFileResource(ctx, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources list file resources
|
||||||
|
func (s *Server) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
return s.proxy.ListFileResources(ctx, req)
|
||||||
|
}
|
||||||
|
|||||||
@ -180,6 +180,11 @@ type DataCoordCatalog interface {
|
|||||||
ListStatsTasks(ctx context.Context) ([]*indexpb.StatsTask, error)
|
ListStatsTasks(ctx context.Context) ([]*indexpb.StatsTask, error)
|
||||||
SaveStatsTask(ctx context.Context, task *indexpb.StatsTask) error
|
SaveStatsTask(ctx context.Context, task *indexpb.StatsTask) error
|
||||||
DropStatsTask(ctx context.Context, taskID typeutil.UniqueID) error
|
DropStatsTask(ctx context.Context, taskID typeutil.UniqueID) error
|
||||||
|
|
||||||
|
// Analyzer Resource
|
||||||
|
SaveFileResource(ctx context.Context, resource *model.FileResource) error
|
||||||
|
RemoveFileResource(ctx context.Context, resourceID int64) error
|
||||||
|
ListFileResource(ctx context.Context) ([]*model.FileResource, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryCoordCatalog interface {
|
type QueryCoordCatalog interface {
|
||||||
|
|||||||
@ -33,6 +33,7 @@ const (
|
|||||||
PartitionStatsInfoPrefix = MetaPrefix + "/partition-stats"
|
PartitionStatsInfoPrefix = MetaPrefix + "/partition-stats"
|
||||||
PartitionStatsCurrentVersionPrefix = MetaPrefix + "/current-partition-stats-version"
|
PartitionStatsCurrentVersionPrefix = MetaPrefix + "/current-partition-stats-version"
|
||||||
StatsTaskPrefix = MetaPrefix + "/stats-task"
|
StatsTaskPrefix = MetaPrefix + "/stats-task"
|
||||||
|
FileResourceMetaPrefix = MetaPrefix + "/file_resource"
|
||||||
|
|
||||||
NonRemoveFlagTomestone = "non-removed"
|
NonRemoveFlagTomestone = "non-removed"
|
||||||
RemoveFlagTomestone = "removed"
|
RemoveFlagTomestone = "removed"
|
||||||
|
|||||||
@ -961,3 +961,49 @@ func (kc *Catalog) DropStatsTask(ctx context.Context, taskID typeutil.UniqueID)
|
|||||||
key := buildStatsTaskKey(taskID)
|
key := buildStatsTaskKey(taskID)
|
||||||
return kc.MetaKv.Remove(ctx, key)
|
return kc.MetaKv.Remove(ctx, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (kc *Catalog) SaveFileResource(ctx context.Context, resource *model.FileResource) error {
|
||||||
|
k := BuildFileResourceKey(resource.ID)
|
||||||
|
v, err := proto.Marshal(resource.Marshal())
|
||||||
|
if err != nil {
|
||||||
|
log.Ctx(ctx).Error("failed to marshal resource info", zap.Error(err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err = kc.MetaKv.Save(ctx, k, string(v)); err != nil {
|
||||||
|
log.Ctx(ctx).Warn("fail to save resource info", zap.String("key", k), zap.Error(err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (kc *Catalog) RemoveFileResource(ctx context.Context, resourceID int64) error {
|
||||||
|
k := BuildFileResourceKey(resourceID)
|
||||||
|
if err := kc.MetaKv.Remove(ctx, k); err != nil {
|
||||||
|
log.Ctx(ctx).Warn("fail to remove resource info", zap.String("key", k), zap.Error(err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (kc *Catalog) ListFileResource(ctx context.Context) ([]*model.FileResource, error) {
|
||||||
|
_, values, err := kc.MetaKv.LoadWithPrefix(ctx, FileResourceMetaPrefix)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
infos := make([]*model.FileResource, 0, len(values))
|
||||||
|
for _, v := range values {
|
||||||
|
info := &datapb.FileResourceInfo{}
|
||||||
|
err := proto.Unmarshal([]byte(v), info)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
infos = append(infos, model.UnmarshalFileResourceInfo(info))
|
||||||
|
}
|
||||||
|
|
||||||
|
return infos, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func BuildFileResourceKey(resourceID typeutil.UniqueID) string {
|
||||||
|
return fmt.Sprintf("%s/%d", FileResourceMetaPrefix, resourceID)
|
||||||
|
}
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import (
|
|||||||
// prefix/partitions/collection_id/partition_id -> PartitionInfo
|
// prefix/partitions/collection_id/partition_id -> PartitionInfo
|
||||||
// prefix/aliases/alias_name -> AliasInfo
|
// prefix/aliases/alias_name -> AliasInfo
|
||||||
// prefix/fields/collection_id/field_id -> FieldSchema
|
// prefix/fields/collection_id/field_id -> FieldSchema
|
||||||
|
// prefix/file_resource/resource_id -> Resource
|
||||||
|
|
||||||
type Catalog struct {
|
type Catalog struct {
|
||||||
Txn kv.TxnKV
|
Txn kv.TxnKV
|
||||||
|
|||||||
@ -1272,6 +1272,64 @@ func (_c *DataCoordCatalog_ListCompactionTask_Call) RunAndReturn(run func(contex
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResource provides a mock function with given fields: ctx
|
||||||
|
func (_m *DataCoordCatalog) ListFileResource(ctx context.Context) ([]*model.FileResource, error) {
|
||||||
|
ret := _m.Called(ctx)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 []*model.FileResource
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context) ([]*model.FileResource, error)); ok {
|
||||||
|
return rf(ctx)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context) []*model.FileResource); ok {
|
||||||
|
r0 = rf(ctx)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).([]*model.FileResource)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
||||||
|
r1 = rf(ctx)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCoordCatalog_ListFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResource'
|
||||||
|
type DataCoordCatalog_ListFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *DataCoordCatalog_Expecter) ListFileResource(ctx interface{}) *DataCoordCatalog_ListFileResource_Call {
|
||||||
|
return &DataCoordCatalog_ListFileResource_Call{Call: _e.mock.On("ListFileResource", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_ListFileResource_Call) Run(run func(ctx context.Context)) *DataCoordCatalog_ListFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_ListFileResource_Call) Return(_a0 []*model.FileResource, _a1 error) *DataCoordCatalog_ListFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_ListFileResource_Call) RunAndReturn(run func(context.Context) ([]*model.FileResource, error)) *DataCoordCatalog_ListFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListImportJobs provides a mock function with given fields: ctx
|
// ListImportJobs provides a mock function with given fields: ctx
|
||||||
func (_m *DataCoordCatalog) ListImportJobs(ctx context.Context) ([]*datapb.ImportJob, error) {
|
func (_m *DataCoordCatalog) ListImportJobs(ctx context.Context) ([]*datapb.ImportJob, error) {
|
||||||
ret := _m.Called(ctx)
|
ret := _m.Called(ctx)
|
||||||
@ -1831,6 +1889,53 @@ func (_c *DataCoordCatalog_MarkChannelDeleted_Call) RunAndReturn(run func(contex
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: ctx, resourceID
|
||||||
|
func (_m *DataCoordCatalog) RemoveFileResource(ctx context.Context, resourceID int64) error {
|
||||||
|
ret := _m.Called(ctx, resourceID)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
|
||||||
|
r0 = rf(ctx, resourceID)
|
||||||
|
} else {
|
||||||
|
r0 = ret.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCoordCatalog_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type DataCoordCatalog_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - resourceID int64
|
||||||
|
func (_e *DataCoordCatalog_Expecter) RemoveFileResource(ctx interface{}, resourceID interface{}) *DataCoordCatalog_RemoveFileResource_Call {
|
||||||
|
return &DataCoordCatalog_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource", ctx, resourceID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_RemoveFileResource_Call) Run(run func(ctx context.Context, resourceID int64)) *DataCoordCatalog_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_RemoveFileResource_Call) Return(_a0 error) *DataCoordCatalog_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_RemoveFileResource_Call) RunAndReturn(run func(context.Context, int64) error) *DataCoordCatalog_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// SaveAnalyzeTask provides a mock function with given fields: ctx, task
|
// SaveAnalyzeTask provides a mock function with given fields: ctx, task
|
||||||
func (_m *DataCoordCatalog) SaveAnalyzeTask(ctx context.Context, task *indexpb.AnalyzeTask) error {
|
func (_m *DataCoordCatalog) SaveAnalyzeTask(ctx context.Context, task *indexpb.AnalyzeTask) error {
|
||||||
ret := _m.Called(ctx, task)
|
ret := _m.Called(ctx, task)
|
||||||
@ -2117,6 +2222,53 @@ func (_c *DataCoordCatalog_SaveDroppedSegmentsInBatch_Call) RunAndReturn(run fun
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveFileResource provides a mock function with given fields: ctx, resource
|
||||||
|
func (_m *DataCoordCatalog) SaveFileResource(ctx context.Context, resource *model.FileResource) error {
|
||||||
|
ret := _m.Called(ctx, resource)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for SaveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *model.FileResource) error); ok {
|
||||||
|
r0 = rf(ctx, resource)
|
||||||
|
} else {
|
||||||
|
r0 = ret.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataCoordCatalog_SaveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveFileResource'
|
||||||
|
type DataCoordCatalog_SaveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - resource *model.FileResource
|
||||||
|
func (_e *DataCoordCatalog_Expecter) SaveFileResource(ctx interface{}, resource interface{}) *DataCoordCatalog_SaveFileResource_Call {
|
||||||
|
return &DataCoordCatalog_SaveFileResource_Call{Call: _e.mock.On("SaveFileResource", ctx, resource)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_SaveFileResource_Call) Run(run func(ctx context.Context, resource *model.FileResource)) *DataCoordCatalog_SaveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*model.FileResource))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_SaveFileResource_Call) Return(_a0 error) *DataCoordCatalog_SaveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *DataCoordCatalog_SaveFileResource_Call) RunAndReturn(run func(context.Context, *model.FileResource) error) *DataCoordCatalog_SaveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// SaveImportJob provides a mock function with given fields: ctx, job
|
// SaveImportJob provides a mock function with given fields: ctx, job
|
||||||
func (_m *DataCoordCatalog) SaveImportJob(ctx context.Context, job *datapb.ImportJob) error {
|
func (_m *DataCoordCatalog) SaveImportJob(ctx context.Context, job *datapb.ImportJob) error {
|
||||||
ret := _m.Called(ctx, job)
|
ret := _m.Called(ctx, job)
|
||||||
|
|||||||
@ -1767,6 +1767,64 @@ func (_c *RootCoordCatalog_ListDatabases_Call) RunAndReturn(run func(context.Con
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResource provides a mock function with given fields: ctx
|
||||||
|
func (_m *RootCoordCatalog) ListFileResource(ctx context.Context) ([]*model.FileResource, error) {
|
||||||
|
ret := _m.Called(ctx)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 []*model.FileResource
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context) ([]*model.FileResource, error)); ok {
|
||||||
|
return rf(ctx)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context) []*model.FileResource); ok {
|
||||||
|
r0 = rf(ctx)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).([]*model.FileResource)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
||||||
|
r1 = rf(ctx)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// RootCoordCatalog_ListFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResource'
|
||||||
|
type RootCoordCatalog_ListFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
func (_e *RootCoordCatalog_Expecter) ListFileResource(ctx interface{}) *RootCoordCatalog_ListFileResource_Call {
|
||||||
|
return &RootCoordCatalog_ListFileResource_Call{Call: _e.mock.On("ListFileResource", ctx)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_ListFileResource_Call) Run(run func(ctx context.Context)) *RootCoordCatalog_ListFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_ListFileResource_Call) Return(_a0 []*model.FileResource, _a1 error) *RootCoordCatalog_ListFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_ListFileResource_Call) RunAndReturn(run func(context.Context) ([]*model.FileResource, error)) *RootCoordCatalog_ListFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListGrant provides a mock function with given fields: ctx, tenant, entity
|
// ListGrant provides a mock function with given fields: ctx, tenant, entity
|
||||||
func (_m *RootCoordCatalog) ListGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity) ([]*milvuspb.GrantEntity, error) {
|
func (_m *RootCoordCatalog) ListGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity) ([]*milvuspb.GrantEntity, error) {
|
||||||
ret := _m.Called(ctx, tenant, entity)
|
ret := _m.Called(ctx, tenant, entity)
|
||||||
@ -2125,6 +2183,53 @@ func (_c *RootCoordCatalog_ListUserRole_Call) RunAndReturn(run func(context.Cont
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: ctx, resourceID
|
||||||
|
func (_m *RootCoordCatalog) RemoveFileResource(ctx context.Context, resourceID int64) error {
|
||||||
|
ret := _m.Called(ctx, resourceID)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
|
||||||
|
r0 = rf(ctx, resourceID)
|
||||||
|
} else {
|
||||||
|
r0 = ret.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
|
// RootCoordCatalog_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type RootCoordCatalog_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - resourceID int64
|
||||||
|
func (_e *RootCoordCatalog_Expecter) RemoveFileResource(ctx interface{}, resourceID interface{}) *RootCoordCatalog_RemoveFileResource_Call {
|
||||||
|
return &RootCoordCatalog_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource", ctx, resourceID)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_RemoveFileResource_Call) Run(run func(ctx context.Context, resourceID int64)) *RootCoordCatalog_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(int64))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_RemoveFileResource_Call) Return(_a0 error) *RootCoordCatalog_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_RemoveFileResource_Call) RunAndReturn(run func(context.Context, int64) error) *RootCoordCatalog_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RestoreRBAC provides a mock function with given fields: ctx, tenant, meta
|
// RestoreRBAC provides a mock function with given fields: ctx, tenant, meta
|
||||||
func (_m *RootCoordCatalog) RestoreRBAC(ctx context.Context, tenant string, meta *milvuspb.RBACMeta) error {
|
func (_m *RootCoordCatalog) RestoreRBAC(ctx context.Context, tenant string, meta *milvuspb.RBACMeta) error {
|
||||||
ret := _m.Called(ctx, tenant, meta)
|
ret := _m.Called(ctx, tenant, meta)
|
||||||
@ -2173,6 +2278,53 @@ func (_c *RootCoordCatalog_RestoreRBAC_Call) RunAndReturn(run func(context.Conte
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveFileResource provides a mock function with given fields: ctx, resource
|
||||||
|
func (_m *RootCoordCatalog) SaveFileResource(ctx context.Context, resource *model.FileResource) error {
|
||||||
|
ret := _m.Called(ctx, resource)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for SaveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *model.FileResource) error); ok {
|
||||||
|
r0 = rf(ctx, resource)
|
||||||
|
} else {
|
||||||
|
r0 = ret.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
|
// RootCoordCatalog_SaveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveFileResource'
|
||||||
|
type RootCoordCatalog_SaveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - resource *model.FileResource
|
||||||
|
func (_e *RootCoordCatalog_Expecter) SaveFileResource(ctx interface{}, resource interface{}) *RootCoordCatalog_SaveFileResource_Call {
|
||||||
|
return &RootCoordCatalog_SaveFileResource_Call{Call: _e.mock.On("SaveFileResource", ctx, resource)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_SaveFileResource_Call) Run(run func(ctx context.Context, resource *model.FileResource)) *RootCoordCatalog_SaveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*model.FileResource))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_SaveFileResource_Call) Return(_a0 error) *RootCoordCatalog_SaveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *RootCoordCatalog_SaveFileResource_Call) RunAndReturn(run func(context.Context, *model.FileResource) error) *RootCoordCatalog_SaveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// SavePrivilegeGroup provides a mock function with given fields: ctx, data
|
// SavePrivilegeGroup provides a mock function with given fields: ctx, data
|
||||||
func (_m *RootCoordCatalog) SavePrivilegeGroup(ctx context.Context, data *milvuspb.PrivilegeGroupInfo) error {
|
func (_m *RootCoordCatalog) SavePrivilegeGroup(ctx context.Context, data *milvuspb.PrivilegeGroupInfo) error {
|
||||||
ret := _m.Called(ctx, data)
|
ret := _m.Called(ctx, data)
|
||||||
|
|||||||
39
internal/metastore/model/resource.go
Normal file
39
internal/metastore/model/resource.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||||
|
pb "github.com/milvus-io/milvus/pkg/v2/proto/datapb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FileResource struct {
|
||||||
|
ID int64
|
||||||
|
Name string
|
||||||
|
Path string
|
||||||
|
Type commonpb.FileResourceType
|
||||||
|
}
|
||||||
|
|
||||||
|
func (resource *FileResource) Marshal() *pb.FileResourceInfo {
|
||||||
|
if resource == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &pb.FileResourceInfo{
|
||||||
|
ResourceId: resource.ID,
|
||||||
|
Name: resource.Name,
|
||||||
|
Path: resource.Path,
|
||||||
|
Type: resource.Type,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func UnmarshalFileResourceInfo(resource *pb.FileResourceInfo) *FileResource {
|
||||||
|
if resource == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &FileResource{
|
||||||
|
ID: resource.ResourceId,
|
||||||
|
Name: resource.Name,
|
||||||
|
Path: resource.Path,
|
||||||
|
Type: resource.Type,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -36,6 +36,65 @@ func (_m *MockDataCoord) EXPECT() *MockDataCoord_Expecter {
|
|||||||
return &MockDataCoord_Expecter{mock: &_m.Mock}
|
return &MockDataCoord_Expecter{mock: &_m.Mock}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MockDataCoord) AddFileResource(_a0 context.Context, _a1 *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for AddFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest) *commonpb.Status); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AddFileResourceRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockDataCoord_AddFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFileResource'
|
||||||
|
type MockDataCoord_AddFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFileResource is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.AddFileResourceRequest
|
||||||
|
func (_e *MockDataCoord_Expecter) AddFileResource(_a0 interface{}, _a1 interface{}) *MockDataCoord_AddFileResource_Call {
|
||||||
|
return &MockDataCoord_AddFileResource_Call{Call: _e.mock.On("AddFileResource", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_AddFileResource_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AddFileResourceRequest)) *MockDataCoord_AddFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.AddFileResourceRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_AddFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockDataCoord_AddFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_AddFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)) *MockDataCoord_AddFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// AllocSegment provides a mock function with given fields: _a0, _a1
|
// AllocSegment provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MockDataCoord) AllocSegment(_a0 context.Context, _a1 *datapb.AllocSegmentRequest) (*datapb.AllocSegmentResponse, error) {
|
func (_m *MockDataCoord) AllocSegment(_a0 context.Context, _a1 *datapb.AllocSegmentRequest) (*datapb.AllocSegmentResponse, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
@ -2205,6 +2264,65 @@ func (_c *MockDataCoord_Init_Call) RunAndReturn(run func() error) *MockDataCoord
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResources provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MockDataCoord) ListFileResources(_a0 context.Context, _a1 *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResources")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *milvuspb.ListFileResourcesResponse
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest) *milvuspb.ListFileResourcesResponse); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*milvuspb.ListFileResourcesResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListFileResourcesRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockDataCoord_ListFileResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResources'
|
||||||
|
type MockDataCoord_ListFileResources_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.ListFileResourcesRequest
|
||||||
|
func (_e *MockDataCoord_Expecter) ListFileResources(_a0 interface{}, _a1 interface{}) *MockDataCoord_ListFileResources_Call {
|
||||||
|
return &MockDataCoord_ListFileResources_Call{Call: _e.mock.On("ListFileResources", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_ListFileResources_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListFileResourcesRequest)) *MockDataCoord_ListFileResources_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.ListFileResourcesRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_ListFileResources_Call) Return(_a0 *milvuspb.ListFileResourcesResponse, _a1 error) *MockDataCoord_ListFileResources_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_ListFileResources_Call) RunAndReturn(run func(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)) *MockDataCoord_ListFileResources_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListImports provides a mock function with given fields: _a0, _a1
|
// ListImports provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MockDataCoord) ListImports(_a0 context.Context, _a1 *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error) {
|
func (_m *MockDataCoord) ListImports(_a0 context.Context, _a1 *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
@ -2486,6 +2604,65 @@ func (_c *MockDataCoord_Register_Call) RunAndReturn(run func() error) *MockDataC
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MockDataCoord) RemoveFileResource(_a0 context.Context, _a1 *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest) *commonpb.Status); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RemoveFileResourceRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockDataCoord_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type MockDataCoord_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.RemoveFileResourceRequest
|
||||||
|
func (_e *MockDataCoord_Expecter) RemoveFileResource(_a0 interface{}, _a1 interface{}) *MockDataCoord_RemoveFileResource_Call {
|
||||||
|
return &MockDataCoord_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_RemoveFileResource_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.RemoveFileResourceRequest)) *MockDataCoord_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.RemoveFileResourceRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_RemoveFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockDataCoord_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoord_RemoveFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)) *MockDataCoord_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ReportDataNodeTtMsgs provides a mock function with given fields: _a0, _a1
|
// ReportDataNodeTtMsgs provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MockDataCoord) ReportDataNodeTtMsgs(_a0 context.Context, _a1 *datapb.ReportDataNodeTtMsgsRequest) (*commonpb.Status, error) {
|
func (_m *MockDataCoord) ReportDataNodeTtMsgs(_a0 context.Context, _a1 *datapb.ReportDataNodeTtMsgsRequest) (*commonpb.Status, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|||||||
@ -33,6 +33,80 @@ func (_m *MockDataCoordClient) EXPECT() *MockDataCoordClient_Expecter {
|
|||||||
return &MockDataCoordClient_Expecter{mock: &_m.Mock}
|
return &MockDataCoordClient_Expecter{mock: &_m.Mock}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource provides a mock function with given fields: ctx, in, opts
|
||||||
|
func (_m *MockDataCoordClient) AddFileResource(ctx context.Context, in *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
_va := make([]interface{}, len(opts))
|
||||||
|
for _i := range opts {
|
||||||
|
_va[_i] = opts[_i]
|
||||||
|
}
|
||||||
|
var _ca []interface{}
|
||||||
|
_ca = append(_ca, ctx, in)
|
||||||
|
_ca = append(_ca, _va...)
|
||||||
|
ret := _m.Called(_ca...)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for AddFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) *commonpb.Status); ok {
|
||||||
|
r0 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) error); ok {
|
||||||
|
r1 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockDataCoordClient_AddFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFileResource'
|
||||||
|
type MockDataCoordClient_AddFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - in *milvuspb.AddFileResourceRequest
|
||||||
|
// - opts ...grpc.CallOption
|
||||||
|
func (_e *MockDataCoordClient_Expecter) AddFileResource(ctx interface{}, in interface{}, opts ...interface{}) *MockDataCoordClient_AddFileResource_Call {
|
||||||
|
return &MockDataCoordClient_AddFileResource_Call{Call: _e.mock.On("AddFileResource",
|
||||||
|
append([]interface{}{ctx, in}, opts...)...)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_AddFileResource_Call) Run(run func(ctx context.Context, in *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption)) *MockDataCoordClient_AddFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||||
|
for i, a := range args[2:] {
|
||||||
|
if a != nil {
|
||||||
|
variadicArgs[i] = a.(grpc.CallOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.AddFileResourceRequest), variadicArgs...)
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_AddFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockDataCoordClient_AddFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_AddFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)) *MockDataCoordClient_AddFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// AllocSegment provides a mock function with given fields: ctx, in, opts
|
// AllocSegment provides a mock function with given fields: ctx, in, opts
|
||||||
func (_m *MockDataCoordClient) AllocSegment(ctx context.Context, in *datapb.AllocSegmentRequest, opts ...grpc.CallOption) (*datapb.AllocSegmentResponse, error) {
|
func (_m *MockDataCoordClient) AllocSegment(ctx context.Context, in *datapb.AllocSegmentRequest, opts ...grpc.CallOption) (*datapb.AllocSegmentResponse, error) {
|
||||||
_va := make([]interface{}, len(opts))
|
_va := make([]interface{}, len(opts))
|
||||||
@ -2742,6 +2816,80 @@ func (_c *MockDataCoordClient_ImportV2_Call) RunAndReturn(run func(context.Conte
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResources provides a mock function with given fields: ctx, in, opts
|
||||||
|
func (_m *MockDataCoordClient) ListFileResources(ctx context.Context, in *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
_va := make([]interface{}, len(opts))
|
||||||
|
for _i := range opts {
|
||||||
|
_va[_i] = opts[_i]
|
||||||
|
}
|
||||||
|
var _ca []interface{}
|
||||||
|
_ca = append(_ca, ctx, in)
|
||||||
|
_ca = append(_ca, _va...)
|
||||||
|
ret := _m.Called(_ca...)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResources")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *milvuspb.ListFileResourcesResponse
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error)); ok {
|
||||||
|
return rf(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) *milvuspb.ListFileResourcesResponse); ok {
|
||||||
|
r0 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*milvuspb.ListFileResourcesResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) error); ok {
|
||||||
|
r1 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockDataCoordClient_ListFileResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResources'
|
||||||
|
type MockDataCoordClient_ListFileResources_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - in *milvuspb.ListFileResourcesRequest
|
||||||
|
// - opts ...grpc.CallOption
|
||||||
|
func (_e *MockDataCoordClient_Expecter) ListFileResources(ctx interface{}, in interface{}, opts ...interface{}) *MockDataCoordClient_ListFileResources_Call {
|
||||||
|
return &MockDataCoordClient_ListFileResources_Call{Call: _e.mock.On("ListFileResources",
|
||||||
|
append([]interface{}{ctx, in}, opts...)...)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_ListFileResources_Call) Run(run func(ctx context.Context, in *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption)) *MockDataCoordClient_ListFileResources_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||||
|
for i, a := range args[2:] {
|
||||||
|
if a != nil {
|
||||||
|
variadicArgs[i] = a.(grpc.CallOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.ListFileResourcesRequest), variadicArgs...)
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_ListFileResources_Call) Return(_a0 *milvuspb.ListFileResourcesResponse, _a1 error) *MockDataCoordClient_ListFileResources_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_ListFileResources_Call) RunAndReturn(run func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error)) *MockDataCoordClient_ListFileResources_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListImports provides a mock function with given fields: ctx, in, opts
|
// ListImports provides a mock function with given fields: ctx, in, opts
|
||||||
func (_m *MockDataCoordClient) ListImports(ctx context.Context, in *internalpb.ListImportsRequestInternal, opts ...grpc.CallOption) (*internalpb.ListImportsResponse, error) {
|
func (_m *MockDataCoordClient) ListImports(ctx context.Context, in *internalpb.ListImportsRequestInternal, opts ...grpc.CallOption) (*internalpb.ListImportsResponse, error) {
|
||||||
_va := make([]interface{}, len(opts))
|
_va := make([]interface{}, len(opts))
|
||||||
@ -3038,6 +3186,80 @@ func (_c *MockDataCoordClient_MarkSegmentsDropped_Call) RunAndReturn(run func(co
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: ctx, in, opts
|
||||||
|
func (_m *MockDataCoordClient) RemoveFileResource(ctx context.Context, in *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
_va := make([]interface{}, len(opts))
|
||||||
|
for _i := range opts {
|
||||||
|
_va[_i] = opts[_i]
|
||||||
|
}
|
||||||
|
var _ca []interface{}
|
||||||
|
_ca = append(_ca, ctx, in)
|
||||||
|
_ca = append(_ca, _va...)
|
||||||
|
ret := _m.Called(_ca...)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) *commonpb.Status); ok {
|
||||||
|
r0 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) error); ok {
|
||||||
|
r1 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockDataCoordClient_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type MockDataCoordClient_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - in *milvuspb.RemoveFileResourceRequest
|
||||||
|
// - opts ...grpc.CallOption
|
||||||
|
func (_e *MockDataCoordClient_Expecter) RemoveFileResource(ctx interface{}, in interface{}, opts ...interface{}) *MockDataCoordClient_RemoveFileResource_Call {
|
||||||
|
return &MockDataCoordClient_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource",
|
||||||
|
append([]interface{}{ctx, in}, opts...)...)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_RemoveFileResource_Call) Run(run func(ctx context.Context, in *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption)) *MockDataCoordClient_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||||
|
for i, a := range args[2:] {
|
||||||
|
if a != nil {
|
||||||
|
variadicArgs[i] = a.(grpc.CallOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.RemoveFileResourceRequest), variadicArgs...)
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_RemoveFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockDataCoordClient_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockDataCoordClient_RemoveFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)) *MockDataCoordClient_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ReportDataNodeTtMsgs provides a mock function with given fields: ctx, in, opts
|
// ReportDataNodeTtMsgs provides a mock function with given fields: ctx, in, opts
|
||||||
func (_m *MockDataCoordClient) ReportDataNodeTtMsgs(ctx context.Context, in *datapb.ReportDataNodeTtMsgsRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
func (_m *MockDataCoordClient) ReportDataNodeTtMsgs(ctx context.Context, in *datapb.ReportDataNodeTtMsgsRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
_va := make([]interface{}, len(opts))
|
_va := make([]interface{}, len(opts))
|
||||||
|
|||||||
@ -162,6 +162,65 @@ func (_c *MixCoord_AddCollectionField_Call) RunAndReturn(run func(context.Contex
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MixCoord) AddFileResource(_a0 context.Context, _a1 *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for AddFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest) *commonpb.Status); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AddFileResourceRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MixCoord_AddFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFileResource'
|
||||||
|
type MixCoord_AddFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFileResource is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.AddFileResourceRequest
|
||||||
|
func (_e *MixCoord_Expecter) AddFileResource(_a0 interface{}, _a1 interface{}) *MixCoord_AddFileResource_Call {
|
||||||
|
return &MixCoord_AddFileResource_Call{Call: _e.mock.On("AddFileResource", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_AddFileResource_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AddFileResourceRequest)) *MixCoord_AddFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.AddFileResourceRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_AddFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MixCoord_AddFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_AddFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)) *MixCoord_AddFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// AllocID provides a mock function with given fields: _a0, _a1
|
// AllocID provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MixCoord) AllocID(_a0 context.Context, _a1 *rootcoordpb.AllocIDRequest) (*rootcoordpb.AllocIDResponse, error) {
|
func (_m *MixCoord) AllocID(_a0 context.Context, _a1 *rootcoordpb.AllocIDRequest) (*rootcoordpb.AllocIDResponse, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
@ -5372,6 +5431,65 @@ func (_c *MixCoord_ListDatabases_Call) RunAndReturn(run func(context.Context, *m
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResources provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MixCoord) ListFileResources(_a0 context.Context, _a1 *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResources")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *milvuspb.ListFileResourcesResponse
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest) *milvuspb.ListFileResourcesResponse); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*milvuspb.ListFileResourcesResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListFileResourcesRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MixCoord_ListFileResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResources'
|
||||||
|
type MixCoord_ListFileResources_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.ListFileResourcesRequest
|
||||||
|
func (_e *MixCoord_Expecter) ListFileResources(_a0 interface{}, _a1 interface{}) *MixCoord_ListFileResources_Call {
|
||||||
|
return &MixCoord_ListFileResources_Call{Call: _e.mock.On("ListFileResources", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_ListFileResources_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListFileResourcesRequest)) *MixCoord_ListFileResources_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.ListFileResourcesRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_ListFileResources_Call) Return(_a0 *milvuspb.ListFileResourcesResponse, _a1 error) *MixCoord_ListFileResources_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_ListFileResources_Call) RunAndReturn(run func(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)) *MixCoord_ListFileResources_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListImports provides a mock function with given fields: _a0, _a1
|
// ListImports provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MixCoord) ListImports(_a0 context.Context, _a1 *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error) {
|
func (_m *MixCoord) ListImports(_a0 context.Context, _a1 *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
@ -6501,6 +6619,65 @@ func (_c *MixCoord_ReleasePartitions_Call) RunAndReturn(run func(context.Context
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MixCoord) RemoveFileResource(_a0 context.Context, _a1 *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest) *commonpb.Status); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RemoveFileResourceRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MixCoord_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type MixCoord_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.RemoveFileResourceRequest
|
||||||
|
func (_e *MixCoord_Expecter) RemoveFileResource(_a0 interface{}, _a1 interface{}) *MixCoord_RemoveFileResource_Call {
|
||||||
|
return &MixCoord_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_RemoveFileResource_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.RemoveFileResourceRequest)) *MixCoord_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.RemoveFileResourceRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_RemoveFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MixCoord_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MixCoord_RemoveFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)) *MixCoord_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RenameCollection provides a mock function with given fields: _a0, _a1
|
// RenameCollection provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MixCoord) RenameCollection(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest) (*commonpb.Status, error) {
|
func (_m *MixCoord) RenameCollection(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest) (*commonpb.Status, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|||||||
@ -187,6 +187,80 @@ func (_c *MockMixCoordClient_AddCollectionField_Call) RunAndReturn(run func(cont
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource provides a mock function with given fields: ctx, in, opts
|
||||||
|
func (_m *MockMixCoordClient) AddFileResource(ctx context.Context, in *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
_va := make([]interface{}, len(opts))
|
||||||
|
for _i := range opts {
|
||||||
|
_va[_i] = opts[_i]
|
||||||
|
}
|
||||||
|
var _ca []interface{}
|
||||||
|
_ca = append(_ca, ctx, in)
|
||||||
|
_ca = append(_ca, _va...)
|
||||||
|
ret := _m.Called(_ca...)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for AddFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) *commonpb.Status); ok {
|
||||||
|
r0 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) error); ok {
|
||||||
|
r1 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockMixCoordClient_AddFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFileResource'
|
||||||
|
type MockMixCoordClient_AddFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - in *milvuspb.AddFileResourceRequest
|
||||||
|
// - opts ...grpc.CallOption
|
||||||
|
func (_e *MockMixCoordClient_Expecter) AddFileResource(ctx interface{}, in interface{}, opts ...interface{}) *MockMixCoordClient_AddFileResource_Call {
|
||||||
|
return &MockMixCoordClient_AddFileResource_Call{Call: _e.mock.On("AddFileResource",
|
||||||
|
append([]interface{}{ctx, in}, opts...)...)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_AddFileResource_Call) Run(run func(ctx context.Context, in *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption)) *MockMixCoordClient_AddFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||||
|
for i, a := range args[2:] {
|
||||||
|
if a != nil {
|
||||||
|
variadicArgs[i] = a.(grpc.CallOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.AddFileResourceRequest), variadicArgs...)
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_AddFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockMixCoordClient_AddFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_AddFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.AddFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)) *MockMixCoordClient_AddFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// AllocID provides a mock function with given fields: ctx, in, opts
|
// AllocID provides a mock function with given fields: ctx, in, opts
|
||||||
func (_m *MockMixCoordClient) AllocID(ctx context.Context, in *rootcoordpb.AllocIDRequest, opts ...grpc.CallOption) (*rootcoordpb.AllocIDResponse, error) {
|
func (_m *MockMixCoordClient) AllocID(ctx context.Context, in *rootcoordpb.AllocIDRequest, opts ...grpc.CallOption) (*rootcoordpb.AllocIDResponse, error) {
|
||||||
_va := make([]interface{}, len(opts))
|
_va := make([]interface{}, len(opts))
|
||||||
@ -6522,6 +6596,80 @@ func (_c *MockMixCoordClient_ListDatabases_Call) RunAndReturn(run func(context.C
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResources provides a mock function with given fields: ctx, in, opts
|
||||||
|
func (_m *MockMixCoordClient) ListFileResources(ctx context.Context, in *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
_va := make([]interface{}, len(opts))
|
||||||
|
for _i := range opts {
|
||||||
|
_va[_i] = opts[_i]
|
||||||
|
}
|
||||||
|
var _ca []interface{}
|
||||||
|
_ca = append(_ca, ctx, in)
|
||||||
|
_ca = append(_ca, _va...)
|
||||||
|
ret := _m.Called(_ca...)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResources")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *milvuspb.ListFileResourcesResponse
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error)); ok {
|
||||||
|
return rf(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) *milvuspb.ListFileResourcesResponse); ok {
|
||||||
|
r0 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*milvuspb.ListFileResourcesResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) error); ok {
|
||||||
|
r1 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockMixCoordClient_ListFileResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResources'
|
||||||
|
type MockMixCoordClient_ListFileResources_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - in *milvuspb.ListFileResourcesRequest
|
||||||
|
// - opts ...grpc.CallOption
|
||||||
|
func (_e *MockMixCoordClient_Expecter) ListFileResources(ctx interface{}, in interface{}, opts ...interface{}) *MockMixCoordClient_ListFileResources_Call {
|
||||||
|
return &MockMixCoordClient_ListFileResources_Call{Call: _e.mock.On("ListFileResources",
|
||||||
|
append([]interface{}{ctx, in}, opts...)...)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_ListFileResources_Call) Run(run func(ctx context.Context, in *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption)) *MockMixCoordClient_ListFileResources_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||||
|
for i, a := range args[2:] {
|
||||||
|
if a != nil {
|
||||||
|
variadicArgs[i] = a.(grpc.CallOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.ListFileResourcesRequest), variadicArgs...)
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_ListFileResources_Call) Return(_a0 *milvuspb.ListFileResourcesResponse, _a1 error) *MockMixCoordClient_ListFileResources_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_ListFileResources_Call) RunAndReturn(run func(context.Context, *milvuspb.ListFileResourcesRequest, ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error)) *MockMixCoordClient_ListFileResources_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListImports provides a mock function with given fields: ctx, in, opts
|
// ListImports provides a mock function with given fields: ctx, in, opts
|
||||||
func (_m *MockMixCoordClient) ListImports(ctx context.Context, in *internalpb.ListImportsRequestInternal, opts ...grpc.CallOption) (*internalpb.ListImportsResponse, error) {
|
func (_m *MockMixCoordClient) ListImports(ctx context.Context, in *internalpb.ListImportsRequestInternal, opts ...grpc.CallOption) (*internalpb.ListImportsResponse, error) {
|
||||||
_va := make([]interface{}, len(opts))
|
_va := make([]interface{}, len(opts))
|
||||||
@ -7780,6 +7928,80 @@ func (_c *MockMixCoordClient_ReleasePartitions_Call) RunAndReturn(run func(conte
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: ctx, in, opts
|
||||||
|
func (_m *MockMixCoordClient) RemoveFileResource(ctx context.Context, in *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
_va := make([]interface{}, len(opts))
|
||||||
|
for _i := range opts {
|
||||||
|
_va[_i] = opts[_i]
|
||||||
|
}
|
||||||
|
var _ca []interface{}
|
||||||
|
_ca = append(_ca, ctx, in)
|
||||||
|
_ca = append(_ca, _va...)
|
||||||
|
ret := _m.Called(_ca...)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) *commonpb.Status); ok {
|
||||||
|
r0 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) error); ok {
|
||||||
|
r1 = rf(ctx, in, opts...)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockMixCoordClient_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type MockMixCoordClient_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - ctx context.Context
|
||||||
|
// - in *milvuspb.RemoveFileResourceRequest
|
||||||
|
// - opts ...grpc.CallOption
|
||||||
|
func (_e *MockMixCoordClient_Expecter) RemoveFileResource(ctx interface{}, in interface{}, opts ...interface{}) *MockMixCoordClient_RemoveFileResource_Call {
|
||||||
|
return &MockMixCoordClient_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource",
|
||||||
|
append([]interface{}{ctx, in}, opts...)...)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_RemoveFileResource_Call) Run(run func(ctx context.Context, in *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption)) *MockMixCoordClient_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||||
|
for i, a := range args[2:] {
|
||||||
|
if a != nil {
|
||||||
|
variadicArgs[i] = a.(grpc.CallOption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.RemoveFileResourceRequest), variadicArgs...)
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_RemoveFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockMixCoordClient_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockMixCoordClient_RemoveFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.RemoveFileResourceRequest, ...grpc.CallOption) (*commonpb.Status, error)) *MockMixCoordClient_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RenameCollection provides a mock function with given fields: ctx, in, opts
|
// RenameCollection provides a mock function with given fields: ctx, in, opts
|
||||||
func (_m *MockMixCoordClient) RenameCollection(ctx context.Context, in *milvuspb.RenameCollectionRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
func (_m *MockMixCoordClient) RenameCollection(ctx context.Context, in *milvuspb.RenameCollectionRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
_va := make([]interface{}, len(opts))
|
_va := make([]interface{}, len(opts))
|
||||||
|
|||||||
@ -92,6 +92,65 @@ func (_c *MockProxy_AddCollectionField_Call) RunAndReturn(run func(context.Conte
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MockProxy) AddFileResource(_a0 context.Context, _a1 *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for AddFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AddFileResourceRequest) *commonpb.Status); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AddFileResourceRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockProxy_AddFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFileResource'
|
||||||
|
type MockProxy_AddFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddFileResource is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.AddFileResourceRequest
|
||||||
|
func (_e *MockProxy_Expecter) AddFileResource(_a0 interface{}, _a1 interface{}) *MockProxy_AddFileResource_Call {
|
||||||
|
return &MockProxy_AddFileResource_Call{Call: _e.mock.On("AddFileResource", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_AddFileResource_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AddFileResourceRequest)) *MockProxy_AddFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.AddFileResourceRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_AddFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockProxy_AddFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_AddFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)) *MockProxy_AddFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// AddUserTags provides a mock function with given fields: _a0, _a1
|
// AddUserTags provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MockProxy) AddUserTags(_a0 context.Context, _a1 *milvuspb.AddUserTagsRequest) (*commonpb.Status, error) {
|
func (_m *MockProxy) AddUserTags(_a0 context.Context, _a1 *milvuspb.AddUserTagsRequest) (*commonpb.Status, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
@ -4959,6 +5018,65 @@ func (_c *MockProxy_ListDatabases_Call) RunAndReturn(run func(context.Context, *
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListFileResources provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MockProxy) ListFileResources(_a0 context.Context, _a1 *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for ListFileResources")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *milvuspb.ListFileResourcesResponse
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListFileResourcesRequest) *milvuspb.ListFileResourcesResponse); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*milvuspb.ListFileResourcesResponse)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.ListFileResourcesRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockProxy_ListFileResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListFileResources'
|
||||||
|
type MockProxy_ListFileResources_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.ListFileResourcesRequest
|
||||||
|
func (_e *MockProxy_Expecter) ListFileResources(_a0 interface{}, _a1 interface{}) *MockProxy_ListFileResources_Call {
|
||||||
|
return &MockProxy_ListFileResources_Call{Call: _e.mock.On("ListFileResources", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_ListFileResources_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.ListFileResourcesRequest)) *MockProxy_ListFileResources_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.ListFileResourcesRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_ListFileResources_Call) Return(_a0 *milvuspb.ListFileResourcesResponse, _a1 error) *MockProxy_ListFileResources_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_ListFileResources_Call) RunAndReturn(run func(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)) *MockProxy_ListFileResources_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// ListImportTasks provides a mock function with given fields: _a0, _a1
|
// ListImportTasks provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MockProxy) ListImportTasks(_a0 context.Context, _a1 *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error) {
|
func (_m *MockProxy) ListImportTasks(_a0 context.Context, _a1 *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
@ -6184,6 +6302,65 @@ func (_c *MockProxy_ReleasePartitions_Call) RunAndReturn(run func(context.Contex
|
|||||||
return _c
|
return _c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource provides a mock function with given fields: _a0, _a1
|
||||||
|
func (_m *MockProxy) RemoveFileResource(_a0 context.Context, _a1 *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|
||||||
|
if len(ret) == 0 {
|
||||||
|
panic("no return value specified for RemoveFileResource")
|
||||||
|
}
|
||||||
|
|
||||||
|
var r0 *commonpb.Status
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)); ok {
|
||||||
|
return rf(_a0, _a1)
|
||||||
|
}
|
||||||
|
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RemoveFileResourceRequest) *commonpb.Status); ok {
|
||||||
|
r0 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*commonpb.Status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.RemoveFileResourceRequest) error); ok {
|
||||||
|
r1 = rf(_a0, _a1)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockProxy_RemoveFileResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFileResource'
|
||||||
|
type MockProxy_RemoveFileResource_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource is a helper method to define mock.On call
|
||||||
|
// - _a0 context.Context
|
||||||
|
// - _a1 *milvuspb.RemoveFileResourceRequest
|
||||||
|
func (_e *MockProxy_Expecter) RemoveFileResource(_a0 interface{}, _a1 interface{}) *MockProxy_RemoveFileResource_Call {
|
||||||
|
return &MockProxy_RemoveFileResource_Call{Call: _e.mock.On("RemoveFileResource", _a0, _a1)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_RemoveFileResource_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.RemoveFileResourceRequest)) *MockProxy_RemoveFileResource_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(context.Context), args[1].(*milvuspb.RemoveFileResourceRequest))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_RemoveFileResource_Call) Return(_a0 *commonpb.Status, _a1 error) *MockProxy_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockProxy_RemoveFileResource_Call) RunAndReturn(run func(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)) *MockProxy_RemoveFileResource_Call {
|
||||||
|
_c.Call.Return(run)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
// RenameCollection provides a mock function with given fields: _a0, _a1
|
// RenameCollection provides a mock function with given fields: _a0, _a1
|
||||||
func (_m *MockProxy) RenameCollection(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest) (*commonpb.Status, error) {
|
func (_m *MockProxy) RenameCollection(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest) (*commonpb.Status, error) {
|
||||||
ret := _m.Called(_a0, _a1)
|
ret := _m.Called(_a0, _a1)
|
||||||
|
|||||||
@ -6858,3 +6858,95 @@ func (node *Proxy) GetQuotaMetrics(ctx context.Context, req *internalpb.GetQuota
|
|||||||
|
|
||||||
return metricsResp, nil
|
return metricsResp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddFileResource add file resource to rootcoord
|
||||||
|
func (node *Proxy) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ctx, sp := otel.Tracer(typeutil.ProxyRole).Start(ctx, "Proxy-AddFileResource")
|
||||||
|
defer sp.End()
|
||||||
|
|
||||||
|
log := log.Ctx(ctx).With(
|
||||||
|
zap.String("role", typeutil.ProxyRole),
|
||||||
|
zap.String("name", req.GetName()),
|
||||||
|
zap.String("path", req.GetPath()))
|
||||||
|
|
||||||
|
if err := merr.CheckHealthy(node.GetStateCode()); err != nil {
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("receive AddFileResource request")
|
||||||
|
|
||||||
|
status, err := node.mixCoord.AddFileResource(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("AddFileResource fail", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
if err = merr.Error(status); err != nil {
|
||||||
|
log.Warn("AddFileResource fail", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("AddFileResource success")
|
||||||
|
return status, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveFileResource remove file resource from rootcoord
|
||||||
|
func (node *Proxy) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
ctx, sp := otel.Tracer(typeutil.ProxyRole).Start(ctx, "Proxy-RemoveFileResource")
|
||||||
|
defer sp.End()
|
||||||
|
|
||||||
|
log := log.Ctx(ctx).With(
|
||||||
|
zap.String("role", typeutil.ProxyRole),
|
||||||
|
zap.String("name", req.GetName()))
|
||||||
|
|
||||||
|
if err := merr.CheckHealthy(node.GetStateCode()); err != nil {
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("receive RemoveFileResource request")
|
||||||
|
|
||||||
|
status, err := node.mixCoord.RemoveFileResource(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("RemoveFileResource fail", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
if err = merr.Error(status); err != nil {
|
||||||
|
log.Warn("RemoveFileResource fail", zap.Error(err))
|
||||||
|
return merr.Status(err), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("RemoveFileResource success")
|
||||||
|
return status, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ListFileResources list file resources from rootcoord
|
||||||
|
func (node *Proxy) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
ctx, sp := otel.Tracer(typeutil.ProxyRole).Start(ctx, "Proxy-ListFileResources")
|
||||||
|
defer sp.End()
|
||||||
|
|
||||||
|
log := log.Ctx(ctx).With(zap.String("role", typeutil.ProxyRole))
|
||||||
|
|
||||||
|
if err := merr.CheckHealthy(node.GetStateCode()); err != nil {
|
||||||
|
return &milvuspb.ListFileResourcesResponse{
|
||||||
|
Status: merr.Status(err),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("receive ListFileResources request")
|
||||||
|
|
||||||
|
resp, err := node.mixCoord.ListFileResources(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("ListFileResources fail", zap.Error(err))
|
||||||
|
return &milvuspb.ListFileResourcesResponse{
|
||||||
|
Status: merr.Status(err),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
if err = merr.Error(resp.GetStatus()); err != nil {
|
||||||
|
log.Warn("ListFileResources fail", zap.Error(err))
|
||||||
|
return &milvuspb.ListFileResourcesResponse{
|
||||||
|
Status: merr.Status(err),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("ListFileResources success", zap.Int("count", len(resp.GetResources())))
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ package proxy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@ -1788,3 +1789,142 @@ func Test_GetSegmentsInfo(t *testing.T) {
|
|||||||
assert.ElementsMatch(t, []int64{4, 8}, resp.GetSegmentInfos()[0].GetInsertLogs()[3].GetLogIDs())
|
assert.ElementsMatch(t, []int64{4, 8}, resp.GetSegmentInfos()[0].GetInsertLogs()[3].GetLogIDs())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestProxy_AddFileResource(t *testing.T) {
|
||||||
|
t.Run("success", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Healthy)
|
||||||
|
proxy.mixCoord = NewMixCoordMock()
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Base: &commonpb.MsgBase{},
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
Type: commonpb.FileResourceType_ANALYZER_DICTIONARY,
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("proxy not healthy", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Abnormal)
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("mixCoord error", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
mockMixCoord := mocks.NewMockMixCoordClient(t)
|
||||||
|
mockMixCoord.EXPECT().AddFileResource(mock.Anything, mock.Anything).Return(nil, fmt.Errorf("mock error"))
|
||||||
|
proxy.mixCoord = mockMixCoord
|
||||||
|
|
||||||
|
req := &milvuspb.AddFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
Path: "/path/to/resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.AddFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProxy_RemoveFileResource(t *testing.T) {
|
||||||
|
t.Run("success", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Healthy)
|
||||||
|
proxy.mixCoord = NewMixCoordMock()
|
||||||
|
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Base: &commonpb.MsgBase{},
|
||||||
|
Name: "test_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("proxy not healthy", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Abnormal)
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("mixCoord error", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
mockMixCoord := mocks.NewMockMixCoordClient(t)
|
||||||
|
mockMixCoord.EXPECT().RemoveFileResource(mock.Anything, mock.Anything).Return(nil, fmt.Errorf("mock error"))
|
||||||
|
proxy.mixCoord = mockMixCoord
|
||||||
|
|
||||||
|
req := &milvuspb.RemoveFileResourceRequest{
|
||||||
|
Name: "test_resource",
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.RemoveFileResource(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProxy_ListFileResources(t *testing.T) {
|
||||||
|
t.Run("success", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Healthy)
|
||||||
|
proxy.mixCoord = NewMixCoordMock()
|
||||||
|
|
||||||
|
req := &milvuspb.ListFileResourcesRequest{
|
||||||
|
Base: &commonpb.MsgBase{},
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := proxy.ListFileResources(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NoError(t, merr.Error(resp.GetStatus()))
|
||||||
|
assert.NotNil(t, resp.GetResources())
|
||||||
|
assert.Equal(t, 0, len(resp.GetResources())) // Mock returns empty list
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("proxy not healthy", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Abnormal)
|
||||||
|
|
||||||
|
req := &milvuspb.ListFileResourcesRequest{}
|
||||||
|
resp, err := proxy.ListFileResources(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp.GetStatus()))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("mixCoord error", func(t *testing.T) {
|
||||||
|
proxy := &Proxy{}
|
||||||
|
proxy.UpdateStateCode(commonpb.StateCode_Healthy)
|
||||||
|
|
||||||
|
mockMixCoord := mocks.NewMockMixCoordClient(t)
|
||||||
|
mockMixCoord.EXPECT().ListFileResources(mock.Anything, mock.Anything).Return(nil, fmt.Errorf("mock error"))
|
||||||
|
proxy.mixCoord = mockMixCoord
|
||||||
|
|
||||||
|
req := &milvuspb.ListFileResourcesRequest{}
|
||||||
|
resp, err := proxy.ListFileResources(context.Background(), req)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Error(t, merr.Error(resp.GetStatus()))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -1627,6 +1627,21 @@ func (coord *MixCoordMock) FlushAll(ctx context.Context, in *datapb.FlushAllRequ
|
|||||||
return &datapb.FlushAllResponse{}, nil
|
return &datapb.FlushAllResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (coord *MixCoordMock) AddFileResource(ctx context.Context, req *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
return merr.Success(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (coord *MixCoordMock) RemoveFileResource(ctx context.Context, req *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
return merr.Success(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (coord *MixCoordMock) ListFileResources(ctx context.Context, req *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
return &milvuspb.ListFileResourcesResponse{
|
||||||
|
Status: merr.Success(),
|
||||||
|
Resources: []*milvuspb.FileResourceInfo{},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
type DescribeCollectionFunc func(ctx context.Context, request *milvuspb.DescribeCollectionRequest, opts ...grpc.CallOption) (*milvuspb.DescribeCollectionResponse, error)
|
type DescribeCollectionFunc func(ctx context.Context, request *milvuspb.DescribeCollectionRequest, opts ...grpc.CallOption) (*milvuspb.DescribeCollectionResponse, error)
|
||||||
|
|
||||||
type ShowPartitionsFunc func(ctx context.Context, request *milvuspb.ShowPartitionsRequest, opts ...grpc.CallOption) (*milvuspb.ShowPartitionsResponse, error)
|
type ShowPartitionsFunc func(ctx context.Context, request *milvuspb.ShowPartitionsRequest, opts ...grpc.CallOption) (*milvuspb.ShowPartitionsResponse, error)
|
||||||
|
|||||||
@ -20,7 +20,7 @@ require (
|
|||||||
github.com/jolestar/go-commons-pool/v2 v2.1.2
|
github.com/jolestar/go-commons-pool/v2 v2.1.2
|
||||||
github.com/json-iterator/go v1.1.12
|
github.com/json-iterator/go v1.1.12
|
||||||
github.com/klauspost/compress v1.17.9
|
github.com/klauspost/compress v1.17.9
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.1-0.20250806032933-1b94535b80c3
|
||||||
github.com/minio/minio-go/v7 v7.0.73
|
github.com/minio/minio-go/v7 v7.0.73
|
||||||
github.com/panjf2000/ants/v2 v2.11.3
|
github.com/panjf2000/ants/v2 v2.11.3
|
||||||
github.com/prometheus/client_golang v1.14.0
|
github.com/prometheus/client_golang v1.14.0
|
||||||
@ -215,6 +215,7 @@ replace (
|
|||||||
github.com/go-kit/kit => github.com/go-kit/kit v0.1.0
|
github.com/go-kit/kit => github.com/go-kit/kit v0.1.0
|
||||||
github.com/golang-jwt/jwt => github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
github.com/golang-jwt/jwt => github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||||
github.com/ianlancetaylor/cgosymbolizer => github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6
|
github.com/ianlancetaylor/cgosymbolizer => github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6
|
||||||
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0-rc.1.0.20250716031043-88051c3893ce => /home/zhicheng/SecWorkspace/milvus-proto/go-api
|
||||||
github.com/streamnative/pulsarctl => github.com/xiaofan-luan/pulsarctl v0.5.1
|
github.com/streamnative/pulsarctl => github.com/xiaofan-luan/pulsarctl v0.5.1
|
||||||
github.com/tecbot/gorocksdb => github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b // indirect
|
github.com/tecbot/gorocksdb => github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@ -557,8 +557,8 @@ github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6 h1:YHMFI6L
|
|||||||
github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg=
|
github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg=
|
||||||
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8=
|
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8=
|
||||||
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4=
|
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4=
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0 h1:SJLdKkifvPDT31jw0hzC7/KSlZ5tv5AhPt77jNHMAQY=
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.1-0.20250806032933-1b94535b80c3 h1:AK0kGIj/nUiGkSodqtaOJPLeIvEYV2HICr8eaChQ4RA=
|
||||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.0/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.1-0.20250806032933-1b94535b80c3/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
||||||
github.com/milvus-io/pulsar-client-go v0.12.1 h1:O2JZp1tsYiO7C0MQ4hrUY/aJXnn2Gry6hpm7UodghmE=
|
github.com/milvus-io/pulsar-client-go v0.12.1 h1:O2JZp1tsYiO7C0MQ4hrUY/aJXnn2Gry6hpm7UodghmE=
|
||||||
github.com/milvus-io/pulsar-client-go v0.12.1/go.mod h1:dkutuH4oS2pXiGm+Ti7fQZ4MRjrMPZ8IJeEGAWMeckk=
|
github.com/milvus-io/pulsar-client-go v0.12.1/go.mod h1:dkutuH4oS2pXiGm+Ti7fQZ4MRjrMPZ8IJeEGAWMeckk=
|
||||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||||
|
|||||||
@ -102,6 +102,11 @@ service DataCoord {
|
|||||||
rpc ImportV2(internal.ImportRequestInternal) returns(internal.ImportResponse){}
|
rpc ImportV2(internal.ImportRequestInternal) returns(internal.ImportResponse){}
|
||||||
rpc GetImportProgress(internal.GetImportProgressRequest) returns(internal.GetImportProgressResponse){}
|
rpc GetImportProgress(internal.GetImportProgressRequest) returns(internal.GetImportProgressResponse){}
|
||||||
rpc ListImports(internal.ListImportsRequestInternal) returns(internal.ListImportsResponse){}
|
rpc ListImports(internal.ListImportsRequestInternal) returns(internal.ListImportsResponse){}
|
||||||
|
|
||||||
|
// File Resource Management
|
||||||
|
rpc AddFileResource(milvus.AddFileResourceRequest) returns (common.Status) {}
|
||||||
|
rpc RemoveFileResource(milvus.RemoveFileResourceRequest) returns (common.Status) {}
|
||||||
|
rpc ListFileResources(milvus.ListFileResourcesRequest) returns (milvus.ListFileResourcesResponse) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
service DataNode {
|
service DataNode {
|
||||||
@ -1083,3 +1088,10 @@ message PartitionStatsInfo {
|
|||||||
message DropCompactionPlanRequest {
|
message DropCompactionPlanRequest {
|
||||||
int64 planID = 1;
|
int64 planID = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message FileResourceInfo {
|
||||||
|
string name = 1;
|
||||||
|
string path = 2;
|
||||||
|
int64 resource_id = 3;
|
||||||
|
common.FileResourceType type = 4;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -70,6 +70,9 @@ const (
|
|||||||
DataCoord_ImportV2_FullMethodName = "/milvus.proto.data.DataCoord/ImportV2"
|
DataCoord_ImportV2_FullMethodName = "/milvus.proto.data.DataCoord/ImportV2"
|
||||||
DataCoord_GetImportProgress_FullMethodName = "/milvus.proto.data.DataCoord/GetImportProgress"
|
DataCoord_GetImportProgress_FullMethodName = "/milvus.proto.data.DataCoord/GetImportProgress"
|
||||||
DataCoord_ListImports_FullMethodName = "/milvus.proto.data.DataCoord/ListImports"
|
DataCoord_ListImports_FullMethodName = "/milvus.proto.data.DataCoord/ListImports"
|
||||||
|
DataCoord_AddFileResource_FullMethodName = "/milvus.proto.data.DataCoord/AddFileResource"
|
||||||
|
DataCoord_RemoveFileResource_FullMethodName = "/milvus.proto.data.DataCoord/RemoveFileResource"
|
||||||
|
DataCoord_ListFileResources_FullMethodName = "/milvus.proto.data.DataCoord/ListFileResources"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DataCoordClient is the client API for DataCoord service.
|
// DataCoordClient is the client API for DataCoord service.
|
||||||
@ -130,6 +133,10 @@ type DataCoordClient interface {
|
|||||||
ImportV2(ctx context.Context, in *internalpb.ImportRequestInternal, opts ...grpc.CallOption) (*internalpb.ImportResponse, error)
|
ImportV2(ctx context.Context, in *internalpb.ImportRequestInternal, opts ...grpc.CallOption) (*internalpb.ImportResponse, error)
|
||||||
GetImportProgress(ctx context.Context, in *internalpb.GetImportProgressRequest, opts ...grpc.CallOption) (*internalpb.GetImportProgressResponse, error)
|
GetImportProgress(ctx context.Context, in *internalpb.GetImportProgressRequest, opts ...grpc.CallOption) (*internalpb.GetImportProgressResponse, error)
|
||||||
ListImports(ctx context.Context, in *internalpb.ListImportsRequestInternal, opts ...grpc.CallOption) (*internalpb.ListImportsResponse, error)
|
ListImports(ctx context.Context, in *internalpb.ListImportsRequestInternal, opts ...grpc.CallOption) (*internalpb.ListImportsResponse, error)
|
||||||
|
// File Resource Management
|
||||||
|
AddFileResource(ctx context.Context, in *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
|
||||||
|
RemoveFileResource(ctx context.Context, in *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
|
||||||
|
ListFileResources(ctx context.Context, in *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type dataCoordClient struct {
|
type dataCoordClient struct {
|
||||||
@ -564,6 +571,33 @@ func (c *dataCoordClient) ListImports(ctx context.Context, in *internalpb.ListIm
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *dataCoordClient) AddFileResource(ctx context.Context, in *milvuspb.AddFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
out := new(commonpb.Status)
|
||||||
|
err := c.cc.Invoke(ctx, DataCoord_AddFileResource_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *dataCoordClient) RemoveFileResource(ctx context.Context, in *milvuspb.RemoveFileResourceRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
|
||||||
|
out := new(commonpb.Status)
|
||||||
|
err := c.cc.Invoke(ctx, DataCoord_RemoveFileResource_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *dataCoordClient) ListFileResources(ctx context.Context, in *milvuspb.ListFileResourcesRequest, opts ...grpc.CallOption) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
out := new(milvuspb.ListFileResourcesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, DataCoord_ListFileResources_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// DataCoordServer is the server API for DataCoord service.
|
// DataCoordServer is the server API for DataCoord service.
|
||||||
// All implementations should embed UnimplementedDataCoordServer
|
// All implementations should embed UnimplementedDataCoordServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
@ -622,6 +656,10 @@ type DataCoordServer interface {
|
|||||||
ImportV2(context.Context, *internalpb.ImportRequestInternal) (*internalpb.ImportResponse, error)
|
ImportV2(context.Context, *internalpb.ImportRequestInternal) (*internalpb.ImportResponse, error)
|
||||||
GetImportProgress(context.Context, *internalpb.GetImportProgressRequest) (*internalpb.GetImportProgressResponse, error)
|
GetImportProgress(context.Context, *internalpb.GetImportProgressRequest) (*internalpb.GetImportProgressResponse, error)
|
||||||
ListImports(context.Context, *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error)
|
ListImports(context.Context, *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error)
|
||||||
|
// File Resource Management
|
||||||
|
AddFileResource(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error)
|
||||||
|
RemoveFileResource(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error)
|
||||||
|
ListFileResources(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedDataCoordServer should be embedded to have forward compatible implementations.
|
// UnimplementedDataCoordServer should be embedded to have forward compatible implementations.
|
||||||
@ -769,6 +807,15 @@ func (UnimplementedDataCoordServer) GetImportProgress(context.Context, *internal
|
|||||||
func (UnimplementedDataCoordServer) ListImports(context.Context, *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error) {
|
func (UnimplementedDataCoordServer) ListImports(context.Context, *internalpb.ListImportsRequestInternal) (*internalpb.ListImportsResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ListImports not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ListImports not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedDataCoordServer) AddFileResource(context.Context, *milvuspb.AddFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method AddFileResource not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedDataCoordServer) RemoveFileResource(context.Context, *milvuspb.RemoveFileResourceRequest) (*commonpb.Status, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method RemoveFileResource not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedDataCoordServer) ListFileResources(context.Context, *milvuspb.ListFileResourcesRequest) (*milvuspb.ListFileResourcesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method ListFileResources not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
// UnsafeDataCoordServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeDataCoordServer may be embedded to opt out of forward compatibility for this service.
|
||||||
// Use of this interface is not recommended, as added methods to DataCoordServer will
|
// Use of this interface is not recommended, as added methods to DataCoordServer will
|
||||||
@ -1627,6 +1674,60 @@ func _DataCoord_ListImports_Handler(srv interface{}, ctx context.Context, dec fu
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _DataCoord_AddFileResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(milvuspb.AddFileResourceRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(DataCoordServer).AddFileResource(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: DataCoord_AddFileResource_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(DataCoordServer).AddFileResource(ctx, req.(*milvuspb.AddFileResourceRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _DataCoord_RemoveFileResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(milvuspb.RemoveFileResourceRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(DataCoordServer).RemoveFileResource(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: DataCoord_RemoveFileResource_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(DataCoordServer).RemoveFileResource(ctx, req.(*milvuspb.RemoveFileResourceRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _DataCoord_ListFileResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(milvuspb.ListFileResourcesRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(DataCoordServer).ListFileResources(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: DataCoord_ListFileResources_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(DataCoordServer).ListFileResources(ctx, req.(*milvuspb.ListFileResourcesRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// DataCoord_ServiceDesc is the grpc.ServiceDesc for DataCoord service.
|
// DataCoord_ServiceDesc is the grpc.ServiceDesc for DataCoord service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -1822,6 +1923,18 @@ var DataCoord_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "ListImports",
|
MethodName: "ListImports",
|
||||||
Handler: _DataCoord_ListImports_Handler,
|
Handler: _DataCoord_ListImports_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "AddFileResource",
|
||||||
|
Handler: _DataCoord_AddFileResource_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "RemoveFileResource",
|
||||||
|
Handler: _DataCoord_RemoveFileResource_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ListFileResources",
|
||||||
|
Handler: _DataCoord_ListFileResources_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "data_coord.proto",
|
Metadata: "data_coord.proto",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user