@@ -43,11 +43,11 @@ type ChunkDataPacks struct {
4343 protocolDB storage.DB
4444
4545 // the actual chunk data pack is stored here, which is a separate storage from protocol DB
46- stored storage.StoredChunkDataPacks
46+ cdpStorage storage.StoredChunkDataPacks
4747
48- // We assume that for every chunk data pack not for a system chunk, the executed collection has
48+ // We assume that for every chunk data pack not for a system chunk, the executed collection has
4949 // previously been persisted in `storage.Collections`. We use this storage abstraction here only for
50- // retrieving collections. We assume that `storage.Collections` has its own caching already built in.
50+ // retrieving collections. We assume that `storage.Collections` has its own caching already built in.
5151 collections storage.Collections
5252
5353 // cache chunkID -> chunkDataPackID
@@ -56,7 +56,7 @@ type ChunkDataPacks struct {
5656
5757var _ storage.ChunkDataPacks = (* ChunkDataPacks )(nil )
5858
59- func NewChunkDataPacks (collector module.CacheMetrics , db storage.DB , stored storage.StoredChunkDataPacks , collections storage.Collections , chunkIDToChunkDataPackIDCacheSize uint ) * ChunkDataPacks {
59+ func NewChunkDataPacks (collector module.CacheMetrics , db storage.DB , cdpStorage storage.StoredChunkDataPacks , collections storage.Collections , chunkIDToChunkDataPackIDCacheSize uint ) * ChunkDataPacks {
6060
6161 retrieve := func (r storage.Reader , chunkID flow.Identifier ) (flow.Identifier , error ) {
6262 var chunkDataPackID flow.Identifier
@@ -78,7 +78,7 @@ func NewChunkDataPacks(collector module.CacheMetrics, db storage.DB, stored stor
7878 ch := ChunkDataPacks {
7979 protocolDB : db ,
8080 chunkIDToChunkDataPackIDCache : cache ,
81- stored : stored ,
81+ cdpStorage : cdpStorage ,
8282 collections : collections ,
8383 }
8484 return & ch
@@ -129,7 +129,7 @@ func (ch *ChunkDataPacks) Store(cs []*flow.ChunkDataPack) (
129129 storedChunkDataPacks := storage .ToStoredChunkDataPacks (cs )
130130
131131 // Store the chunk data packs and get back their unique IDs
132- chunkDataPackIDs , err := ch .stored .StoreChunkDataPacks (storedChunkDataPacks )
132+ chunkDataPackIDs , err := ch .cdpStorage .StoreChunkDataPacks (storedChunkDataPacks )
133133 if err != nil {
134134 return nil , fmt .Errorf ("cannot store chunk data packs: %w" , err )
135135 }
@@ -198,7 +198,7 @@ func (ch *ChunkDataPacks) BatchRemove(
198198 if len (chunkDataPackIDs ) > 0 {
199199 storage .OnCommitSucceed (protocolDBBatch , func () {
200200 // no errors expected during normal operation, even if no entries exist with the given IDs
201- err := ch .stored .Remove (chunkDataPackIDs )
201+ err := ch .cdpStorage .Remove (chunkDataPackIDs )
202202 if err != nil {
203203 log .Fatal ().Msgf ("cannot remove stored chunk data packs: %v" , err )
204204 }
@@ -239,7 +239,7 @@ func (ch *ChunkDataPacks) BatchRemoveChunkDataPacksOnly(chunkIDs []flow.Identifi
239239
240240 // Remove the stored chunk data packs
241241 if len (chunkDataPackIDs ) > 0 {
242- err := ch .stored .BatchRemove (chunkDataPackIDs , chunkDataPackBatch )
242+ err := ch .cdpStorage .BatchRemove (chunkDataPackIDs , chunkDataPackBatch )
243243 if err != nil {
244244 return fmt .Errorf ("cannot remove stored chunk data packs: %w" , err )
245245 }
@@ -261,7 +261,7 @@ func (ch *ChunkDataPacks) ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPac
261261 }
262262
263263 // Then retrieve the reduced representation of the chunk data pack via its ID.
264- schdp , err := ch .stored .ByID (chunkDataPackID )
264+ schdp , err := ch .cdpStorage .ByID (chunkDataPackID )
265265 if err != nil {
266266 return nil , fmt .Errorf ("cannot retrieve stored chunk data pack %x for chunk %x: %w" , chunkDataPackID , chunkID , err )
267267 }
0 commit comments