github.com/koko1123/flow-go-1@v0.29.6/engine/execution/ingestion/mempool.go (about)

     1  package ingestion
     2  
     3  //revive:disable:unexported-return
     4  
     5  import (
     6  	"github.com/koko1123/flow-go-1/module/mempool/stdmap"
     7  )
     8  
     9  type Mempool struct {
    10  	ExecutionQueue    *stdmap.Queues
    11  	BlockByCollection *stdmap.BlockByCollections
    12  }
    13  
    14  func (m *Mempool) Run(f func(blockByCollection *stdmap.BlockByCollectionBackdata, executionQueue *stdmap.QueuesBackdata) error) error {
    15  	return m.ExecutionQueue.Run(func(queueBackdata *stdmap.QueuesBackdata) error {
    16  		return m.BlockByCollection.Run(func(blockByCollectionBackdata *stdmap.BlockByCollectionBackdata) error {
    17  			return f(blockByCollectionBackdata, queueBackdata)
    18  		})
    19  	})
    20  }
    21  
    22  func newMempool() *Mempool {
    23  	m := &Mempool{
    24  		BlockByCollection: stdmap.NewBlockByCollections(),
    25  		ExecutionQueue:    stdmap.NewQueues(),
    26  	}
    27  
    28  	return m
    29  }