private void ProcessType(DatabaseItemType type, SmugglerResult result, BuildVersionType buildType, bool ensureStepsProcessed = true) { if ((_options.OperateOnTypes & type) != type) { switch (type) { case DatabaseItemType.LegacyDocumentDeletions: // process only those when we are processing documents if ((_options.OperateOnTypes & DatabaseItemType.Documents) != DatabaseItemType.Documents) { SkipType(type, result, ensureStepsProcessed); return; } break; case DatabaseItemType.LegacyAttachments: case DatabaseItemType.LegacyAttachmentDeletions: // we cannot skip those? break; default: SkipType(type, result, ensureStepsProcessed); return; } } result.AddInfo($"Started processing {type}."); _onProgress.Invoke(result.Progress); SmugglerProgressBase.Counts counts; switch (type) { case DatabaseItemType.DatabaseRecord: counts = ProcessDatabaseRecord(result); break; case DatabaseItemType.Documents: counts = ProcessDocuments(result, buildType); break; case DatabaseItemType.RevisionDocuments: counts = ProcessRevisionDocuments(result); break; case DatabaseItemType.Tombstones: counts = ProcessTombstones(result); break; case DatabaseItemType.Conflicts: counts = ProcessConflicts(result); break; case DatabaseItemType.Indexes: counts = ProcessIndexes(result); break; case DatabaseItemType.Identities: counts = ProcessIdentities(result); break; case DatabaseItemType.LegacyAttachments: counts = ProcessLegacyAttachments(result); break; case DatabaseItemType.LegacyDocumentDeletions: counts = ProcessLegacyDocumentDeletions(result); break; case DatabaseItemType.LegacyAttachmentDeletions: counts = ProcessLegacyAttachmentDeletions(result); break; case DatabaseItemType.CompareExchange: counts = ProcessCompareExchange(result); break; case DatabaseItemType.Counters: counts = ProcessCounters(result); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } if (ensureStepsProcessed) { counts.Processed = true; if (counts is SmugglerProgressBase.CountsWithLastEtag countsWithEtag) { countsWithEtag.Attachments.Processed = true; } } result.AddInfo($"Finished processing {type}. {counts}"); _onProgress.Invoke(result.Progress); }
/// <summary> /// Initializes a new instance of the <see cref="BuildVersionTypeDTO"/> class. /// </summary> /// <param name="type"> /// The type. /// </param> public BuildVersionTypeDTO(BuildVersionType type) { this.buildVersionTypeId = type.Id; this.buildVersionType = type.BuildVersionTypeName; }
public IDisposable Initialize(DatabaseSmugglerOptions options, SmugglerResult result, long buildVersion) { _buildType = BuildVersion.Type(buildVersion); return(null); }
public static void Import(BlittableJsonReaderObject indexDefinitionDoc, DocumentDatabase database, BuildVersionType buildType, bool removeAnalyzers) { var definition = ReadIndexDefinition(indexDefinitionDoc, buildType, out IndexType indexType); switch (indexType) { case IndexType.AutoMap: var autoMapIndexDefinition = (AutoMapIndexDefinition)definition; AsyncHelpers.RunSync(() => database.IndexStore.CreateIndex(autoMapIndexDefinition)); break; case IndexType.AutoMapReduce: var autoMapReduceIndexDefinition = (AutoMapReduceIndexDefinition)definition; AsyncHelpers.RunSync(() => database.IndexStore.CreateIndex(autoMapReduceIndexDefinition)); break; case IndexType.Map: case IndexType.MapReduce: var indexDefinition = (IndexDefinition)definition; if (removeAnalyzers) { foreach (var indexDefinitionField in indexDefinition.Fields) { indexDefinitionField.Value.Analyzer = null; } } AsyncHelpers.RunSync(() => database.IndexStore.CreateIndex(indexDefinition)); break; default: throw new NotSupportedException(indexType.ToString()); } }