Inheritance: NuGet.Services.Metadata.Catalog.CommitCollector
コード例 #1
0
        static async Task Loop(string source, string registration, Lucene.Net.Store.Directory directory, string catalogBaseAddress, string storageBaseAddress, bool verbose, int interval)
        {
            Func <HttpMessageHandler> handlerFunc = CommandHelpers.GetHttpMessageHandlerFactory(verbose, catalogBaseAddress, storageBaseAddress);

            CommitCollector collector = new SearchIndexFromCatalogCollector(new Uri(source), directory, catalogBaseAddress, handlerFunc);

            ReadWriteCursor front = new LuceneCursor(directory, MemoryCursor.Min.Value);

            ReadCursor back = (registration == null) ? (ReadCursor)MemoryCursor.Max : new HttpReadCursor(new Uri(registration), handlerFunc);

            while (true)
            {
                bool run = false;
                do
                {
                    run = await collector.Run(front, back);
                }while (run);

                Thread.Sleep(interval * 1000);
            }
        }
コード例 #2
0
        static async Task Loop(string source, string registration, Lucene.Net.Store.Directory directory, string catalogBaseAddress, string storageBaseAddress, bool verbose, int interval, CancellationToken cancellationToken)
        {
            Func<HttpMessageHandler> handlerFunc = CommandHelpers.GetHttpMessageHandlerFactory(verbose, catalogBaseAddress, storageBaseAddress);

            CommitCollector collector = new SearchIndexFromCatalogCollector(new Uri(source), directory, catalogBaseAddress, handlerFunc);

            ReadWriteCursor front = new LuceneCursor(directory, MemoryCursor.Min.Value);
            
            ReadCursor back = (registration == null) ? (ReadCursor)MemoryCursor.Max : new HttpReadCursor(new Uri(registration), handlerFunc);

            while (true)
            {
                bool run = false;
                do
                {
                    run = await collector.Run(front, back, cancellationToken);
                }
                while (run);

                Thread.Sleep(interval * 1000);
            }
        }
コード例 #3
0
ファイル: State.cs プロジェクト: NuGet/Entropy
        async Task CreateLuceneIndex(Uri catalogIndex, Func<StorageHttpMessageHandler> handlerFunc, CancellationToken cancellationToken)
        {
            Lucene.Net.Store.Directory luceneDirectory = new RAMDirectory();

            var collector = new SearchIndexFromCatalogCollector(
                catalogIndex,
                luceneDirectory,
                null,
                handlerFunc);

            await collector.Run(
                new MemoryCursor(DateTime.MinValue.ToUniversalTime()),
                new MemoryCursor(DateTime.MaxValue.ToUniversalTime()),
                cancellationToken);

            ILogger logger = new DebugLogger("Lucene");
            ILoader loader = new AuxillaryIndexLoader();

            SearcherManager = new NuGetSearcherManager("memory", logger, luceneDirectory, loader);
            SearcherManager.RegistrationBaseAddress["http"] = new Uri(_baseAddress, Registration);
            SearcherManager.RegistrationBaseAddress["https"] = new Uri(_baseAddress, Registration);
            SearcherManager.Open();
        }