github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/verification/fetcher/requester.go (about) 1 package fetcher 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/model/verification" 6 "github.com/onflow/flow-go/module" 7 ) 8 9 // ChunkDataPackRequester encapsulates the logic of requesting a chunk data pack from an execution node. 10 type ChunkDataPackRequester interface { 11 module.ReadyDoneAware 12 // Request makes the request of chunk data pack for the specified chunk ID with the specified targets. 13 Request(request *verification.ChunkDataPackRequest) 14 // WithChunkDataPackHandler registers the handler component of requester engine. The handler implements the logic of handling 15 // a requested chunk data pack upon its arrival. 16 WithChunkDataPackHandler(handler ChunkDataPackHandler) 17 } 18 19 // ChunkDataPackHandler encapsulates the logic of handling a requested chunk data pack upon its arrival. 20 type ChunkDataPackHandler interface { 21 // HandleChunkDataPack is called by the ChunkDataPackRequester anytime a new requested chunk arrives. 22 // It contains the logic of handling the chunk data pack. 23 HandleChunkDataPack(originID flow.Identifier, response *verification.ChunkDataPackResponse) 24 25 // NotifyChunkDataPackSealed is called by the ChunkDataPackRequester to notify the ChunkDataPackHandler that the specified chunk 26 // has been sealed and hence the requester will no longer request it. 27 // 28 // When the requester calls this callback method, it will never return a chunk data pack for this specified chunk to the handler (i.e., 29 // through HandleChunkDataPack). 30 NotifyChunkDataPackSealed(chunkIndex uint64, resultID flow.Identifier) 31 }