Skip to content

Commit b5c6094

Browse files
committed
differentiated in storage.blocks between IndexBlockContainingCollectionGuarantees vs operation.IndexBlockContainingCollectionGuarantee for clarity
1 parent b8f8d64 commit b5c6094

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

engine/access/ingestion/engine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ func (e *Engine) processFinalizedBlock(block *flow.Block) error {
372372
// TODO: substitute an indexer module as layer between engine and storage
373373

374374
// index the block storage with each of the collection guarantee
375-
err := e.blocks.IndexBlockContainingCollectionGuarantee(block.ID(), flow.GetIDs(block.Payload.Guarantees))
375+
err := e.blocks.IndexBlockContainingCollectionGuarantees(block.ID(), flow.GetIDs(block.Payload.Guarantees))
376376
if err != nil {
377377
return fmt.Errorf("could not index block for collections: %w", err)
378378
}

engine/access/ingestion/engine_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func (s *Suite) TestOnFinalizedBlockSingle() {
293293
}
294294

295295
// expect that the block storage is indexed with each of the collection guarantee
296-
s.blocks.On("IndexBlockForCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
296+
s.blocks.On("IndexBlockContainingCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
297297
for _, seal := range block.Payload.Seals {
298298
s.results.On("Index", seal.BlockID, seal.ResultID).Return(nil).Once()
299299
}
@@ -366,7 +366,7 @@ func (s *Suite) TestOnFinalizedBlockSeveralBlocksAhead() {
366366

367367
// expected all new blocks after last block processed
368368
for _, block := range blocks {
369-
s.blocks.On("IndexBlockForCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
369+
s.blocks.On("IndexBlockContainingCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
370370

371371
for _, cg := range block.Payload.Guarantees {
372372
s.request.On("EntityByID", cg.CollectionID, mock.Anything).Return().Run(func(args mock.Arguments) {
@@ -391,7 +391,7 @@ func (s *Suite) TestOnFinalizedBlockSeveralBlocksAhead() {
391391
}
392392

393393
s.headers.AssertExpectations(s.T())
394-
s.blocks.AssertNumberOfCalls(s.T(), "IndexBlockForCollectionGuarantees", newBlocksCount)
394+
s.blocks.AssertNumberOfCalls(s.T(), "IndexBlockContainingCollectionGuarantees", newBlocksCount)
395395
s.request.AssertNumberOfCalls(s.T(), "EntityByID", expectedEntityByIDCalls)
396396
s.results.AssertNumberOfCalls(s.T(), "Index", expectedIndexCalls)
397397
}

engine/access/ingestion2/engine_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ func (s *Suite) TestOnFinalizedBlockSingle() {
313313
}
314314

315315
// expect that the block storage is indexed with each of the collection guarantee
316-
s.blocks.On("IndexBlockForCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
316+
s.blocks.On("IndexBlockContainingCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
317317
for _, seal := range block.Payload.Seals {
318318
s.results.On("Index", seal.BlockID, seal.ResultID).Return(nil).Once()
319319
}
@@ -386,7 +386,7 @@ func (s *Suite) TestOnFinalizedBlockSeveralBlocksAhead() {
386386

387387
// expected all new blocks after last block processed
388388
for _, block := range blocks {
389-
s.blocks.On("IndexBlockForCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
389+
s.blocks.On("IndexBlockContainingCollectionGuarantees", block.ID(), []flow.Identifier(flow.GetIDs(block.Payload.Guarantees))).Return(nil).Once()
390390

391391
for _, cg := range block.Payload.Guarantees {
392392
s.request.On("EntityByID", cg.CollectionID, mock.Anything).Return().Run(func(args mock.Arguments) {
@@ -411,7 +411,7 @@ func (s *Suite) TestOnFinalizedBlockSeveralBlocksAhead() {
411411
}
412412

413413
s.headers.AssertExpectations(s.T())
414-
s.blocks.AssertNumberOfCalls(s.T(), "IndexBlockForCollectionGuarantees", newBlocksCount)
414+
s.blocks.AssertNumberOfCalls(s.T(), "IndexBlockContainingCollectionGuarantees", newBlocksCount)
415415
s.request.AssertNumberOfCalls(s.T(), "EntityByID", expectedEntityByIDCalls)
416416
s.results.AssertNumberOfCalls(s.T(), "Index", expectedIndexCalls)
417417
}

engine/access/ingestion2/finalized_block_processor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (p *FinalizedBlockProcessor) processFinalizedBlockJobCallback(
145145
//
146146
// No errors are expected during normal operations.
147147
func (p *FinalizedBlockProcessor) indexFinalizedBlock(block *flow.Block) error {
148-
err := p.blocks.IndexBlockContainingCollectionGuarantee(block.ID(), flow.GetIDs(block.Payload.Guarantees))
148+
err := p.blocks.IndexBlockContainingCollectionGuarantees(block.ID(), flow.GetIDs(block.Payload.Guarantees))
149149
if err != nil {
150150
return fmt.Errorf("could not index block for collections: %w", err)
151151
}

storage/blocks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type Blocks interface {
8282
// to decode an existing database value
8383
ByCollectionID(collID flow.Identifier) (*flow.Block, error)
8484

85-
// IndexBlockContainingCollectionGuarantee populates an index `guaranteeID->blockID` for each guarantee
85+
// IndexBlockContainingCollectionGuarantees populates an index `guaranteeID->blockID` for each guarantee
8686
// which appears in the block.
8787
// CAUTION: a collection can be included in multiple *unfinalized* blocks. However, the implementation
8888
// assumes a one-to-one map from collection ID to a *single* block ID. This holds for FINALIZED BLOCKS ONLY
@@ -92,5 +92,5 @@ type Blocks interface {
9292
//
9393
// Error returns:
9494
// - generic error in case of unexpected failure from the database layer or encoding failure.
95-
IndexBlockContainingCollectionGuarantee(blockID flow.Identifier, collIDs []flow.Identifier) error
95+
IndexBlockContainingCollectionGuarantees(blockID flow.Identifier, collIDs []flow.Identifier) error
9696
}

storage/mock/blocks.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storage/store/blocks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (b *Blocks) ByCollectionID(collID flow.Identifier) (*flow.Block, error) {
203203
return b.ByID(blockID)
204204
}
205205

206-
// IndexBlockContainingCollectionGuarantee populates an index `guaranteeID->blockID` for each guarantee
206+
// IndexBlockContainingCollectionGuarantees populates an index `guaranteeID->blockID` for each guarantee
207207
// which appears in the block.
208208
// CAUTION: a collection can be included in multiple *unfinalized* blocks. However, the implementation
209209
// assumes a one-to-one map from collection ID to a *single* block ID. This holds for FINALIZED BLOCKS ONLY
@@ -213,7 +213,7 @@ func (b *Blocks) ByCollectionID(collID flow.Identifier) (*flow.Block, error) {
213213
//
214214
// Error returns:
215215
// - generic error in case of unexpected failure from the database layer or encoding failure.
216-
func (b *Blocks) IndexBlockContainingCollectionGuarantee(blockID flow.Identifier, guaranteeIDs []flow.Identifier) error {
216+
func (b *Blocks) IndexBlockContainingCollectionGuarantees(blockID flow.Identifier, guaranteeIDs []flow.Identifier) error {
217217
return b.db.WithReaderBatchWriter(func(rw storage.ReaderBatchWriter) error {
218218
for _, guaranteeID := range guaranteeIDs {
219219
err := operation.IndexBlockContainingCollectionGuarantee(rw.Writer(), guaranteeID, blockID)

0 commit comments

Comments
 (0)