mock_segcore

package
v0.10.3-0...-a99c92e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexFaissIDMap      = "FLAT"
	IndexFaissIVFFlat    = "IVF_FLAT"
	IndexFaissIVFPQ      = "IVF_PQ"
	IndexFaissIVFSQ8     = "IVF_SQ8"
	IndexScaNN           = "SCANN"
	IndexFaissBinIDMap   = "BIN_FLAT"
	IndexFaissBinIVFFlat = "BIN_IVF_FLAT"
	IndexHNSW            = "HNSW"
	IndexSparseWand      = "SPARSE_WAND"

	DefaultDim = 128
)

Variables

View Source
var RowIDField = constFieldParam{
	ID: rowIDFieldID,
	// contains filtered or unexported fields
}
View Source
var SimpleFloatVecField = vecFieldParam{
	ID: 100,
	// contains filtered or unexported fields
}
View Source
var SimpleSparseFloatVectorField = vecFieldParam{
	ID: 114,
	// contains filtered or unexported fields
}

Functions

func CheckSearchResult

func CheckSearchResult(ctx context.Context, nq int64, plan *segcore.SearchPlan, searchResult *segcore.SearchResult) error

func GenAndSaveIndex

func GenAndSaveIndex(collectionID, partitionID, segmentID, fieldID int64, msgLength int, indexType, metricType string, cm storage.ChunkManager) (*querypb.FieldIndexInfo, error)

func GenAndSaveIndexV2

func GenAndSaveIndexV2(collectionID, partitionID, segmentID, buildID int64,
	fieldSchema *schemapb.FieldSchema,
	indexInfo *indexpb.IndexInfo,
	cm storage.ChunkManager,
	msgLength int,
) (*querypb.FieldIndexInfo, error)

func GenFieldData

func GenFieldData(fieldName string, fieldID int64, fieldType schemapb.DataType, fieldValue interface{}, dim int64) *schemapb.FieldData

func GenInsertMsg

func GenInsertMsg(collection *segcore.CCollection, partitionID, segment int64, numRows int) (*msgstream.InsertMsg, error)

func GenSearchPlanAndRequests

func GenSearchPlanAndRequests(collection *segcore.CCollection, segments []int64, indexType string, nq int64) (*segcore.SearchRequest, error)

func GenSearchResultData

func GenSearchResultData(nq int64, topk int64, ids []int64, scores []float32, topks []int64) *schemapb.SearchResultData

func GenSimpleRetrievePlan

func GenSimpleRetrievePlan(collection *segcore.CCollection) (*segcore.RetrievePlan, error)

func GenTestBM25CollectionSchema

func GenTestBM25CollectionSchema(collectionName string) *schemapb.CollectionSchema

func GenTestCollectionSchema

func GenTestCollectionSchema(collectionName string, pkType schemapb.DataType, withSparse bool) *schemapb.CollectionSchema

some tests do not yet support sparse float vector, see comments of GenSparseFloatVecDataset in indexcgowrapper/dataset.go

func GenTestIndexInfoList

func GenTestIndexInfoList(collectionID int64, schema *schemapb.CollectionSchema) []*indexpb.IndexInfo

func GenTestIndexMeta

func GenTestIndexMeta(collectionID int64, schema *schemapb.CollectionSchema) *segcorepb.CollectionIndexMeta

func NewTestChunkManagerFactory

func NewTestChunkManagerFactory(params *paramtable.ComponentParam, rootPath string) *storage.ChunkManagerFactory

func SaveBM25Log

func SaveBM25Log(collectionID int64, partitionID int64, segmentID int64, fieldID int64, msgLength int, cm storage.ChunkManager) (*datapb.FieldBinlog, error)

func SaveBinLog

func SaveBinLog(ctx context.Context,
	collectionID int64,
	partitionID int64,
	segmentID int64,
	msgLength int,
	schema *schemapb.CollectionSchema,
	chunkManager storage.ChunkManager,
) ([]*datapb.FieldBinlog, []*datapb.FieldBinlog, error)

func SaveDeltaLog

func SaveDeltaLog(collectionID int64,
	partitionID int64,
	segmentID int64,
	cm storage.ChunkManager,
) ([]*datapb.FieldBinlog, error)

Types

type MockCSegment

type MockCSegment struct {
	mock.Mock
}

MockCSegment is an autogenerated mock type for the CSegment type

func NewMockCSegment

func NewMockCSegment(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCSegment

NewMockCSegment creates a new instance of MockCSegment. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCSegment) AddFieldDataInfo

AddFieldDataInfo provides a mock function with given fields: ctx, request

func (*MockCSegment) Delete

Delete provides a mock function with given fields: ctx, request

func (*MockCSegment) EXPECT

func (_m *MockCSegment) EXPECT() *MockCSegment_Expecter

func (*MockCSegment) HasRawData

func (_m *MockCSegment) HasRawData(fieldID int64) bool

HasRawData provides a mock function with given fields: fieldID

func (*MockCSegment) ID

func (_m *MockCSegment) ID() int64

ID provides a mock function with given fields:

func (*MockCSegment) Insert

Insert provides a mock function with given fields: ctx, request

func (*MockCSegment) LoadFieldData

LoadFieldData provides a mock function with given fields: ctx, request

func (*MockCSegment) MemSize

func (_m *MockCSegment) MemSize() int64

MemSize provides a mock function with given fields:

func (*MockCSegment) RawPointer

func (_m *MockCSegment) RawPointer() segcore.CSegmentInterface

RawPointer provides a mock function with given fields:

func (*MockCSegment) Release

func (_m *MockCSegment) Release()

Release provides a mock function with given fields:

func (*MockCSegment) Retrieve

Retrieve provides a mock function with given fields: ctx, plan

func (*MockCSegment) RetrieveByOffsets

RetrieveByOffsets provides a mock function with given fields: ctx, plan

func (*MockCSegment) RowNum

func (_m *MockCSegment) RowNum() int64

RowNum provides a mock function with given fields:

func (*MockCSegment) Search

func (_m *MockCSegment) Search(ctx context.Context, searchReq *segcore.SearchRequest) (*segcore.SearchResult, error)

Search provides a mock function with given fields: ctx, searchReq

type MockCSegment_AddFieldDataInfo_Call

type MockCSegment_AddFieldDataInfo_Call struct {
	*mock.Call
}

MockCSegment_AddFieldDataInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFieldDataInfo'

func (*MockCSegment_AddFieldDataInfo_Call) Return

func (*MockCSegment_AddFieldDataInfo_Call) Run

type MockCSegment_Delete_Call

type MockCSegment_Delete_Call struct {
	*mock.Call
}

MockCSegment_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'

func (*MockCSegment_Delete_Call) Return

func (*MockCSegment_Delete_Call) Run

func (*MockCSegment_Delete_Call) RunAndReturn

type MockCSegment_Expecter

type MockCSegment_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockCSegment_Expecter) AddFieldDataInfo

func (_e *MockCSegment_Expecter) AddFieldDataInfo(ctx interface{}, request interface{}) *MockCSegment_AddFieldDataInfo_Call

AddFieldDataInfo is a helper method to define mock.On call

  • ctx context.Context
  • request *segcore.LoadFieldDataRequest

func (*MockCSegment_Expecter) Delete

func (_e *MockCSegment_Expecter) Delete(ctx interface{}, request interface{}) *MockCSegment_Delete_Call

Delete is a helper method to define mock.On call

  • ctx context.Context
  • request *segcore.DeleteRequest

func (*MockCSegment_Expecter) HasRawData

func (_e *MockCSegment_Expecter) HasRawData(fieldID interface{}) *MockCSegment_HasRawData_Call

HasRawData is a helper method to define mock.On call

  • fieldID int64

func (*MockCSegment_Expecter) ID

ID is a helper method to define mock.On call

func (*MockCSegment_Expecter) Insert

func (_e *MockCSegment_Expecter) Insert(ctx interface{}, request interface{}) *MockCSegment_Insert_Call

Insert is a helper method to define mock.On call

  • ctx context.Context
  • request *segcore.InsertRequest

func (*MockCSegment_Expecter) LoadFieldData

func (_e *MockCSegment_Expecter) LoadFieldData(ctx interface{}, request interface{}) *MockCSegment_LoadFieldData_Call

LoadFieldData is a helper method to define mock.On call

  • ctx context.Context
  • request *segcore.LoadFieldDataRequest

func (*MockCSegment_Expecter) MemSize

MemSize is a helper method to define mock.On call

func (*MockCSegment_Expecter) RawPointer

RawPointer is a helper method to define mock.On call

func (*MockCSegment_Expecter) Release

Release is a helper method to define mock.On call

func (*MockCSegment_Expecter) Retrieve

func (_e *MockCSegment_Expecter) Retrieve(ctx interface{}, plan interface{}) *MockCSegment_Retrieve_Call

Retrieve is a helper method to define mock.On call

  • ctx context.Context
  • plan *segcore.RetrievePlan

func (*MockCSegment_Expecter) RetrieveByOffsets

func (_e *MockCSegment_Expecter) RetrieveByOffsets(ctx interface{}, plan interface{}) *MockCSegment_RetrieveByOffsets_Call

RetrieveByOffsets is a helper method to define mock.On call

  • ctx context.Context
  • plan *segcore.RetrievePlanWithOffsets

func (*MockCSegment_Expecter) RowNum

RowNum is a helper method to define mock.On call

func (*MockCSegment_Expecter) Search

func (_e *MockCSegment_Expecter) Search(ctx interface{}, searchReq interface{}) *MockCSegment_Search_Call

Search is a helper method to define mock.On call

  • ctx context.Context
  • searchReq *segcore.SearchRequest

type MockCSegment_HasRawData_Call

type MockCSegment_HasRawData_Call struct {
	*mock.Call
}

MockCSegment_HasRawData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasRawData'

func (*MockCSegment_HasRawData_Call) Return

func (*MockCSegment_HasRawData_Call) Run

func (*MockCSegment_HasRawData_Call) RunAndReturn

type MockCSegment_ID_Call

type MockCSegment_ID_Call struct {
	*mock.Call
}

MockCSegment_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID'

func (*MockCSegment_ID_Call) Return

func (*MockCSegment_ID_Call) Run

func (_c *MockCSegment_ID_Call) Run(run func()) *MockCSegment_ID_Call

func (*MockCSegment_ID_Call) RunAndReturn

func (_c *MockCSegment_ID_Call) RunAndReturn(run func() int64) *MockCSegment_ID_Call

type MockCSegment_Insert_Call

type MockCSegment_Insert_Call struct {
	*mock.Call
}

MockCSegment_Insert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Insert'

func (*MockCSegment_Insert_Call) Return

func (*MockCSegment_Insert_Call) Run

func (*MockCSegment_Insert_Call) RunAndReturn

type MockCSegment_LoadFieldData_Call

type MockCSegment_LoadFieldData_Call struct {
	*mock.Call
}

MockCSegment_LoadFieldData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadFieldData'

func (*MockCSegment_LoadFieldData_Call) Return

func (*MockCSegment_LoadFieldData_Call) Run

type MockCSegment_MemSize_Call

type MockCSegment_MemSize_Call struct {
	*mock.Call
}

MockCSegment_MemSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MemSize'

func (*MockCSegment_MemSize_Call) Return

func (*MockCSegment_MemSize_Call) Run

func (*MockCSegment_MemSize_Call) RunAndReturn

func (_c *MockCSegment_MemSize_Call) RunAndReturn(run func() int64) *MockCSegment_MemSize_Call

type MockCSegment_RawPointer_Call

type MockCSegment_RawPointer_Call struct {
	*mock.Call
}

MockCSegment_RawPointer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RawPointer'

func (*MockCSegment_RawPointer_Call) Return

func (*MockCSegment_RawPointer_Call) Run

func (*MockCSegment_RawPointer_Call) RunAndReturn

type MockCSegment_Release_Call

type MockCSegment_Release_Call struct {
	*mock.Call
}

MockCSegment_Release_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Release'

func (*MockCSegment_Release_Call) Return

func (*MockCSegment_Release_Call) Run

func (*MockCSegment_Release_Call) RunAndReturn

func (_c *MockCSegment_Release_Call) RunAndReturn(run func()) *MockCSegment_Release_Call

type MockCSegment_RetrieveByOffsets_Call

type MockCSegment_RetrieveByOffsets_Call struct {
	*mock.Call
}

MockCSegment_RetrieveByOffsets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveByOffsets'

func (*MockCSegment_RetrieveByOffsets_Call) Return

func (*MockCSegment_RetrieveByOffsets_Call) Run

type MockCSegment_Retrieve_Call

type MockCSegment_Retrieve_Call struct {
	*mock.Call
}

MockCSegment_Retrieve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Retrieve'

func (*MockCSegment_Retrieve_Call) Return

func (*MockCSegment_Retrieve_Call) Run

func (*MockCSegment_Retrieve_Call) RunAndReturn

type MockCSegment_RowNum_Call

type MockCSegment_RowNum_Call struct {
	*mock.Call
}

MockCSegment_RowNum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RowNum'

func (*MockCSegment_RowNum_Call) Return

func (*MockCSegment_RowNum_Call) Run

func (*MockCSegment_RowNum_Call) RunAndReturn

func (_c *MockCSegment_RowNum_Call) RunAndReturn(run func() int64) *MockCSegment_RowNum_Call

type MockCSegment_Search_Call

type MockCSegment_Search_Call struct {
	*mock.Call
}

MockCSegment_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'

func (*MockCSegment_Search_Call) Return

func (*MockCSegment_Search_Call) Run

func (*MockCSegment_Search_Call) RunAndReturn

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL