Beispiel #1
0
        protected PrefetcherWithContext CreatePrefetcher(
            Action <InMemoryRavenConfiguration> modifyConfiguration = null,
            Action <WorkContext> modifyWorkContext = null,
            HashSet <string> entityNames           = null)
        {
            var configuration = new InMemoryRavenConfiguration
            {
                RunInMemory = true
            };

            configuration.Initialize();

            if (modifyConfiguration != null)
            {
                modifyConfiguration(configuration);
            }

            var transactionalStorage = new TransactionalStorage(configuration, () => { }, () => { }, () => { }, () => { });

            transactionalStorage.Initialize(new SequentialUuidGenerator {
                EtagBase = 0
            }, new OrderedPartCollection <AbstractDocumentCodec>());

            var workContext = new WorkContext
            {
                Configuration        = configuration,
                TransactionalStorage = transactionalStorage
            };

            if (modifyWorkContext != null)
            {
                modifyWorkContext(workContext);
            }

            var autoTuner = new IndexBatchSizeAutoTuner(workContext);

            var prefetchingBehavior = new PrefetchingBehavior(PrefetchingUser.Indexer, workContext, autoTuner, string.Empty, entityNames);

            var prefetcherWithContext = new PrefetcherWithContext
            {
                AutoTuner            = autoTuner,
                Configuration        = configuration,
                PrefetchingBehavior  = prefetchingBehavior,
                TransactionalStorage = transactionalStorage,
                WorkContext          = workContext
            };

            createdPrefetchers.Add(prefetcherWithContext);

            return(prefetcherWithContext);
        }
Beispiel #2
0
        protected PrefetcherWithContext CreatePrefetcher(Action<InMemoryRavenConfiguration> modifyConfiguration = null, Action<WorkContext> modifyWorkContext = null)
        {
            var configuration = new InMemoryRavenConfiguration
            {
                RunInMemory = true
            };

            configuration.Initialize();

            if (modifyConfiguration != null)
                modifyConfiguration(configuration);

            var transactionalStorage = new TransactionalStorage(configuration, () => { }, () => { }, () => { }, () => { });
            transactionalStorage.Initialize(new SequentialUuidGenerator { EtagBase = 0 }, new OrderedPartCollection<AbstractDocumentCodec>());

            var workContext = new WorkContext
            {
                Configuration = configuration,
                TransactionalStorage = transactionalStorage
            };

            if (modifyWorkContext != null)
                modifyWorkContext(workContext);

            var autoTuner = new IndexBatchSizeAutoTuner(workContext);

            var prefetchingBehavior = new PrefetchingBehavior(PrefetchingUser.Indexer, workContext, autoTuner, string.Empty);

            var prefetcherWithContext = new PrefetcherWithContext
                                        {
                                            AutoTuner = autoTuner,
                                            Configuration = configuration,
                                            PrefetchingBehavior = prefetchingBehavior,
                                            TransactionalStorage = transactionalStorage,
                                            WorkContext = workContext
                                        };

            createdPrefetchers.Add(prefetcherWithContext);

            return prefetcherWithContext;
        }