From 2a8f2c148636c401362af9b9f0755eb822e8f698 Mon Sep 17 00:00:00 2001 From: Linas Medziunas Date: Fri, 27 Nov 2020 12:08:12 +0200 Subject: [PATCH] [dbnode] Widen exposure of namespace method --- src/dbnode/storage/storage_mock.go | 45 ++++++++++++++++++++---------- src/dbnode/storage/types.go | 16 +++++------ 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/src/dbnode/storage/storage_mock.go b/src/dbnode/storage/storage_mock.go index 3cfd8cf50d..8871f8c249 100644 --- a/src/dbnode/storage/storage_mock.go +++ b/src/dbnode/storage/storage_mock.go @@ -1166,6 +1166,21 @@ func (mr *MockNamespaceMockRecorder) DocRef(id interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DocRef", reflect.TypeOf((*MockNamespace)(nil).DocRef), id) } +// FetchWideEntry mocks base method +func (m *MockNamespace) FetchWideEntry(ctx context.Context, id ident.ID, blockStart time.Time) (block.StreamedWideEntry, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FetchWideEntry", ctx, id, blockStart) + ret0, _ := ret[0].(block.StreamedWideEntry) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FetchWideEntry indicates an expected call of FetchWideEntry +func (mr *MockNamespaceMockRecorder) FetchWideEntry(ctx, id, blockStart interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchWideEntry", reflect.TypeOf((*MockNamespace)(nil).FetchWideEntry), ctx, id, blockStart) +} + // MockdatabaseNamespace is a mock of databaseNamespace interface type MockdatabaseNamespace struct { ctrl *gomock.Controller @@ -1358,6 +1373,21 @@ func (mr *MockdatabaseNamespaceMockRecorder) DocRef(id interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DocRef", reflect.TypeOf((*MockdatabaseNamespace)(nil).DocRef), id) } +// FetchWideEntry mocks base method +func (m *MockdatabaseNamespace) FetchWideEntry(ctx context.Context, id ident.ID, blockStart time.Time) (block.StreamedWideEntry, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FetchWideEntry", ctx, id, blockStart) + ret0, _ := ret[0].(block.StreamedWideEntry) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FetchWideEntry indicates an expected call of FetchWideEntry +func (mr *MockdatabaseNamespaceMockRecorder) FetchWideEntry(ctx, id, blockStart interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchWideEntry", reflect.TypeOf((*MockdatabaseNamespace)(nil).FetchWideEntry), ctx, id, blockStart) +} + // Close mocks base method func (m *MockdatabaseNamespace) Close() error { m.ctrl.T.Helper() @@ -1501,21 +1531,6 @@ func (mr *MockdatabaseNamespaceMockRecorder) ReadEncoded(ctx, id, start, end int return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadEncoded", reflect.TypeOf((*MockdatabaseNamespace)(nil).ReadEncoded), ctx, id, start, end) } -// FetchWideEntry mocks base method -func (m *MockdatabaseNamespace) FetchWideEntry(ctx context.Context, id ident.ID, blockStart time.Time) (block.StreamedWideEntry, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchWideEntry", ctx, id, blockStart) - ret0, _ := ret[0].(block.StreamedWideEntry) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FetchWideEntry indicates an expected call of FetchWideEntry -func (mr *MockdatabaseNamespaceMockRecorder) FetchWideEntry(ctx, id, blockStart interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchWideEntry", reflect.TypeOf((*MockdatabaseNamespace)(nil).FetchWideEntry), ctx, id, blockStart) -} - // FetchBlocks mocks base method func (m *MockdatabaseNamespace) FetchBlocks(ctx context.Context, shardID uint32, id ident.ID, starts []time.Time) ([]block.FetchBlockResult, error) { m.ctrl.T.Helper() diff --git a/src/dbnode/storage/types.go b/src/dbnode/storage/types.go index 4ffca1c8e8..0ac72ebb6b 100644 --- a/src/dbnode/storage/types.go +++ b/src/dbnode/storage/types.go @@ -288,6 +288,14 @@ type Namespace interface { // DocRef returns the doc if already present in a namespace shard. DocRef(id ident.ID) (doc.Document, bool, error) + + // FetchWideEntry retrieves wide entry for an ID for the + // block at time start. + FetchWideEntry( + ctx context.Context, + id ident.ID, + blockStart time.Time, + ) (block.StreamedWideEntry, error) } // NamespacesByID is a sortable slice of namespaces by ID. @@ -372,14 +380,6 @@ type databaseNamespace interface { start, end time.Time, ) ([][]xio.BlockReader, error) - // FetchWideEntry retrieves the wide entry for an ID for the - // block at time start. - FetchWideEntry( - ctx context.Context, - id ident.ID, - blockStart time.Time, - ) (block.StreamedWideEntry, error) - // FetchBlocks retrieves data blocks for a given id and a list of block // start times. FetchBlocks(