func (p *testPrefetcher) MockFlush(t *testing.T, impl func()) {
	p.currentMocks(t).flushMock = impl
}
MockPrefetch sets the mocked implementation of Prefetch.
package manipvortex
import (
	"context"
	"fmt"
	"sync"
	"testing"
	"go.aporeto.io/elemental"
	"go.aporeto.io/manipulate"
)
type Prefetcher interface {
	WarmUp(context.Context, manipulate.Manipulator, elemental.ModelManager, elemental.Identity) (elemental.Identifiables, error)
	Prefetch(context.Context, elemental.Operation, elemental.Identity, manipulate.Manipulator, manipulate.Context) (elemental.Identifiables, error)
	Flush()
}
type defaultPrefetcher struct {
}
func NewDefaultPrefetcher() Prefetcher {
	return &defaultPrefetcher{}
}
func (p *defaultPrefetcher) WarmUp(ctx context.Context, m manipulate.Manipulator, manager elemental.ModelManager, identity elemental.Identity) (elemental.Identifiables, error) {
	out := manager.Identifiables(identity)
	if err := manipulate.IterFunc(
		ctx,
		m,
		manager.Identifiables(identity),
		manipulate.NewContext(ctx, manipulate.ContextOptionRecursive(true)),
		func(block elemental.Identifiables) error {
			out = out.Append(block.List()...)
			return nil
		},
		1000,
	); err != nil {
		return nil, fmt.Errorf("unable to warm up identity '%s': %s", identity.Name, err)
	}
	return out, nil
}
func (p *defaultPrefetcher) Prefetch(context.Context, elemental.Operation, elemental.Identity, manipulate.Manipulator, manipulate.Context) (elemental.Identifiables, error) {
	return nil, nil
}
func (p *defaultPrefetcher) Flush() {}
type TestPrefetcher interface {
	Prefetcher
	MockWarmUp(t *testing.T, impl func(context.Context, manipulate.Manipulator, elemental.ModelManager, elemental.Identity) (elemental.Identifiables, error))
	MockPrefetch(t *testing.T, impl func(context.Context, elemental.Operation, elemental.Identity, manipulate.Manipulator, manipulate.Context) (elemental.Identifiables, error))
	MockFlush(t *testing.T, impl func())
}
type mockedPrefetcherMethods struct {
	warmUpMock   func(context.Context, manipulate.Manipulator, elemental.ModelManager, elemental.Identity) (elemental.Identifiables, error)
	prefetchMock func(context.Context, elemental.Operation, elemental.Identity, manipulate.Manipulator, manipulate.Context) (elemental.Identifiables, error)
	flushMock    func()
}
type testPrefetcher struct {
	mocks       map[*testing.T]*mockedPrefetcherMethods
	lock        *sync.Mutex
	currentTest *testing.T
}
func NewTestPrefetcher() TestPrefetcher {
	return &testPrefetcher{
		lock:  &sync.Mutex{},
		mocks: map[*testing.T]*mockedPrefetcherMethods{},
	}
}
func (p *testPrefetcher) MockWarmUp(t *testing.T, impl func(context.Context, manipulate.Manipulator, elemental.ModelManager, elemental.Identity) (elemental.Identifiables, error)) {
	p.currentMocks(t).warmUpMock = impl
}
func (p *testPrefetcher) MockPrefetch(t *testing.T, impl func(context.Context, elemental.Operation, elemental.Identity, manipulate.Manipulator, manipulate.Context) (elemental.Identifiables, error)) {
	p.currentMocks(t).prefetchMock = impl
}