github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/execution/ingestion/mocks/fetcher.go (about)

     1  package mocks
     2  
     3  import "github.com/onflow/flow-go/model/flow"
     4  
     5  type MockFetcher struct {
     6  	byID map[flow.Identifier]struct{}
     7  }
     8  
     9  func NewMockFetcher() *MockFetcher {
    10  	return &MockFetcher{
    11  		byID: make(map[flow.Identifier]struct{}),
    12  	}
    13  }
    14  
    15  func (r *MockFetcher) FetchCollection(blockID flow.Identifier, height uint64, guarantee *flow.CollectionGuarantee) error {
    16  	r.byID[guarantee.ID()] = struct{}{}
    17  	return nil
    18  }
    19  
    20  func (r *MockFetcher) Force() {
    21  }
    22  
    23  func (r *MockFetcher) IsFetched(id flow.Identifier) bool {
    24  	_, ok := r.byID[id]
    25  	return ok
    26  }