github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/badger/all.go (about)

     1  package badger
     2  
     3  import (
     4  	"github.com/dgraph-io/badger/v2"
     5  
     6  	"github.com/onflow/flow-go/module"
     7  	"github.com/onflow/flow-go/storage"
     8  )
     9  
    10  func InitAll(metrics module.CacheMetrics, db *badger.DB) *storage.All {
    11  	headers := NewHeaders(metrics, db)
    12  	guarantees := NewGuarantees(metrics, db, DefaultCacheSize)
    13  	seals := NewSeals(metrics, db)
    14  	index := NewIndex(metrics, db)
    15  	results := NewExecutionResults(metrics, db)
    16  	receipts := NewExecutionReceipts(metrics, db, results, DefaultCacheSize)
    17  	payloads := NewPayloads(db, index, guarantees, seals, receipts, results)
    18  	blocks := NewBlocks(db, headers, payloads)
    19  	qcs := NewQuorumCertificates(metrics, db, DefaultCacheSize)
    20  	setups := NewEpochSetups(metrics, db)
    21  	epochCommits := NewEpochCommits(metrics, db)
    22  	protocolState := NewProtocolState(metrics, setups, epochCommits, db,
    23  		DefaultProtocolStateCacheSize, DefaultProtocolStateByBlockIDCacheSize)
    24  	protocolKVStore := NewProtocolKVStore(metrics, db, DefaultProtocolKVStoreCacheSize, DefaultProtocolKVStoreByBlockIDCacheSize)
    25  	versionBeacons := NewVersionBeacons(db)
    26  
    27  	commits := NewCommits(metrics, db)
    28  	transactions := NewTransactions(metrics, db)
    29  	transactionResults := NewTransactionResults(metrics, db, 10000)
    30  	collections := NewCollections(db, transactions)
    31  	events := NewEvents(metrics, db)
    32  	chunkDataPacks := NewChunkDataPacks(metrics, db, collections, 1000)
    33  
    34  	return &storage.All{
    35  		Headers:            headers,
    36  		Guarantees:         guarantees,
    37  		Seals:              seals,
    38  		Index:              index,
    39  		Payloads:           payloads,
    40  		Blocks:             blocks,
    41  		QuorumCertificates: qcs,
    42  		Setups:             setups,
    43  		EpochCommits:       epochCommits,
    44  		EpochProtocolState: protocolState,
    45  		ProtocolKVStore:    protocolKVStore,
    46  		VersionBeacons:     versionBeacons,
    47  		Results:            results,
    48  		Receipts:           receipts,
    49  		ChunkDataPacks:     chunkDataPacks,
    50  		Commits:            commits,
    51  		Transactions:       transactions,
    52  		TransactionResults: transactionResults,
    53  		Collections:        collections,
    54  		Events:             events,
    55  	}
    56  }