protected SmugglerBase(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination) { Options = options; Notifications = notifications; Source = source; Destination = destination; }
public DatabaseSmuggler(DatabaseSmugglerOptions options, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination) { _options = options; _source = source; _destination = destination; _notifications = new DatabaseSmugglerNotifications(); }
private async Task ProcessSourceAsync(IDatabaseSmugglerSource source, DatabaseSmugglerOperationState state, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(source.DisplayName) == false) { Notifications.ShowProgress("Processing source: {0}", source.DisplayName); } var maxEtags = await source .FetchCurrentMaxEtagsAsync(cancellationToken) .ConfigureAwait(false); while (true) { var type = await source .GetNextSmuggleTypeAsync(cancellationToken) .ConfigureAwait(false); switch (type) { case SmuggleType.None: return; case SmuggleType.Index: await new IndexSmuggler(_options, _notifications, source, _destination) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; case SmuggleType.Document: await new DocumentSmuggler(_options, _notifications, source, _destination, maxEtags) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; case SmuggleType.Transformer: await new TransformerSmuggler(_options, _notifications, source, _destination) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; case SmuggleType.DocumentDeletion: await new DocumentDeletionsSmuggler(_options, _notifications, source, _destination, maxEtags) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; case SmuggleType.Identity: await new IdentitySmuggler(_options, _notifications, source, _destination) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; case SmuggleType.Attachment: await new AttachmentSmuggler(_options, _notifications, source, _destination) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; case SmuggleType.AttachmentDeletion: await new AttachmentDeletionsSmuggler(_options, _notifications, source, _destination) .SmuggleAsync(state, cancellationToken) .ConfigureAwait(false); continue; default: throw new NotSupportedException(type.ToString()); } } }
private static async Task <DatabaseSmugglerOperationState> GetOperationStateAsync(DatabaseSmugglerOptions options, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination, CancellationToken cancellationToken) { DatabaseSmugglerOperationState state = null; if (destination.SupportsOperationState) { state = await destination .LoadOperationStateAsync(options, cancellationToken) .ConfigureAwait(false); } if (state == null) { state = new DatabaseSmugglerOperationState { LastDocsEtag = options.StartDocsEtag, LastDocDeleteEtag = options.StartDocsDeletionEtag, }; } Debug.Assert(state.LastDocsEtag != null); Debug.Assert(state.LastDocDeleteEtag != null); return(state); }
public AttachmentSmuggler(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination) : base(options, notifications, source, destination) { }
public TransformerSmuggler(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination) : base(options, notifications, source, destination) { }
public DocumentSmuggler(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination, DatabaseLastEtagsInfo maxEtags) : base(options, notifications, source, destination) { _maxEtags = maxEtags; _patcher = new SmugglerJintHelper(); _patcher.Initialize(options); }
public DocumentDeletionsSmuggler(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, IDatabaseSmugglerSource source, IDatabaseSmugglerDestination destination, DatabaseLastEtagsInfo maxEtags) : base(options, notifications, source, destination) { _maxEtags = maxEtags; }