async Task CreateIndex(CancellationToken cancellationToken) { var index = new Index(); string queryResource = new Uri(_baseAddress, "query").AbsoluteUri; index.Add(queryResource, "@type", "SearchQueryService/3.0.0-beta"); index.Add(queryResource, "comment", "Query endpoint of NuGet Search service (primary)"); string flatContainerResource = new Uri(_baseAddress, Flat).AbsoluteUri; index.Add(flatContainerResource, "@type", "PackageBaseAddress/3.0.0"); index.Add(flatContainerResource, "comment", "Base URL of Azure storage where NuGet package registration info for DNX is stored"); string registrationsBaseUrlResource = new Uri(_baseAddress, Registration).AbsoluteUri; index.Add(registrationsBaseUrlResource, "@type", "RegistrationsBaseUrl/3.0.0-beta"); index.Add(registrationsBaseUrlResource, "comment", "Base URL of Azure storage where NuGet package registration info is stored used by Beta clients"); string reportAbuseResource = "https://www.nuget.org/packages/{id}/{version}/ReportAbuse"; index.Add(reportAbuseResource, "@type", "ReportAbuseUriTemplate/3.0.0-beta"); index.Add(reportAbuseResource, "comment", "URI template used by NuGet Client to construct Report Abuse URL for packages"); var factory = new MemoryStorageFactory(_baseAddress, _store); var storage = factory.Create(); await storage.Save(new Uri(_baseAddress, "index.json"), new StringStorageContent(index.ToJson(), "application/json"), cancellationToken); }
public async Task Load(string path, CancellationToken cancellationToken) { var directoryInfo = new DirectoryInfo(path); foreach (var fileInfo in directoryInfo.EnumerateFiles("*.nuspec")) { AddNuspec(fileInfo); } // Catalog var factory = new MemoryStorageFactory(new Uri(_baseAddress, Catalog), _store); var storage = factory.Create(); var catalog = new AppendOnlyCatalogWriter(storage); foreach (var registration in Data.Values) { foreach (var package in registration.Values) { var metadata = new NupkgMetadata { Nuspec = package }; catalog.Add(new PackageCatalogItem(metadata)); } } await catalog.Commit(null, cancellationToken); Uri catalogIndex = new Uri(storage.BaseAddress, "index.json"); Func <StorageHttpMessageHandler> handlerFunc = () => { return(new StorageHttpMessageHandler(storage)); }; await CreateRegistrationBlobs(catalogIndex, handlerFunc, cancellationToken); await CreateFlatContainer(catalogIndex, handlerFunc, cancellationToken); await CreateLuceneIndex(catalogIndex, handlerFunc, cancellationToken); await CreateIndex(cancellationToken); }
public async Task Load(string path, CancellationToken cancellationToken) { var directoryInfo = new DirectoryInfo(path); foreach (var fileInfo in directoryInfo.EnumerateFiles("*.nuspec")) { AddNuspec(fileInfo); } // Catalog var factory = new MemoryStorageFactory(new Uri(_baseAddress, Catalog), _store); var storage = factory.Create(); var catalog = new AppendOnlyCatalogWriter(storage); foreach (var registration in Data.Values) { foreach (var package in registration.Values) { var metadata = new NupkgMetadata { Nuspec = package }; catalog.Add(new PackageCatalogItem(metadata)); } } await catalog.Commit(null, cancellationToken); Uri catalogIndex = new Uri(storage.BaseAddress, "index.json"); Func<StorageHttpMessageHandler> handlerFunc = () => { return new StorageHttpMessageHandler(storage); }; await CreateRegistrationBlobs(catalogIndex, handlerFunc, cancellationToken); await CreateFlatContainer(catalogIndex, handlerFunc, cancellationToken); await CreateLuceneIndex(catalogIndex, handlerFunc, cancellationToken); await CreateIndex(cancellationToken); }
public Storage CreateStorage() { var factory = new MemoryStorageFactory(_baseAddress, _store); return(factory.Create()); }
public Storage CreateStorage() { var factory = new MemoryStorageFactory(_baseAddress, _store); return factory.Create(); }