public static RegistrationStorageFactories CreateRegistrationStorageFactories(IDictionary <string, string> arguments, bool verbose) { CatalogStorageFactory legacyStorageFactory; var semVer2StorageFactory = CreateSemVer2StorageFactory(arguments, verbose); var storageFactory = CreateStorageFactory(arguments, verbose); var compressedStorageFactory = CreateCompressedStorageFactory(arguments, verbose); if (compressedStorageFactory != null) { var secondaryStorageBaseUrlRewriter = new SecondaryStorageBaseUrlRewriter(new List <KeyValuePair <string, string> > { // always rewrite storage root url in seconary new KeyValuePair <string, string>(storageFactory.BaseAddress.ToString(), compressedStorageFactory.BaseAddress.ToString()) }); var aggregateStorageFactory = new CatalogAggregateStorageFactory( storageFactory, new[] { compressedStorageFactory }, secondaryStorageBaseUrlRewriter.Rewrite, verbose); legacyStorageFactory = aggregateStorageFactory; } else { legacyStorageFactory = storageFactory; } return(new RegistrationStorageFactories(legacyStorageFactory, semVer2StorageFactory)); }
protected override void Init(IDictionary<string, string> arguments, CancellationToken cancellationToken) { var source = arguments.GetOrThrow<string>(Arguments.Source); var unlistShouldDelete = arguments.GetOrDefault(Arguments.UnlistShouldDelete, false); var verbose = arguments.GetOrDefault(Arguments.Verbose, false); var contentBaseAddress = arguments.GetOrDefault<string>(Arguments.ContentBaseAddress); StorageFactory storageFactoryToUse; var storageFactory = CommandHelpers.CreateStorageFactory(arguments, verbose); var compressedStorageFactory = CommandHelpers.CreateCompressedStorageFactory(arguments, verbose); Logger.LogInformation("CONFIG source: \"{ConfigSource}\" storage: \"{Storage}\"", source, storageFactory); RegistrationMakerCatalogItem.PackagePathProvider = new PackagesFolderPackagePathProvider(); if (compressedStorageFactory != null) { var secondaryStorageBaseUrlRewriter = new SecondaryStorageBaseUrlRewriter(new List<KeyValuePair<string, string>> { // always rewrite storage root url in seconary new KeyValuePair<string, string>(storageFactory.BaseAddress.ToString(), compressedStorageFactory.BaseAddress.ToString()) }); var aggregateStorageFactory = new AggregateStorageFactory( storageFactory, new[] { compressedStorageFactory }, secondaryStorageBaseUrlRewriter.Rewrite); storageFactoryToUse = aggregateStorageFactory; } else { storageFactoryToUse = storageFactory; } _collector = new RegistrationCollector(new Uri(source), storageFactoryToUse, CommandHelpers.GetHttpMessageHandlerFactory(verbose)) { ContentBaseAddress = contentBaseAddress == null ? null : new Uri(contentBaseAddress) }; var storage = storageFactoryToUse.Create(); _front = new DurableCursor(storage.ResolveUri("cursor.json"), storage, MemoryCursor.MinValue); _back = MemoryCursor.CreateMax(); }