public virtual Task InitializeAsync(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            _gZipStream   = new GZipStream(_stream, CompressionMode.Compress, leaveOpen: true);
            _streamWriter = new StreamWriter(_gZipStream);
            _writer       = new JsonTextWriter(_streamWriter)
            {
                Formatting = Formatting.Indented
            };

            _writer.WriteStartObject();
            return(new CompletedTask());
        }
        public async Task InitializeAsync(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            _globalOptions = options;
            _notifications = notifications;
            _store         = _storeFactory();

            if (_ownsStore)
            {
                _store.Initialize(ensureDatabaseExists: false);
            }

            _store.JsonRequestFactory.DisableRequestCompression = _options.DisableCompression;

            await ServerValidation.ValidateThatServerIsUpAndDatabaseExistsAsync(_store, cancellationToken).ConfigureAwait(false);

            await InitializeBatchSizeAsync(_store, _globalOptions).ConfigureAwait(false);
        }
        public DatabaseSmugglerRemoteDocumentActions(DatabaseSmugglerOptions globalOptions, DatabaseSmugglerRemoteDestinationOptions options, DatabaseSmugglerNotifications notifications, DocumentStore store)
        {
            _options       = options;
            _notifications = notifications;
            _bulkInsert    = store.BulkInsert(store.DefaultDatabase, new BulkInsertOptions
            {
                BatchSize                = globalOptions.BatchSize,
                OverwriteExisting        = true,
                Compression              = options.DisableCompression ? BulkInsertCompression.None : BulkInsertCompression.GZip,
                ChunkedBulkInsertOptions = new ChunkedBulkInsertOptions
                {
                    MaxChunkVolumeInBytes = options.TotalDocumentSizeInChunkLimitInBytes,
                    MaxDocumentsPerChunk  = options.ChunkSize
                }
            });

            _notifications.OnDocumentRead += DocumentFound;
            _timeSinceLastWrite            = Stopwatch.StartNew();
        }
        public override async Task InitializeAsync(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            var filePath = _path;

            if (_options.Incremental)
            {
                if (Directory.Exists(_path) == false)
                {
                    if (File.Exists(_path))
                    {
                        filePath = Path.GetDirectoryName(_path) ?? _path;
                    }
                    else
                    {
                        Directory.CreateDirectory(_path);
                    }
                }

                filePath = Path.Combine(filePath, SystemTime.UtcNow.ToString("yyyy-MM-dd-HH-mm-0", CultureInfo.InvariantCulture) + ".ravendb-incremental-dump");
                if (File.Exists(filePath))
                {
                    var counter = 1;
                    while (true)
                    {
                        filePath = Path.Combine(Path.GetDirectoryName(filePath), SystemTime.UtcNow.ToString("yyyy-MM-dd-HH-mm", CultureInfo.InvariantCulture) + "-" + counter + ".ravendb-incremental-dump");

                        if (File.Exists(filePath) == false)
                        {
                            break;
                        }
                        counter++;
                    }
                }
            }

            _outputFilePath = filePath;
            _stream         = File.Create(filePath);

            await base.InitializeAsync(options, notifications, cancellationToken).ConfigureAwait(false);
        }
 public Task InitializeAsync(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, CancellationToken cancellationToken)
 {
     return(new CompletedTask());
 }
示例#6
0
        public async Task InitializeAsync(DatabaseSmugglerOptions options, DatabaseSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            _globalOptions = options;

            await InitializeBatchSizeAsync(_database, _globalOptions).ConfigureAwait(false);
        }