From 4c310005e5c715336f40b0cb79021f48576e23c3 Mon Sep 17 00:00:00 2001 From: Prateek Rungta Date: Thu, 18 Apr 2019 13:35:13 -0400 Subject: [PATCH] [dbnode] Register index.Query/Aggregate finalizers (#1567) --- src/dbnode/generated/mocks/generate.go | 2 +- src/dbnode/storage/index.go | 2 + src/dbnode/storage/index/index_mock.go | 1282 +++++++++++++++++++----- src/dbnode/storage/index_block_test.go | 185 ++++ 4 files changed, 1223 insertions(+), 248 deletions(-) diff --git a/src/dbnode/generated/mocks/generate.go b/src/dbnode/generated/mocks/generate.go index 80a04dc398..d271f0dfff 100644 --- a/src/dbnode/generated/mocks/generate.go +++ b/src/dbnode/generated/mocks/generate.go @@ -24,7 +24,6 @@ //go:generate sh -c "mockgen -package=xio $PACKAGE/src/dbnode/x/xio SegmentReader,SegmentReaderPool | genclean -pkg $PACKAGE/src/dbnode/x/xio -out $GOPATH/src/$PACKAGE/src/dbnode/x/xio/io_mock.go" //go:generate sh -c "mockgen -package=digest -destination=$GOPATH/src/$PACKAGE/src/dbnode/digest/digest_mock.go $PACKAGE/src/dbnode/digest ReaderWithDigest" //go:generate sh -c "mockgen -package=series $PACKAGE/src/dbnode/storage/series DatabaseSeries,QueryableBlockRetriever | genclean -pkg $PACKAGE/src/dbnode/storage/series -out $GOPATH/src/$PACKAGE/src/dbnode/storage/series/series_mock.go" -//go:generate sh -c "mockgen -package=index $PACKAGE/src/dbnode/storage/index QueryResults,AggregateResults,Block,OnIndexSeries | genclean -pkg $PACKAGE/src/dbnode/storage/index -out $GOPATH/src/$PACKAGE/src/dbnode/storage/index/index_mock.go" // mockgen rules for generating mocks for unexported interfaces (file mode) //go:generate sh -c "mockgen -package=encoding -destination=$GOPATH/src/$PACKAGE/src/dbnode/encoding/encoding_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/encoding/types.go" @@ -41,5 +40,6 @@ //go:generate sh -c "mockgen -package=namespace -destination=$GOPATH/src/$PACKAGE/src/dbnode/storage/namespace/namespace_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/storage/namespace/types.go" //go:generate sh -c "mockgen -package=runtime -destination=$GOPATH/src/$PACKAGE/src/dbnode/runtime/runtime_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/runtime/types.go" //go:generate sh -c "mockgen -package=ts -destination=$GOPATH/src/$PACKAGE/src/dbnode/ts/write_batch_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/ts/types.go" +//go:generate sh -c "mockgen -package=index -destination=$GOPATH/src/$PACKAGE/src/dbnode/storage/index/index_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/storage/index/types.go" package mocks diff --git a/src/dbnode/storage/index.go b/src/dbnode/storage/index.go index cfdd620670..21a7359b9e 100644 --- a/src/dbnode/storage/index.go +++ b/src/dbnode/storage/index.go @@ -868,6 +868,7 @@ func (i *nsIndex) Query( results.Reset(i.nsMetadata.ID(), index.QueryResultsOptions{ SizeLimit: opts.Limit, }) + ctx.RegisterFinalizer(results) exhaustive, err := i.query(ctx, query, results, opts) if err != nil { return index.QueryResult{}, err @@ -890,6 +891,7 @@ func (i *nsIndex) AggregateQuery( TermFilter: opts.TermFilter, Type: opts.Type, }) + ctx.RegisterFinalizer(results) exhaustive, err := i.query(ctx, query, results, opts.QueryOptions) if err != nil { return index.AggregateQueryResult{}, err diff --git a/src/dbnode/storage/index/index_mock.go b/src/dbnode/storage/index/index_mock.go index 407cee94e0..268def6ad3 100644 --- a/src/dbnode/storage/index/index_mock.go +++ b/src/dbnode/storage/index/index_mock.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/m3db/m3/src/dbnode/storage/index (interfaces: QueryResults,AggregateResults,Block,OnIndexSeries) +// Source: github.com/m3db/m3/src/dbnode/storage/index/types.go // Copyright (c) 2019 Uber Technologies, Inc. // @@ -28,473 +28,1261 @@ import ( "reflect" "time" + "github.com/m3db/m3/src/dbnode/clock" "github.com/m3db/m3/src/dbnode/storage/bootstrap/result" + "github.com/m3db/m3/src/dbnode/storage/index/compaction" "github.com/m3db/m3/src/m3ninx/doc" + "github.com/m3db/m3/src/m3ninx/index/segment/builder" + "github.com/m3db/m3/src/m3ninx/index/segment/fst" + "github.com/m3db/m3/src/m3ninx/index/segment/mem" "github.com/m3db/m3/src/x/context" "github.com/m3db/m3/src/x/ident" + "github.com/m3db/m3/src/x/instrument" + "github.com/m3db/m3/src/x/pool" "github.com/m3db/m3/src/x/resource" time0 "github.com/m3db/m3/src/x/time" "github.com/golang/mock/gomock" ) +// MockBaseResults is a mock of BaseResults interface +type MockBaseResults struct { + ctrl *gomock.Controller + recorder *MockBaseResultsMockRecorder +} + +// MockBaseResultsMockRecorder is the mock recorder for MockBaseResults +type MockBaseResultsMockRecorder struct { + mock *MockBaseResults +} + +// NewMockBaseResults creates a new mock instance +func NewMockBaseResults(ctrl *gomock.Controller) *MockBaseResults { + mock := &MockBaseResults{ctrl: ctrl} + mock.recorder = &MockBaseResultsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockBaseResults) EXPECT() *MockBaseResultsMockRecorder { + return m.recorder +} + +// Namespace mocks base method +func (m *MockBaseResults) Namespace() ident.ID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Namespace") + ret0, _ := ret[0].(ident.ID) + return ret0 +} + +// Namespace indicates an expected call of Namespace +func (mr *MockBaseResultsMockRecorder) Namespace() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Namespace", reflect.TypeOf((*MockBaseResults)(nil).Namespace)) +} + +// Size mocks base method +func (m *MockBaseResults) Size() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Size") + ret0, _ := ret[0].(int) + return ret0 +} + +// Size indicates an expected call of Size +func (mr *MockBaseResultsMockRecorder) Size() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockBaseResults)(nil).Size)) +} + +// AddDocuments mocks base method +func (m *MockBaseResults) AddDocuments(batch []doc.Document) (int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddDocuments", batch) + ret0, _ := ret[0].(int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddDocuments indicates an expected call of AddDocuments +func (mr *MockBaseResultsMockRecorder) AddDocuments(batch interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDocuments", reflect.TypeOf((*MockBaseResults)(nil).AddDocuments), batch) +} + +// Finalize mocks base method +func (m *MockBaseResults) Finalize() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Finalize") +} + +// Finalize indicates an expected call of Finalize +func (mr *MockBaseResultsMockRecorder) Finalize() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finalize", reflect.TypeOf((*MockBaseResults)(nil).Finalize)) +} + // MockQueryResults is a mock of QueryResults interface type MockQueryResults struct { ctrl *gomock.Controller - recorder *MockQueryResultsMockRecorder + recorder *MockQueryResultsMockRecorder +} + +// MockQueryResultsMockRecorder is the mock recorder for MockQueryResults +type MockQueryResultsMockRecorder struct { + mock *MockQueryResults +} + +// NewMockQueryResults creates a new mock instance +func NewMockQueryResults(ctrl *gomock.Controller) *MockQueryResults { + mock := &MockQueryResults{ctrl: ctrl} + mock.recorder = &MockQueryResultsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockQueryResults) EXPECT() *MockQueryResultsMockRecorder { + return m.recorder +} + +// Namespace mocks base method +func (m *MockQueryResults) Namespace() ident.ID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Namespace") + ret0, _ := ret[0].(ident.ID) + return ret0 +} + +// Namespace indicates an expected call of Namespace +func (mr *MockQueryResultsMockRecorder) Namespace() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Namespace", reflect.TypeOf((*MockQueryResults)(nil).Namespace)) +} + +// Size mocks base method +func (m *MockQueryResults) Size() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Size") + ret0, _ := ret[0].(int) + return ret0 +} + +// Size indicates an expected call of Size +func (mr *MockQueryResultsMockRecorder) Size() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockQueryResults)(nil).Size)) +} + +// AddDocuments mocks base method +func (m *MockQueryResults) AddDocuments(batch []doc.Document) (int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddDocuments", batch) + ret0, _ := ret[0].(int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddDocuments indicates an expected call of AddDocuments +func (mr *MockQueryResultsMockRecorder) AddDocuments(batch interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDocuments", reflect.TypeOf((*MockQueryResults)(nil).AddDocuments), batch) +} + +// Finalize mocks base method +func (m *MockQueryResults) Finalize() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Finalize") +} + +// Finalize indicates an expected call of Finalize +func (mr *MockQueryResultsMockRecorder) Finalize() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finalize", reflect.TypeOf((*MockQueryResults)(nil).Finalize)) +} + +// Reset mocks base method +func (m *MockQueryResults) Reset(nsID ident.ID, opts QueryResultsOptions) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Reset", nsID, opts) +} + +// Reset indicates an expected call of Reset +func (mr *MockQueryResultsMockRecorder) Reset(nsID, opts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockQueryResults)(nil).Reset), nsID, opts) +} + +// Map mocks base method +func (m *MockQueryResults) Map() *ResultsMap { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Map") + ret0, _ := ret[0].(*ResultsMap) + return ret0 +} + +// Map indicates an expected call of Map +func (mr *MockQueryResultsMockRecorder) Map() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockQueryResults)(nil).Map)) +} + +// NoFinalize mocks base method +func (m *MockQueryResults) NoFinalize() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "NoFinalize") +} + +// NoFinalize indicates an expected call of NoFinalize +func (mr *MockQueryResultsMockRecorder) NoFinalize() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NoFinalize", reflect.TypeOf((*MockQueryResults)(nil).NoFinalize)) +} + +// MockQueryResultsPool is a mock of QueryResultsPool interface +type MockQueryResultsPool struct { + ctrl *gomock.Controller + recorder *MockQueryResultsPoolMockRecorder +} + +// MockQueryResultsPoolMockRecorder is the mock recorder for MockQueryResultsPool +type MockQueryResultsPoolMockRecorder struct { + mock *MockQueryResultsPool +} + +// NewMockQueryResultsPool creates a new mock instance +func NewMockQueryResultsPool(ctrl *gomock.Controller) *MockQueryResultsPool { + mock := &MockQueryResultsPool{ctrl: ctrl} + mock.recorder = &MockQueryResultsPoolMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockQueryResultsPool) EXPECT() *MockQueryResultsPoolMockRecorder { + return m.recorder +} + +// Init mocks base method +func (m *MockQueryResultsPool) Init(alloc QueryResultsAllocator) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Init", alloc) +} + +// Init indicates an expected call of Init +func (mr *MockQueryResultsPoolMockRecorder) Init(alloc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockQueryResultsPool)(nil).Init), alloc) +} + +// Get mocks base method +func (m *MockQueryResultsPool) Get() QueryResults { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get") + ret0, _ := ret[0].(QueryResults) + return ret0 +} + +// Get indicates an expected call of Get +func (mr *MockQueryResultsPoolMockRecorder) Get() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockQueryResultsPool)(nil).Get)) +} + +// Put mocks base method +func (m *MockQueryResultsPool) Put(value QueryResults) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Put", value) +} + +// Put indicates an expected call of Put +func (mr *MockQueryResultsPoolMockRecorder) Put(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockQueryResultsPool)(nil).Put), value) +} + +// MockAggregateResults is a mock of AggregateResults interface +type MockAggregateResults struct { + ctrl *gomock.Controller + recorder *MockAggregateResultsMockRecorder +} + +// MockAggregateResultsMockRecorder is the mock recorder for MockAggregateResults +type MockAggregateResultsMockRecorder struct { + mock *MockAggregateResults +} + +// NewMockAggregateResults creates a new mock instance +func NewMockAggregateResults(ctrl *gomock.Controller) *MockAggregateResults { + mock := &MockAggregateResults{ctrl: ctrl} + mock.recorder = &MockAggregateResultsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockAggregateResults) EXPECT() *MockAggregateResultsMockRecorder { + return m.recorder +} + +// Namespace mocks base method +func (m *MockAggregateResults) Namespace() ident.ID { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Namespace") + ret0, _ := ret[0].(ident.ID) + return ret0 +} + +// Namespace indicates an expected call of Namespace +func (mr *MockAggregateResultsMockRecorder) Namespace() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Namespace", reflect.TypeOf((*MockAggregateResults)(nil).Namespace)) +} + +// Size mocks base method +func (m *MockAggregateResults) Size() int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Size") + ret0, _ := ret[0].(int) + return ret0 +} + +// Size indicates an expected call of Size +func (mr *MockAggregateResultsMockRecorder) Size() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockAggregateResults)(nil).Size)) +} + +// AddDocuments mocks base method +func (m *MockAggregateResults) AddDocuments(batch []doc.Document) (int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddDocuments", batch) + ret0, _ := ret[0].(int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddDocuments indicates an expected call of AddDocuments +func (mr *MockAggregateResultsMockRecorder) AddDocuments(batch interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDocuments", reflect.TypeOf((*MockAggregateResults)(nil).AddDocuments), batch) +} + +// Finalize mocks base method +func (m *MockAggregateResults) Finalize() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Finalize") +} + +// Finalize indicates an expected call of Finalize +func (mr *MockAggregateResultsMockRecorder) Finalize() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finalize", reflect.TypeOf((*MockAggregateResults)(nil).Finalize)) +} + +// Reset mocks base method +func (m *MockAggregateResults) Reset(nsID ident.ID, aggregateQueryOpts AggregateResultsOptions) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Reset", nsID, aggregateQueryOpts) +} + +// Reset indicates an expected call of Reset +func (mr *MockAggregateResultsMockRecorder) Reset(nsID, aggregateQueryOpts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockAggregateResults)(nil).Reset), nsID, aggregateQueryOpts) +} + +// Map mocks base method +func (m *MockAggregateResults) Map() *AggregateResultsMap { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Map") + ret0, _ := ret[0].(*AggregateResultsMap) + return ret0 +} + +// Map indicates an expected call of Map +func (mr *MockAggregateResultsMockRecorder) Map() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockAggregateResults)(nil).Map)) +} + +// MockAggregateResultsPool is a mock of AggregateResultsPool interface +type MockAggregateResultsPool struct { + ctrl *gomock.Controller + recorder *MockAggregateResultsPoolMockRecorder +} + +// MockAggregateResultsPoolMockRecorder is the mock recorder for MockAggregateResultsPool +type MockAggregateResultsPoolMockRecorder struct { + mock *MockAggregateResultsPool +} + +// NewMockAggregateResultsPool creates a new mock instance +func NewMockAggregateResultsPool(ctrl *gomock.Controller) *MockAggregateResultsPool { + mock := &MockAggregateResultsPool{ctrl: ctrl} + mock.recorder = &MockAggregateResultsPoolMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockAggregateResultsPool) EXPECT() *MockAggregateResultsPoolMockRecorder { + return m.recorder +} + +// Init mocks base method +func (m *MockAggregateResultsPool) Init(alloc AggregateResultsAllocator) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Init", alloc) +} + +// Init indicates an expected call of Init +func (mr *MockAggregateResultsPoolMockRecorder) Init(alloc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockAggregateResultsPool)(nil).Init), alloc) +} + +// Get mocks base method +func (m *MockAggregateResultsPool) Get() AggregateResults { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get") + ret0, _ := ret[0].(AggregateResults) + return ret0 +} + +// Get indicates an expected call of Get +func (mr *MockAggregateResultsPoolMockRecorder) Get() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockAggregateResultsPool)(nil).Get)) +} + +// Put mocks base method +func (m *MockAggregateResultsPool) Put(value AggregateResults) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Put", value) +} + +// Put indicates an expected call of Put +func (mr *MockAggregateResultsPoolMockRecorder) Put(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockAggregateResultsPool)(nil).Put), value) +} + +// MockAggregateValuesPool is a mock of AggregateValuesPool interface +type MockAggregateValuesPool struct { + ctrl *gomock.Controller + recorder *MockAggregateValuesPoolMockRecorder +} + +// MockAggregateValuesPoolMockRecorder is the mock recorder for MockAggregateValuesPool +type MockAggregateValuesPoolMockRecorder struct { + mock *MockAggregateValuesPool +} + +// NewMockAggregateValuesPool creates a new mock instance +func NewMockAggregateValuesPool(ctrl *gomock.Controller) *MockAggregateValuesPool { + mock := &MockAggregateValuesPool{ctrl: ctrl} + mock.recorder = &MockAggregateValuesPoolMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockAggregateValuesPool) EXPECT() *MockAggregateValuesPoolMockRecorder { + return m.recorder +} + +// Init mocks base method +func (m *MockAggregateValuesPool) Init(alloc AggregateValuesAllocator) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Init", alloc) +} + +// Init indicates an expected call of Init +func (mr *MockAggregateValuesPoolMockRecorder) Init(alloc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockAggregateValuesPool)(nil).Init), alloc) +} + +// Get mocks base method +func (m *MockAggregateValuesPool) Get() AggregateValues { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get") + ret0, _ := ret[0].(AggregateValues) + return ret0 +} + +// Get indicates an expected call of Get +func (mr *MockAggregateValuesPoolMockRecorder) Get() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockAggregateValuesPool)(nil).Get)) +} + +// Put mocks base method +func (m *MockAggregateValuesPool) Put(value AggregateValues) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Put", value) +} + +// Put indicates an expected call of Put +func (mr *MockAggregateValuesPoolMockRecorder) Put(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockAggregateValuesPool)(nil).Put), value) +} + +// MockOnIndexSeries is a mock of OnIndexSeries interface +type MockOnIndexSeries struct { + ctrl *gomock.Controller + recorder *MockOnIndexSeriesMockRecorder +} + +// MockOnIndexSeriesMockRecorder is the mock recorder for MockOnIndexSeries +type MockOnIndexSeriesMockRecorder struct { + mock *MockOnIndexSeries +} + +// NewMockOnIndexSeries creates a new mock instance +func NewMockOnIndexSeries(ctrl *gomock.Controller) *MockOnIndexSeries { + mock := &MockOnIndexSeries{ctrl: ctrl} + mock.recorder = &MockOnIndexSeriesMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockOnIndexSeries) EXPECT() *MockOnIndexSeriesMockRecorder { + return m.recorder +} + +// OnIndexSuccess mocks base method +func (m *MockOnIndexSeries) OnIndexSuccess(blockStart time0.UnixNano) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "OnIndexSuccess", blockStart) +} + +// OnIndexSuccess indicates an expected call of OnIndexSuccess +func (mr *MockOnIndexSeriesMockRecorder) OnIndexSuccess(blockStart interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnIndexSuccess", reflect.TypeOf((*MockOnIndexSeries)(nil).OnIndexSuccess), blockStart) +} + +// OnIndexFinalize mocks base method +func (m *MockOnIndexSeries) OnIndexFinalize(blockStart time0.UnixNano) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "OnIndexFinalize", blockStart) +} + +// OnIndexFinalize indicates an expected call of OnIndexFinalize +func (mr *MockOnIndexSeriesMockRecorder) OnIndexFinalize(blockStart interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnIndexFinalize", reflect.TypeOf((*MockOnIndexSeries)(nil).OnIndexFinalize), blockStart) +} + +// MockBlock is a mock of Block interface +type MockBlock struct { + ctrl *gomock.Controller + recorder *MockBlockMockRecorder +} + +// MockBlockMockRecorder is the mock recorder for MockBlock +type MockBlockMockRecorder struct { + mock *MockBlock +} + +// NewMockBlock creates a new mock instance +func NewMockBlock(ctrl *gomock.Controller) *MockBlock { + mock := &MockBlock{ctrl: ctrl} + mock.recorder = &MockBlockMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockBlock) EXPECT() *MockBlockMockRecorder { + return m.recorder +} + +// StartTime mocks base method +func (m *MockBlock) StartTime() time.Time { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "StartTime") + ret0, _ := ret[0].(time.Time) + return ret0 +} + +// StartTime indicates an expected call of StartTime +func (mr *MockBlockMockRecorder) StartTime() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartTime", reflect.TypeOf((*MockBlock)(nil).StartTime)) +} + +// EndTime mocks base method +func (m *MockBlock) EndTime() time.Time { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EndTime") + ret0, _ := ret[0].(time.Time) + return ret0 +} + +// EndTime indicates an expected call of EndTime +func (mr *MockBlockMockRecorder) EndTime() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndTime", reflect.TypeOf((*MockBlock)(nil).EndTime)) +} + +// WriteBatch mocks base method +func (m *MockBlock) WriteBatch(inserts *WriteBatch) (WriteBatchResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WriteBatch", inserts) + ret0, _ := ret[0].(WriteBatchResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WriteBatch indicates an expected call of WriteBatch +func (mr *MockBlockMockRecorder) WriteBatch(inserts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteBatch", reflect.TypeOf((*MockBlock)(nil).WriteBatch), inserts) +} + +// Query mocks base method +func (m *MockBlock) Query(cancellable *resource.CancellableLifetime, query Query, opts QueryOptions, results BaseResults) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Query", cancellable, query, opts, results) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Query indicates an expected call of Query +func (mr *MockBlockMockRecorder) Query(cancellable, query, opts, results interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockBlock)(nil).Query), cancellable, query, opts, results) +} + +// AddResults mocks base method +func (m *MockBlock) AddResults(results result.IndexBlock) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddResults", results) + ret0, _ := ret[0].(error) + return ret0 +} + +// AddResults indicates an expected call of AddResults +func (mr *MockBlockMockRecorder) AddResults(results interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddResults", reflect.TypeOf((*MockBlock)(nil).AddResults), results) +} + +// Tick mocks base method +func (m *MockBlock) Tick(c context.Cancellable, tickStart time.Time) (BlockTickResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Tick", c, tickStart) + ret0, _ := ret[0].(BlockTickResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Tick indicates an expected call of Tick +func (mr *MockBlockMockRecorder) Tick(c, tickStart interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockBlock)(nil).Tick), c, tickStart) +} + +// Stats mocks base method +func (m *MockBlock) Stats(reporter BlockStatsReporter) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Stats", reporter) + ret0, _ := ret[0].(error) + return ret0 +} + +// Stats indicates an expected call of Stats +func (mr *MockBlockMockRecorder) Stats(reporter interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockBlock)(nil).Stats), reporter) +} + +// Seal mocks base method +func (m *MockBlock) Seal() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Seal") + ret0, _ := ret[0].(error) + return ret0 +} + +// Seal indicates an expected call of Seal +func (mr *MockBlockMockRecorder) Seal() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Seal", reflect.TypeOf((*MockBlock)(nil).Seal)) +} + +// IsSealed mocks base method +func (m *MockBlock) IsSealed() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsSealed") + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsSealed indicates an expected call of IsSealed +func (mr *MockBlockMockRecorder) IsSealed() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSealed", reflect.TypeOf((*MockBlock)(nil).IsSealed)) +} + +// NeedsMutableSegmentsEvicted mocks base method +func (m *MockBlock) NeedsMutableSegmentsEvicted() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NeedsMutableSegmentsEvicted") + ret0, _ := ret[0].(bool) + return ret0 +} + +// NeedsMutableSegmentsEvicted indicates an expected call of NeedsMutableSegmentsEvicted +func (mr *MockBlockMockRecorder) NeedsMutableSegmentsEvicted() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NeedsMutableSegmentsEvicted", reflect.TypeOf((*MockBlock)(nil).NeedsMutableSegmentsEvicted)) +} + +// EvictMutableSegments mocks base method +func (m *MockBlock) EvictMutableSegments() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "EvictMutableSegments") + ret0, _ := ret[0].(error) + return ret0 +} + +// EvictMutableSegments indicates an expected call of EvictMutableSegments +func (mr *MockBlockMockRecorder) EvictMutableSegments() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EvictMutableSegments", reflect.TypeOf((*MockBlock)(nil).EvictMutableSegments)) +} + +// Close mocks base method +func (m *MockBlock) Close() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close") + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close +func (mr *MockBlockMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockBlock)(nil).Close)) +} + +// MockBlockStatsReporter is a mock of BlockStatsReporter interface +type MockBlockStatsReporter struct { + ctrl *gomock.Controller + recorder *MockBlockStatsReporterMockRecorder } -// MockQueryResultsMockRecorder is the mock recorder for MockQueryResults -type MockQueryResultsMockRecorder struct { - mock *MockQueryResults +// MockBlockStatsReporterMockRecorder is the mock recorder for MockBlockStatsReporter +type MockBlockStatsReporterMockRecorder struct { + mock *MockBlockStatsReporter } -// NewMockQueryResults creates a new mock instance -func NewMockQueryResults(ctrl *gomock.Controller) *MockQueryResults { - mock := &MockQueryResults{ctrl: ctrl} - mock.recorder = &MockQueryResultsMockRecorder{mock} +// NewMockBlockStatsReporter creates a new mock instance +func NewMockBlockStatsReporter(ctrl *gomock.Controller) *MockBlockStatsReporter { + mock := &MockBlockStatsReporter{ctrl: ctrl} + mock.recorder = &MockBlockStatsReporterMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use -func (m *MockQueryResults) EXPECT() *MockQueryResultsMockRecorder { +func (m *MockBlockStatsReporter) EXPECT() *MockBlockStatsReporterMockRecorder { return m.recorder } -// AddDocuments mocks base method -func (m *MockQueryResults) AddDocuments(arg0 []doc.Document) (int, error) { +// ReportSegmentStats mocks base method +func (m *MockBlockStatsReporter) ReportSegmentStats(stats BlockSegmentStats) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDocuments", arg0) - ret0, _ := ret[0].(int) - ret1, _ := ret[1].(error) - return ret0, ret1 + m.ctrl.Call(m, "ReportSegmentStats", stats) } -// AddDocuments indicates an expected call of AddDocuments -func (mr *MockQueryResultsMockRecorder) AddDocuments(arg0 interface{}) *gomock.Call { +// ReportSegmentStats indicates an expected call of ReportSegmentStats +func (mr *MockBlockStatsReporterMockRecorder) ReportSegmentStats(stats interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDocuments", reflect.TypeOf((*MockQueryResults)(nil).AddDocuments), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportSegmentStats", reflect.TypeOf((*MockBlockStatsReporter)(nil).ReportSegmentStats), stats) } -// Finalize mocks base method -func (m *MockQueryResults) Finalize() { +// MockOptions is a mock of Options interface +type MockOptions struct { + ctrl *gomock.Controller + recorder *MockOptionsMockRecorder +} + +// MockOptionsMockRecorder is the mock recorder for MockOptions +type MockOptionsMockRecorder struct { + mock *MockOptions +} + +// NewMockOptions creates a new mock instance +func NewMockOptions(ctrl *gomock.Controller) *MockOptions { + mock := &MockOptions{ctrl: ctrl} + mock.recorder = &MockOptionsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockOptions) EXPECT() *MockOptionsMockRecorder { + return m.recorder +} + +// Validate mocks base method +func (m *MockOptions) Validate() error { m.ctrl.T.Helper() - m.ctrl.Call(m, "Finalize") + ret := m.ctrl.Call(m, "Validate") + ret0, _ := ret[0].(error) + return ret0 } -// Finalize indicates an expected call of Finalize -func (mr *MockQueryResultsMockRecorder) Finalize() *gomock.Call { +// Validate indicates an expected call of Validate +func (mr *MockOptionsMockRecorder) Validate() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finalize", reflect.TypeOf((*MockQueryResults)(nil).Finalize)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validate", reflect.TypeOf((*MockOptions)(nil).Validate)) } -// Map mocks base method -func (m *MockQueryResults) Map() *ResultsMap { +// SetInsertMode mocks base method +func (m *MockOptions) SetInsertMode(value InsertMode) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Map") - ret0, _ := ret[0].(*ResultsMap) + ret := m.ctrl.Call(m, "SetInsertMode", value) + ret0, _ := ret[0].(Options) return ret0 } -// Map indicates an expected call of Map -func (mr *MockQueryResultsMockRecorder) Map() *gomock.Call { +// SetInsertMode indicates an expected call of SetInsertMode +func (mr *MockOptionsMockRecorder) SetInsertMode(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockQueryResults)(nil).Map)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetInsertMode", reflect.TypeOf((*MockOptions)(nil).SetInsertMode), value) } -// Namespace mocks base method -func (m *MockQueryResults) Namespace() ident.ID { +// InsertMode mocks base method +func (m *MockOptions) InsertMode() InsertMode { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Namespace") - ret0, _ := ret[0].(ident.ID) + ret := m.ctrl.Call(m, "InsertMode") + ret0, _ := ret[0].(InsertMode) return ret0 } -// Namespace indicates an expected call of Namespace -func (mr *MockQueryResultsMockRecorder) Namespace() *gomock.Call { +// InsertMode indicates an expected call of InsertMode +func (mr *MockOptionsMockRecorder) InsertMode() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Namespace", reflect.TypeOf((*MockQueryResults)(nil).Namespace)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InsertMode", reflect.TypeOf((*MockOptions)(nil).InsertMode)) } -// NoFinalize mocks base method -func (m *MockQueryResults) NoFinalize() { +// SetClockOptions mocks base method +func (m *MockOptions) SetClockOptions(value clock.Options) Options { m.ctrl.T.Helper() - m.ctrl.Call(m, "NoFinalize") + ret := m.ctrl.Call(m, "SetClockOptions", value) + ret0, _ := ret[0].(Options) + return ret0 } -// NoFinalize indicates an expected call of NoFinalize -func (mr *MockQueryResultsMockRecorder) NoFinalize() *gomock.Call { +// SetClockOptions indicates an expected call of SetClockOptions +func (mr *MockOptionsMockRecorder) SetClockOptions(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NoFinalize", reflect.TypeOf((*MockQueryResults)(nil).NoFinalize)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetClockOptions", reflect.TypeOf((*MockOptions)(nil).SetClockOptions), value) } -// Reset mocks base method -func (m *MockQueryResults) Reset(arg0 ident.ID, arg1 QueryResultsOptions) { +// ClockOptions mocks base method +func (m *MockOptions) ClockOptions() clock.Options { m.ctrl.T.Helper() - m.ctrl.Call(m, "Reset", arg0, arg1) + ret := m.ctrl.Call(m, "ClockOptions") + ret0, _ := ret[0].(clock.Options) + return ret0 } -// Reset indicates an expected call of Reset -func (mr *MockQueryResultsMockRecorder) Reset(arg0, arg1 interface{}) *gomock.Call { +// ClockOptions indicates an expected call of ClockOptions +func (mr *MockOptionsMockRecorder) ClockOptions() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockQueryResults)(nil).Reset), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClockOptions", reflect.TypeOf((*MockOptions)(nil).ClockOptions)) } -// Size mocks base method -func (m *MockQueryResults) Size() int { +// SetInstrumentOptions mocks base method +func (m *MockOptions) SetInstrumentOptions(value instrument.Options) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Size") - ret0, _ := ret[0].(int) + ret := m.ctrl.Call(m, "SetInstrumentOptions", value) + ret0, _ := ret[0].(Options) return ret0 } -// Size indicates an expected call of Size -func (mr *MockQueryResultsMockRecorder) Size() *gomock.Call { +// SetInstrumentOptions indicates an expected call of SetInstrumentOptions +func (mr *MockOptionsMockRecorder) SetInstrumentOptions(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockQueryResults)(nil).Size)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetInstrumentOptions", reflect.TypeOf((*MockOptions)(nil).SetInstrumentOptions), value) } -// MockAggregateResults is a mock of AggregateResults interface -type MockAggregateResults struct { - ctrl *gomock.Controller - recorder *MockAggregateResultsMockRecorder +// InstrumentOptions mocks base method +func (m *MockOptions) InstrumentOptions() instrument.Options { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InstrumentOptions") + ret0, _ := ret[0].(instrument.Options) + return ret0 } -// MockAggregateResultsMockRecorder is the mock recorder for MockAggregateResults -type MockAggregateResultsMockRecorder struct { - mock *MockAggregateResults +// InstrumentOptions indicates an expected call of InstrumentOptions +func (mr *MockOptionsMockRecorder) InstrumentOptions() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InstrumentOptions", reflect.TypeOf((*MockOptions)(nil).InstrumentOptions)) } -// NewMockAggregateResults creates a new mock instance -func NewMockAggregateResults(ctrl *gomock.Controller) *MockAggregateResults { - mock := &MockAggregateResults{ctrl: ctrl} - mock.recorder = &MockAggregateResultsMockRecorder{mock} - return mock +// SetSegmentBuilderOptions mocks base method +func (m *MockOptions) SetSegmentBuilderOptions(value builder.Options) Options { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetSegmentBuilderOptions", value) + ret0, _ := ret[0].(Options) + return ret0 } -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockAggregateResults) EXPECT() *MockAggregateResultsMockRecorder { - return m.recorder +// SetSegmentBuilderOptions indicates an expected call of SetSegmentBuilderOptions +func (mr *MockOptionsMockRecorder) SetSegmentBuilderOptions(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSegmentBuilderOptions", reflect.TypeOf((*MockOptions)(nil).SetSegmentBuilderOptions), value) } -// AddDocuments mocks base method -func (m *MockAggregateResults) AddDocuments(arg0 []doc.Document) (int, error) { +// SegmentBuilderOptions mocks base method +func (m *MockOptions) SegmentBuilderOptions() builder.Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddDocuments", arg0) - ret0, _ := ret[0].(int) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "SegmentBuilderOptions") + ret0, _ := ret[0].(builder.Options) + return ret0 } -// AddDocuments indicates an expected call of AddDocuments -func (mr *MockAggregateResultsMockRecorder) AddDocuments(arg0 interface{}) *gomock.Call { +// SegmentBuilderOptions indicates an expected call of SegmentBuilderOptions +func (mr *MockOptionsMockRecorder) SegmentBuilderOptions() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddDocuments", reflect.TypeOf((*MockAggregateResults)(nil).AddDocuments), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SegmentBuilderOptions", reflect.TypeOf((*MockOptions)(nil).SegmentBuilderOptions)) } -// Finalize mocks base method -func (m *MockAggregateResults) Finalize() { +// SetMemSegmentOptions mocks base method +func (m *MockOptions) SetMemSegmentOptions(value mem.Options) Options { m.ctrl.T.Helper() - m.ctrl.Call(m, "Finalize") + ret := m.ctrl.Call(m, "SetMemSegmentOptions", value) + ret0, _ := ret[0].(Options) + return ret0 } -// Finalize indicates an expected call of Finalize -func (mr *MockAggregateResultsMockRecorder) Finalize() *gomock.Call { +// SetMemSegmentOptions indicates an expected call of SetMemSegmentOptions +func (mr *MockOptionsMockRecorder) SetMemSegmentOptions(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Finalize", reflect.TypeOf((*MockAggregateResults)(nil).Finalize)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMemSegmentOptions", reflect.TypeOf((*MockOptions)(nil).SetMemSegmentOptions), value) } -// Map mocks base method -func (m *MockAggregateResults) Map() *AggregateResultsMap { +// MemSegmentOptions mocks base method +func (m *MockOptions) MemSegmentOptions() mem.Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Map") - ret0, _ := ret[0].(*AggregateResultsMap) + ret := m.ctrl.Call(m, "MemSegmentOptions") + ret0, _ := ret[0].(mem.Options) return ret0 } -// Map indicates an expected call of Map -func (mr *MockAggregateResultsMockRecorder) Map() *gomock.Call { +// MemSegmentOptions indicates an expected call of MemSegmentOptions +func (mr *MockOptionsMockRecorder) MemSegmentOptions() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Map", reflect.TypeOf((*MockAggregateResults)(nil).Map)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MemSegmentOptions", reflect.TypeOf((*MockOptions)(nil).MemSegmentOptions)) } -// Namespace mocks base method -func (m *MockAggregateResults) Namespace() ident.ID { +// SetFSTSegmentOptions mocks base method +func (m *MockOptions) SetFSTSegmentOptions(value fst.Options) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Namespace") - ret0, _ := ret[0].(ident.ID) + ret := m.ctrl.Call(m, "SetFSTSegmentOptions", value) + ret0, _ := ret[0].(Options) return ret0 } -// Namespace indicates an expected call of Namespace -func (mr *MockAggregateResultsMockRecorder) Namespace() *gomock.Call { +// SetFSTSegmentOptions indicates an expected call of SetFSTSegmentOptions +func (mr *MockOptionsMockRecorder) SetFSTSegmentOptions(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Namespace", reflect.TypeOf((*MockAggregateResults)(nil).Namespace)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFSTSegmentOptions", reflect.TypeOf((*MockOptions)(nil).SetFSTSegmentOptions), value) } -// Reset mocks base method -func (m *MockAggregateResults) Reset(arg0 ident.ID, arg1 AggregateResultsOptions) { +// FSTSegmentOptions mocks base method +func (m *MockOptions) FSTSegmentOptions() fst.Options { m.ctrl.T.Helper() - m.ctrl.Call(m, "Reset", arg0, arg1) + ret := m.ctrl.Call(m, "FSTSegmentOptions") + ret0, _ := ret[0].(fst.Options) + return ret0 } -// Reset indicates an expected call of Reset -func (mr *MockAggregateResultsMockRecorder) Reset(arg0, arg1 interface{}) *gomock.Call { +// FSTSegmentOptions indicates an expected call of FSTSegmentOptions +func (mr *MockOptionsMockRecorder) FSTSegmentOptions() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockAggregateResults)(nil).Reset), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FSTSegmentOptions", reflect.TypeOf((*MockOptions)(nil).FSTSegmentOptions)) } -// Size mocks base method -func (m *MockAggregateResults) Size() int { +// SetIdentifierPool mocks base method +func (m *MockOptions) SetIdentifierPool(value ident.Pool) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Size") - ret0, _ := ret[0].(int) + ret := m.ctrl.Call(m, "SetIdentifierPool", value) + ret0, _ := ret[0].(Options) return ret0 } -// Size indicates an expected call of Size -func (mr *MockAggregateResultsMockRecorder) Size() *gomock.Call { +// SetIdentifierPool indicates an expected call of SetIdentifierPool +func (mr *MockOptionsMockRecorder) SetIdentifierPool(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockAggregateResults)(nil).Size)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetIdentifierPool", reflect.TypeOf((*MockOptions)(nil).SetIdentifierPool), value) } -// MockBlock is a mock of Block interface -type MockBlock struct { - ctrl *gomock.Controller - recorder *MockBlockMockRecorder +// IdentifierPool mocks base method +func (m *MockOptions) IdentifierPool() ident.Pool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IdentifierPool") + ret0, _ := ret[0].(ident.Pool) + return ret0 } -// MockBlockMockRecorder is the mock recorder for MockBlock -type MockBlockMockRecorder struct { - mock *MockBlock +// IdentifierPool indicates an expected call of IdentifierPool +func (mr *MockOptionsMockRecorder) IdentifierPool() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IdentifierPool", reflect.TypeOf((*MockOptions)(nil).IdentifierPool)) } -// NewMockBlock creates a new mock instance -func NewMockBlock(ctrl *gomock.Controller) *MockBlock { - mock := &MockBlock{ctrl: ctrl} - mock.recorder = &MockBlockMockRecorder{mock} - return mock +// SetCheckedBytesPool mocks base method +func (m *MockOptions) SetCheckedBytesPool(value pool.CheckedBytesPool) Options { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetCheckedBytesPool", value) + ret0, _ := ret[0].(Options) + return ret0 } -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockBlock) EXPECT() *MockBlockMockRecorder { - return m.recorder +// SetCheckedBytesPool indicates an expected call of SetCheckedBytesPool +func (mr *MockOptionsMockRecorder) SetCheckedBytesPool(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCheckedBytesPool", reflect.TypeOf((*MockOptions)(nil).SetCheckedBytesPool), value) } -// AddResults mocks base method -func (m *MockBlock) AddResults(arg0 result.IndexBlock) error { +// CheckedBytesPool mocks base method +func (m *MockOptions) CheckedBytesPool() pool.CheckedBytesPool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddResults", arg0) - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "CheckedBytesPool") + ret0, _ := ret[0].(pool.CheckedBytesPool) return ret0 } -// AddResults indicates an expected call of AddResults -func (mr *MockBlockMockRecorder) AddResults(arg0 interface{}) *gomock.Call { +// CheckedBytesPool indicates an expected call of CheckedBytesPool +func (mr *MockOptionsMockRecorder) CheckedBytesPool() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddResults", reflect.TypeOf((*MockBlock)(nil).AddResults), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckedBytesPool", reflect.TypeOf((*MockOptions)(nil).CheckedBytesPool)) } -// Close mocks base method -func (m *MockBlock) Close() error { +// SetQueryResultsPool mocks base method +func (m *MockOptions) SetQueryResultsPool(values QueryResultsPool) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close") - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "SetQueryResultsPool", values) + ret0, _ := ret[0].(Options) return ret0 } -// Close indicates an expected call of Close -func (mr *MockBlockMockRecorder) Close() *gomock.Call { +// SetQueryResultsPool indicates an expected call of SetQueryResultsPool +func (mr *MockOptionsMockRecorder) SetQueryResultsPool(values interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockBlock)(nil).Close)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetQueryResultsPool", reflect.TypeOf((*MockOptions)(nil).SetQueryResultsPool), values) } -// EndTime mocks base method -func (m *MockBlock) EndTime() time.Time { +// QueryResultsPool mocks base method +func (m *MockOptions) QueryResultsPool() QueryResultsPool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EndTime") - ret0, _ := ret[0].(time.Time) + ret := m.ctrl.Call(m, "QueryResultsPool") + ret0, _ := ret[0].(QueryResultsPool) return ret0 } -// EndTime indicates an expected call of EndTime -func (mr *MockBlockMockRecorder) EndTime() *gomock.Call { +// QueryResultsPool indicates an expected call of QueryResultsPool +func (mr *MockOptionsMockRecorder) QueryResultsPool() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndTime", reflect.TypeOf((*MockBlock)(nil).EndTime)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryResultsPool", reflect.TypeOf((*MockOptions)(nil).QueryResultsPool)) } -// EvictMutableSegments mocks base method -func (m *MockBlock) EvictMutableSegments() error { +// SetAggregateResultsPool mocks base method +func (m *MockOptions) SetAggregateResultsPool(values AggregateResultsPool) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EvictMutableSegments") - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "SetAggregateResultsPool", values) + ret0, _ := ret[0].(Options) return ret0 } -// EvictMutableSegments indicates an expected call of EvictMutableSegments -func (mr *MockBlockMockRecorder) EvictMutableSegments() *gomock.Call { +// SetAggregateResultsPool indicates an expected call of SetAggregateResultsPool +func (mr *MockOptionsMockRecorder) SetAggregateResultsPool(values interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EvictMutableSegments", reflect.TypeOf((*MockBlock)(nil).EvictMutableSegments)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAggregateResultsPool", reflect.TypeOf((*MockOptions)(nil).SetAggregateResultsPool), values) } -// IsSealed mocks base method -func (m *MockBlock) IsSealed() bool { +// AggregateResultsPool mocks base method +func (m *MockOptions) AggregateResultsPool() AggregateResultsPool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsSealed") - ret0, _ := ret[0].(bool) + ret := m.ctrl.Call(m, "AggregateResultsPool") + ret0, _ := ret[0].(AggregateResultsPool) return ret0 } -// IsSealed indicates an expected call of IsSealed -func (mr *MockBlockMockRecorder) IsSealed() *gomock.Call { +// AggregateResultsPool indicates an expected call of AggregateResultsPool +func (mr *MockOptionsMockRecorder) AggregateResultsPool() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSealed", reflect.TypeOf((*MockBlock)(nil).IsSealed)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AggregateResultsPool", reflect.TypeOf((*MockOptions)(nil).AggregateResultsPool)) } -// NeedsMutableSegmentsEvicted mocks base method -func (m *MockBlock) NeedsMutableSegmentsEvicted() bool { +// SetAggregateValuesPool mocks base method +func (m *MockOptions) SetAggregateValuesPool(values AggregateValuesPool) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NeedsMutableSegmentsEvicted") - ret0, _ := ret[0].(bool) + ret := m.ctrl.Call(m, "SetAggregateValuesPool", values) + ret0, _ := ret[0].(Options) return ret0 } -// NeedsMutableSegmentsEvicted indicates an expected call of NeedsMutableSegmentsEvicted -func (mr *MockBlockMockRecorder) NeedsMutableSegmentsEvicted() *gomock.Call { +// SetAggregateValuesPool indicates an expected call of SetAggregateValuesPool +func (mr *MockOptionsMockRecorder) SetAggregateValuesPool(values interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NeedsMutableSegmentsEvicted", reflect.TypeOf((*MockBlock)(nil).NeedsMutableSegmentsEvicted)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAggregateValuesPool", reflect.TypeOf((*MockOptions)(nil).SetAggregateValuesPool), values) } -// Query mocks base method -func (m *MockBlock) Query(arg0 *resource.CancellableLifetime, arg1 Query, arg2 QueryOptions, arg3 BaseResults) (bool, error) { +// AggregateValuesPool mocks base method +func (m *MockOptions) AggregateValuesPool() AggregateValuesPool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Query", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "AggregateValuesPool") + ret0, _ := ret[0].(AggregateValuesPool) + return ret0 } -// Query indicates an expected call of Query -func (mr *MockBlockMockRecorder) Query(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +// AggregateValuesPool indicates an expected call of AggregateValuesPool +func (mr *MockOptionsMockRecorder) AggregateValuesPool() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Query", reflect.TypeOf((*MockBlock)(nil).Query), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AggregateValuesPool", reflect.TypeOf((*MockOptions)(nil).AggregateValuesPool)) } -// Seal mocks base method -func (m *MockBlock) Seal() error { +// SetDocumentArrayPool mocks base method +func (m *MockOptions) SetDocumentArrayPool(value doc.DocumentArrayPool) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Seal") - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "SetDocumentArrayPool", value) + ret0, _ := ret[0].(Options) return ret0 } -// Seal indicates an expected call of Seal -func (mr *MockBlockMockRecorder) Seal() *gomock.Call { +// SetDocumentArrayPool indicates an expected call of SetDocumentArrayPool +func (mr *MockOptionsMockRecorder) SetDocumentArrayPool(value interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Seal", reflect.TypeOf((*MockBlock)(nil).Seal)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDocumentArrayPool", reflect.TypeOf((*MockOptions)(nil).SetDocumentArrayPool), value) } -// StartTime mocks base method -func (m *MockBlock) StartTime() time.Time { +// DocumentArrayPool mocks base method +func (m *MockOptions) DocumentArrayPool() doc.DocumentArrayPool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StartTime") - ret0, _ := ret[0].(time.Time) + ret := m.ctrl.Call(m, "DocumentArrayPool") + ret0, _ := ret[0].(doc.DocumentArrayPool) return ret0 } -// StartTime indicates an expected call of StartTime -func (mr *MockBlockMockRecorder) StartTime() *gomock.Call { +// DocumentArrayPool indicates an expected call of DocumentArrayPool +func (mr *MockOptionsMockRecorder) DocumentArrayPool() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartTime", reflect.TypeOf((*MockBlock)(nil).StartTime)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DocumentArrayPool", reflect.TypeOf((*MockOptions)(nil).DocumentArrayPool)) } -// Stats mocks base method -func (m *MockBlock) Stats(arg0 BlockStatsReporter) error { +// SetForegroundCompactionPlannerOptions mocks base method +func (m *MockOptions) SetForegroundCompactionPlannerOptions(v compaction.PlannerOptions) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Stats", arg0) - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "SetForegroundCompactionPlannerOptions", v) + ret0, _ := ret[0].(Options) return ret0 } -// Stats indicates an expected call of Stats -func (mr *MockBlockMockRecorder) Stats(arg0 interface{}) *gomock.Call { +// SetForegroundCompactionPlannerOptions indicates an expected call of SetForegroundCompactionPlannerOptions +func (mr *MockOptionsMockRecorder) SetForegroundCompactionPlannerOptions(v interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stats", reflect.TypeOf((*MockBlock)(nil).Stats), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetForegroundCompactionPlannerOptions", reflect.TypeOf((*MockOptions)(nil).SetForegroundCompactionPlannerOptions), v) } -// Tick mocks base method -func (m *MockBlock) Tick(arg0 context.Cancellable, arg1 time.Time) (BlockTickResult, error) { +// ForegroundCompactionPlannerOptions mocks base method +func (m *MockOptions) ForegroundCompactionPlannerOptions() compaction.PlannerOptions { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Tick", arg0, arg1) - ret0, _ := ret[0].(BlockTickResult) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "ForegroundCompactionPlannerOptions") + ret0, _ := ret[0].(compaction.PlannerOptions) + return ret0 } -// Tick indicates an expected call of Tick -func (mr *MockBlockMockRecorder) Tick(arg0, arg1 interface{}) *gomock.Call { +// ForegroundCompactionPlannerOptions indicates an expected call of ForegroundCompactionPlannerOptions +func (mr *MockOptionsMockRecorder) ForegroundCompactionPlannerOptions() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tick", reflect.TypeOf((*MockBlock)(nil).Tick), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForegroundCompactionPlannerOptions", reflect.TypeOf((*MockOptions)(nil).ForegroundCompactionPlannerOptions)) } -// WriteBatch mocks base method -func (m *MockBlock) WriteBatch(arg0 *WriteBatch) (WriteBatchResult, error) { +// SetBackgroundCompactionPlannerOptions mocks base method +func (m *MockOptions) SetBackgroundCompactionPlannerOptions(v compaction.PlannerOptions) Options { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WriteBatch", arg0) - ret0, _ := ret[0].(WriteBatchResult) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "SetBackgroundCompactionPlannerOptions", v) + ret0, _ := ret[0].(Options) + return ret0 } -// WriteBatch indicates an expected call of WriteBatch -func (mr *MockBlockMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call { +// SetBackgroundCompactionPlannerOptions indicates an expected call of SetBackgroundCompactionPlannerOptions +func (mr *MockOptionsMockRecorder) SetBackgroundCompactionPlannerOptions(v interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteBatch", reflect.TypeOf((*MockBlock)(nil).WriteBatch), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBackgroundCompactionPlannerOptions", reflect.TypeOf((*MockOptions)(nil).SetBackgroundCompactionPlannerOptions), v) } -// MockOnIndexSeries is a mock of OnIndexSeries interface -type MockOnIndexSeries struct { - ctrl *gomock.Controller - recorder *MockOnIndexSeriesMockRecorder +// BackgroundCompactionPlannerOptions mocks base method +func (m *MockOptions) BackgroundCompactionPlannerOptions() compaction.PlannerOptions { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BackgroundCompactionPlannerOptions") + ret0, _ := ret[0].(compaction.PlannerOptions) + return ret0 } -// MockOnIndexSeriesMockRecorder is the mock recorder for MockOnIndexSeries -type MockOnIndexSeriesMockRecorder struct { - mock *MockOnIndexSeries +// BackgroundCompactionPlannerOptions indicates an expected call of BackgroundCompactionPlannerOptions +func (mr *MockOptionsMockRecorder) BackgroundCompactionPlannerOptions() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackgroundCompactionPlannerOptions", reflect.TypeOf((*MockOptions)(nil).BackgroundCompactionPlannerOptions)) } -// NewMockOnIndexSeries creates a new mock instance -func NewMockOnIndexSeries(ctrl *gomock.Controller) *MockOnIndexSeries { - mock := &MockOnIndexSeries{ctrl: ctrl} - mock.recorder = &MockOnIndexSeriesMockRecorder{mock} - return mock +// SetPostingsListCache mocks base method +func (m *MockOptions) SetPostingsListCache(value *PostingsListCache) Options { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetPostingsListCache", value) + ret0, _ := ret[0].(Options) + return ret0 } -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockOnIndexSeries) EXPECT() *MockOnIndexSeriesMockRecorder { - return m.recorder +// SetPostingsListCache indicates an expected call of SetPostingsListCache +func (mr *MockOptionsMockRecorder) SetPostingsListCache(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPostingsListCache", reflect.TypeOf((*MockOptions)(nil).SetPostingsListCache), value) } -// OnIndexFinalize mocks base method -func (m *MockOnIndexSeries) OnIndexFinalize(arg0 time0.UnixNano) { +// PostingsListCache mocks base method +func (m *MockOptions) PostingsListCache() *PostingsListCache { m.ctrl.T.Helper() - m.ctrl.Call(m, "OnIndexFinalize", arg0) + ret := m.ctrl.Call(m, "PostingsListCache") + ret0, _ := ret[0].(*PostingsListCache) + return ret0 } -// OnIndexFinalize indicates an expected call of OnIndexFinalize -func (mr *MockOnIndexSeriesMockRecorder) OnIndexFinalize(arg0 interface{}) *gomock.Call { +// PostingsListCache indicates an expected call of PostingsListCache +func (mr *MockOptionsMockRecorder) PostingsListCache() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnIndexFinalize", reflect.TypeOf((*MockOnIndexSeries)(nil).OnIndexFinalize), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PostingsListCache", reflect.TypeOf((*MockOptions)(nil).PostingsListCache)) } -// OnIndexSuccess mocks base method -func (m *MockOnIndexSeries) OnIndexSuccess(arg0 time0.UnixNano) { +// SetReadThroughSegmentOptions mocks base method +func (m *MockOptions) SetReadThroughSegmentOptions(value ReadThroughSegmentOptions) Options { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetReadThroughSegmentOptions", value) + ret0, _ := ret[0].(Options) + return ret0 +} + +// SetReadThroughSegmentOptions indicates an expected call of SetReadThroughSegmentOptions +func (mr *MockOptionsMockRecorder) SetReadThroughSegmentOptions(value interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadThroughSegmentOptions", reflect.TypeOf((*MockOptions)(nil).SetReadThroughSegmentOptions), value) +} + +// ReadThroughSegmentOptions mocks base method +func (m *MockOptions) ReadThroughSegmentOptions() ReadThroughSegmentOptions { m.ctrl.T.Helper() - m.ctrl.Call(m, "OnIndexSuccess", arg0) + ret := m.ctrl.Call(m, "ReadThroughSegmentOptions") + ret0, _ := ret[0].(ReadThroughSegmentOptions) + return ret0 } -// OnIndexSuccess indicates an expected call of OnIndexSuccess -func (mr *MockOnIndexSeriesMockRecorder) OnIndexSuccess(arg0 interface{}) *gomock.Call { +// ReadThroughSegmentOptions indicates an expected call of ReadThroughSegmentOptions +func (mr *MockOptionsMockRecorder) ReadThroughSegmentOptions() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnIndexSuccess", reflect.TypeOf((*MockOnIndexSeries)(nil).OnIndexSuccess), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadThroughSegmentOptions", reflect.TypeOf((*MockOptions)(nil).ReadThroughSegmentOptions)) } diff --git a/src/dbnode/storage/index_block_test.go b/src/dbnode/storage/index_block_test.go index 3c1346751b..946366c1b6 100644 --- a/src/dbnode/storage/index_block_test.go +++ b/src/dbnode/storage/index_block_test.go @@ -590,6 +590,97 @@ func TestNamespaceIndexBlockQuery(t *testing.T) { require.NoError(t, err) } +func TestNamespaceIndexBlockQueryReleasingContext(t *testing.T) { + ctrl := gomock.NewController(xtest.Reporter{T: t}) + defer ctrl.Finish() + + retention := 2 * time.Hour + blockSize := time.Hour + now := time.Now().Truncate(blockSize).Add(10 * time.Minute) + t0 := now.Truncate(blockSize) + t0Nanos := xtime.ToUnixNano(t0) + t1 := t0.Add(1 * blockSize) + t1Nanos := xtime.ToUnixNano(t1) + t2 := t1.Add(1 * blockSize) + var nowLock sync.Mutex + nowFn := func() time.Time { + nowLock.Lock() + defer nowLock.Unlock() + return now + } + opts := testDatabaseOptions() + opts = opts.SetClockOptions(opts.ClockOptions().SetNowFn(nowFn)) + + b0 := index.NewMockBlock(ctrl) + b0.EXPECT().Stats(gomock.Any()).Return(nil).AnyTimes() + b0.EXPECT().Close().Return(nil) + b0.EXPECT().StartTime().Return(t0).AnyTimes() + b0.EXPECT().EndTime().Return(t0.Add(blockSize)).AnyTimes() + b1 := index.NewMockBlock(ctrl) + b1.EXPECT().Stats(gomock.Any()).Return(nil).AnyTimes() + b1.EXPECT().Close().Return(nil) + b1.EXPECT().StartTime().Return(t1).AnyTimes() + b1.EXPECT().EndTime().Return(t1.Add(blockSize)).AnyTimes() + newBlockFn := func( + ts time.Time, + md namespace.Metadata, + _ index.BlockOptions, + io index.Options, + ) (index.Block, error) { + if ts.Equal(t0) { + return b0, nil + } + if ts.Equal(t1) { + return b1, nil + } + panic("should never get here") + } + + iopts := opts.IndexOptions() + mockPool := index.NewMockQueryResultsPool(ctrl) + iopts = iopts.SetQueryResultsPool(mockPool) + stubResult := index.NewQueryResults(ident.StringID("ns"), index.QueryResultsOptions{}, iopts) + + md := testNamespaceMetadata(blockSize, retention) + idxIface, err := newNamespaceIndexWithNewBlockFn(md, newBlockFn, opts) + require.NoError(t, err) + + idx, ok := idxIface.(*nsIndex) + require.True(t, ok) + idx.resultsPool = mockPool + + defer func() { + require.NoError(t, idx.Close()) + }() + + seg1 := segment.NewMockSegment(ctrl) + seg2 := segment.NewMockSegment(ctrl) + seg3 := segment.NewMockSegment(ctrl) + bootstrapResults := result.IndexResults{ + t0Nanos: result.NewIndexBlock(t0, []segment.Segment{seg1}, result.NewShardTimeRanges(t0, t1, 1, 2, 3)), + t1Nanos: result.NewIndexBlock(t1, []segment.Segment{seg2, seg3}, result.NewShardTimeRanges(t1, t2, 1, 2, 3)), + } + + b0.EXPECT().AddResults(bootstrapResults[t0Nanos]).Return(nil) + b1.EXPECT().AddResults(bootstrapResults[t1Nanos]).Return(nil) + require.NoError(t, idx.Bootstrap(bootstrapResults)) + + ctx := context.NewContext() + q := index.Query{} + qOpts := index.QueryOptions{ + StartInclusive: t0, + EndExclusive: now.Add(time.Minute), + } + gomock.InOrder( + mockPool.EXPECT().Get().Return(stubResult), + b0.EXPECT().Query(gomock.Any(), q, qOpts, gomock.Any()).Return(true, nil), + mockPool.EXPECT().Put(stubResult), + ) + _, err = idx.Query(ctx, q, qOpts) + require.NoError(t, err) + ctx.BlockingClose() +} + func TestNamespaceIndexBlockAggregateQuery(t *testing.T) { ctrl := gomock.NewController(xtest.Reporter{T: t}) defer ctrl.Finish() @@ -689,3 +780,97 @@ func TestNamespaceIndexBlockAggregateQuery(t *testing.T) { _, err = idx.AggregateQuery(ctx, q, aggOpts) require.NoError(t, err) } + +func TestNamespaceIndexBlockAggregateQueryReleasingContext(t *testing.T) { + ctrl := gomock.NewController(xtest.Reporter{T: t}) + defer ctrl.Finish() + + retention := 2 * time.Hour + blockSize := time.Hour + now := time.Now().Truncate(blockSize).Add(10 * time.Minute) + t0 := now.Truncate(blockSize) + t0Nanos := xtime.ToUnixNano(t0) + t1 := t0.Add(1 * blockSize) + t1Nanos := xtime.ToUnixNano(t1) + t2 := t1.Add(1 * blockSize) + var nowLock sync.Mutex + nowFn := func() time.Time { + nowLock.Lock() + defer nowLock.Unlock() + return now + } + opts := testDatabaseOptions() + opts = opts.SetClockOptions(opts.ClockOptions().SetNowFn(nowFn)) + + b0 := index.NewMockBlock(ctrl) + b0.EXPECT().Stats(gomock.Any()).Return(nil).AnyTimes() + b0.EXPECT().Close().Return(nil) + b0.EXPECT().StartTime().Return(t0).AnyTimes() + b0.EXPECT().EndTime().Return(t0.Add(blockSize)).AnyTimes() + b1 := index.NewMockBlock(ctrl) + b1.EXPECT().Stats(gomock.Any()).Return(nil).AnyTimes() + b1.EXPECT().Close().Return(nil) + b1.EXPECT().StartTime().Return(t1).AnyTimes() + b1.EXPECT().EndTime().Return(t1.Add(blockSize)).AnyTimes() + newBlockFn := func( + ts time.Time, + md namespace.Metadata, + _ index.BlockOptions, + io index.Options, + ) (index.Block, error) { + if ts.Equal(t0) { + return b0, nil + } + if ts.Equal(t1) { + return b1, nil + } + panic("should never get here") + } + + iopts := opts.IndexOptions() + mockPool := index.NewMockAggregateResultsPool(ctrl) + iopts = iopts.SetAggregateResultsPool(mockPool) + stubResult := index.NewAggregateResults(ident.StringID("ns"), index.AggregateResultsOptions{}, iopts) + + md := testNamespaceMetadata(blockSize, retention) + idxIface, err := newNamespaceIndexWithNewBlockFn(md, newBlockFn, opts) + require.NoError(t, err) + + idx, ok := idxIface.(*nsIndex) + require.True(t, ok) + idx.aggregateResultsPool = mockPool + + defer func() { + require.NoError(t, idx.Close()) + }() + + seg1 := segment.NewMockSegment(ctrl) + seg2 := segment.NewMockSegment(ctrl) + seg3 := segment.NewMockSegment(ctrl) + bootstrapResults := result.IndexResults{ + t0Nanos: result.NewIndexBlock(t0, []segment.Segment{seg1}, result.NewShardTimeRanges(t0, t1, 1, 2, 3)), + t1Nanos: result.NewIndexBlock(t1, []segment.Segment{seg2, seg3}, result.NewShardTimeRanges(t1, t2, 1, 2, 3)), + } + + b0.EXPECT().AddResults(bootstrapResults[t0Nanos]).Return(nil) + b1.EXPECT().AddResults(bootstrapResults[t1Nanos]).Return(nil) + require.NoError(t, idx.Bootstrap(bootstrapResults)) + + // only queries as much as is needed (wrt to time) + ctx := context.NewContext() + q := index.Query{} + qOpts := index.QueryOptions{ + StartInclusive: t0, + EndExclusive: now.Add(time.Minute), + } + aggOpts := index.AggregationOptions{QueryOptions: qOpts} + + gomock.InOrder( + mockPool.EXPECT().Get().Return(stubResult), + b0.EXPECT().Query(gomock.Any(), q, qOpts, gomock.Any()).Return(true, nil), + mockPool.EXPECT().Put(stubResult), + ) + _, err = idx.AggregateQuery(ctx, q, aggOpts) + require.NoError(t, err) + ctx.BlockingClose() +}