public async Task InitializeAsync(FileSystemSmugglerOptions options, FileSystemSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            filesStore = FileStoreHelper.CreateStore(connectionOptions);

            await ServerValidation.ValidateThatServerIsUpAndFileSystemExists(connectionOptions, filesStore).ConfigureAwait(false);

            await ServerValidation.DetectServerSupportedFeatures(connectionOptions).ConfigureAwait(false); // TODO arek - merge those 2 methods into single one
        }
Esempio n. 2
0
        public Task InitializeAsync(FileSystemSmugglerOptions options, FileSystemSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            // We use PositionWrapperStream due to:
            // http://connect.microsoft.com/VisualStudio/feedbackdetail/view/816411/ziparchive-shouldnt-read-the-position-of-non-seekable-streams
            positionStream = new PositionWrapperStream(stream, leaveOpen: true);
            archive        = new ZipArchive(positionStream, ZipArchiveMode.Create, leaveOpen: true);

            return(new CompletedTask());
        }
        public Task InitializeAsync(FileSystemSmugglerOptions options, FileSystemSmugglerNotifications notifications, CancellationToken cancellationToken)
        {
            if (incremental)
            {
                if (Directory.Exists(path) == false)
                {
                    if (File.Exists(path))
                    {
                        path = Path.GetDirectoryName(path) ?? path;
                    }
                    else
                    {
                        Directory.CreateDirectory(path);
                    }
                }

                if (options.StartFilesEtag == Etag.Empty)
                {
                    var lastExportedEtags = ReadLastEtagsFromIncrementalExportFile(path);

                    if (lastExportedEtags != null)
                    {
                        options.StartFilesEtag         = lastExportedEtags.LastFileEtag;
                        options.StartFilesDeletionEtag = lastExportedEtags.LastDeletedFileEtag;
                    }
                }

                path = Path.Combine(path, SystemTime.UtcNow.ToString("yyyy-MM-dd-HH-mm-0", CultureInfo.InvariantCulture) + ".ravenfs-incremental-dump");

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

                        if (File.Exists(path) == false)
                        {
                            break;
                        }

                        counter++;
                    }
                }
            }

            streamDestination = new StreamSmugglingDestination(File.Create(path));

            return(streamDestination.InitializeAsync(options, notifications, cancellationToken));
        }
Esempio n. 4
0
 public Task InitializeAsync(FileSystemSmugglerOptions options, FileSystemSmugglerNotifications notifications, CancellationToken cancellationToken)
 {
     return(new CompletedTask());
 }