public RegistrationPersistence(StorageFactory storageFactory, RegistrationKey registrationKey, int partitionSize, int packageCountThreshold, Uri contentBaseAddress) { _storage = new RecordingStorage(storageFactory.Create(registrationKey.ToString())); _registrationUri = _storage.ResolveUri("index.json"); _packageCountThreshold = packageCountThreshold; _partitionSize = partitionSize; _registrationBaseAddress = storageFactory.BaseAddress; _contentBaseAddress = contentBaseAddress; }
public RegistrationPersistence(StorageFactory storageFactory, RegistrationKey registrationKey, int partitionSize, int packageCountThreshold, Uri contentBaseAddress) { _storage = new RecordingStorage(storageFactory.Create(registrationKey.ToString())); _registrationUri = _storage.ResolveUri("index.json"); _packageCountThreshold = packageCountThreshold; _partitionSize = partitionSize; _registrationBaseAddress = storageFactory.BaseAddress; _contentBaseAddress = contentBaseAddress; }
public static async Task Process(RegistrationKey registrationKey, IDictionary <string, IGraph> newItems, StorageFactory storageFactory, Uri contentBaseAddress, int partitionSize, int packageCountThreshold) { IRegistrationPersistence registration = new RegistrationPersistence(storageFactory, registrationKey, partitionSize, packageCountThreshold); IDictionary <RegistrationEntryKey, RegistrationCatalogEntry> existing = await registration.Load(); IDictionary <RegistrationEntryKey, RegistrationCatalogEntry> delta = PromoteRegistrationKey(newItems); IDictionary <RegistrationEntryKey, RegistrationCatalogEntry> resulting = Apply(existing, delta); await registration.Save(resulting); }
public override bool Equals(object obj) { RegistrationKey rhs = obj as RegistrationKey; if (rhs == null) { return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(Id, rhs.Id)); }
public static KeyValuePair <RegistrationEntryKey, RegistrationCatalogEntry> Promote(string resourceUri, IGraph graph) { INode subject = graph.CreateUriNode(new Uri(resourceUri)); string version = graph.GetTriplesWithSubjectPredicate(subject, graph.CreateUriNode(Schema.Predicates.Version)).First().Object.ToString(); RegistrationEntryKey registrationEntryKey = new RegistrationEntryKey(RegistrationKey.Promote(resourceUri, graph), version); RegistrationCatalogEntry registrationCatalogEntry = IsDelete(subject, graph) ? null : new RegistrationCatalogEntry(resourceUri, graph); return(new KeyValuePair <RegistrationEntryKey, RegistrationCatalogEntry>(registrationEntryKey, registrationCatalogEntry)); }
public override bool Equals(object obj) { RegistrationKey rhs = obj as RegistrationKey; if (rhs == null) { return(false); } return(Id == rhs.Id); }
public override bool Equals(object obj) { RegistrationEntryKey rhs = obj as RegistrationEntryKey; if (rhs == null) { return(false); } return(RegistrationKey.Equals(rhs.RegistrationKey) && _normalizedVersion == rhs._normalizedVersion); }
public static async Task Process(RegistrationKey registrationKey, IDictionary<string, IGraph> newItems, StorageFactory storageFactory, Uri contentBaseAddress, int partitionSize, int packageCountThreshold, CancellationToken cancellationToken) { Trace.TraceInformation("RegistrationMaker.Process: registrationKey = {0} newItems: {1}", registrationKey, newItems.Count); IRegistrationPersistence registration = new RegistrationPersistence(storageFactory, registrationKey, partitionSize, packageCountThreshold, contentBaseAddress); IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> existing = await registration.Load(cancellationToken); Trace.TraceInformation("RegistrationMaker.Process: existing = {0}", existing.Count); IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> delta = PromoteRegistrationKey(newItems); Trace.TraceInformation("RegistrationMaker.Process: delta = {0}", delta.Count); IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> resulting = Apply(existing, delta); Trace.TraceInformation("RegistrationMaker.Process: resulting = {0}", resulting.Count); await registration.Save(resulting, cancellationToken); }
public RegistrationPersistence( StorageFactory storageFactory, RegistrationMakerCatalogItem.PostProcessGraph postProcessGraph, RegistrationKey registrationKey, int partitionSize, int packageCountThreshold, Uri contentBaseAddress, Uri galleryBaseAddress, bool forcePackagePathProviderForIcons) { _storage = new RecordingStorage(storageFactory.Create(registrationKey.ToString())); _postProcessGraph = postProcessGraph; _registrationUri = _storage.ResolveUri("index.json"); _packageCountThreshold = packageCountThreshold; _partitionSize = partitionSize; _registrationBaseAddress = storageFactory.BaseAddress; _contentBaseAddress = contentBaseAddress; _galleryBaseAddress = galleryBaseAddress; _forcePackagePathProviderForIcons = forcePackagePathProviderForIcons; }
public static async Task ProcessAsync( RegistrationKey registrationKey, IReadOnlyDictionary <string, IGraph> newItems, StorageFactory storageFactory, Uri contentBaseAddress, int partitionSize, int packageCountThreshold, ITelemetryService telemetryService, CancellationToken cancellationToken) { await ProcessAsync( registrationKey, newItems, (k, u, g) => true, storageFactory, contentBaseAddress, partitionSize, packageCountThreshold, telemetryService, cancellationToken); }
public static KeyValuePair <RegistrationEntryKey, RegistrationCatalogEntry> Promote( string resourceUri, IGraph graph, ShouldIncludeRegistrationPackage shouldInclude, bool isExistingItem) { INode subject = graph.CreateUriNode(new Uri(resourceUri)); var triples = graph.GetTriplesWithSubjectPredicate(subject, graph.CreateUriNode(Schema.Predicates.Version)); string version = triples.First().Object.ToString(); var registrationEntryKey = new RegistrationEntryKey(RegistrationKey.Promote(resourceUri, graph), version); RegistrationCatalogEntry registrationCatalogEntry = null; if (!IsDelete(subject, graph) && shouldInclude(registrationEntryKey, resourceUri, graph)) { registrationCatalogEntry = new RegistrationCatalogEntry(resourceUri, graph, isExistingItem); } return(new KeyValuePair <RegistrationEntryKey, RegistrationCatalogEntry>(registrationEntryKey, registrationCatalogEntry)); }
public static async Task ProcessAsync( RegistrationKey registrationKey, IReadOnlyDictionary <string, IGraph> newItems, ShouldIncludeRegistrationPackage shouldInclude, StorageFactory storageFactory, RegistrationMakerCatalogItem.PostProcessGraph postProcessGraph, Uri contentBaseAddress, Uri galleryBaseAddress, int partitionSize, int packageCountThreshold, bool forcePackagePathProviderForIcons, ITelemetryService telemetryService, CancellationToken cancellationToken) { Trace.TraceInformation("RegistrationMaker.Process: registrationKey = {0} newItems: {1}", registrationKey, newItems.Count); IRegistrationPersistence registration = new RegistrationPersistence(storageFactory, postProcessGraph, registrationKey, partitionSize, packageCountThreshold, contentBaseAddress, galleryBaseAddress, forcePackagePathProviderForIcons); IDictionary <RegistrationEntryKey, RegistrationCatalogEntry> existing = await registration.Load(cancellationToken); Trace.TraceInformation("RegistrationMaker.Process: existing = {0}", existing.Count); IDictionary <RegistrationEntryKey, RegistrationCatalogEntry> delta = PromoteRegistrationKey(newItems, shouldInclude); Trace.TraceInformation("RegistrationMaker.Process: delta = {0}", delta.Count); telemetryService.TrackMetric(TelemetryConstants.RegistrationDeltaCount, (uint)delta.Count, new Dictionary <string, string>() { { TelemetryConstants.ContentBaseAddress, contentBaseAddress.AbsoluteUri }, { TelemetryConstants.GalleryBaseAddress, galleryBaseAddress.AbsoluteUri } }); IDictionary <RegistrationEntryKey, RegistrationCatalogEntry> resulting = Apply(existing, delta); Trace.TraceInformation("RegistrationMaker.Process: resulting = {0}", resulting.Count); await registration.Save(resulting, cancellationToken); }
public override string ToString() { return(RegistrationKey.ToString() + "/" + Version); }
public RegistrationEntryKey(RegistrationKey registrationKey, string version) { RegistrationKey = registrationKey; Version = version; _normalizedVersion = NuGetVersionUtility.NormalizeVersion(version).ToLowerInvariant(); }