private IFileDatabaseSnapshot CreateFullScan(FileSystemSnapshot newSnapshot, UpdateFileDatabaseOptions options, CancellationToken cancellationToken) { Invariants.Assert(_inTaskQueueTask); return(_fileDatabaseSnapshotFactory.CreateIncremental( options.CurrentFileDatabase, newSnapshot, onIntermadiateResult: fileDatabase => { ActivateCurrentDatabase(newSnapshot, fileDatabase, false); OnFilesLoadingProgress(options.OperationInfo); }, onLoading: () => OnFilesLoading(options.OperationInfo), onLoaded: () => OnFilesLoaded(new FilesLoadedResult { OperationInfo = options.OperationInfo, TreeVersion = _currentFileSystemSnapshotVersion, }), cancellationToken: cancellationToken)); }
private void UpdateFileDatabase(FileSystemSnapshot fileSystemSnapshot, Func <UpdateFileDatabaseOptions, IFileDatabaseSnapshot> updater) { Invariants.Assert(_inTaskQueueTask); var options = new UpdateFileDatabaseOptions(); _operationProcessor.Execute(new OperationHandlers { OnBeforeExecute = info => { options.OperationInfo = info; options.PreviousUpdateCompleted = _previousUpdateCompleted; _previousUpdateCompleted = false; }, OnError = (info, error) => { _currentFileSystemSnapshotVersion = fileSystemSnapshot.Version; _previousUpdateCompleted = false; OnFilesLoading(info); OnFilesLoaded(new FilesLoadedResult { OperationInfo = info, Error = error, TreeVersion = _currentFileSystemSnapshotVersion, }); }, Execute = info => { options.CurrentFileDatabase = _currentFileDatabase; var newFileDatabase = updater(options); ActivateCurrentDatabase(fileSystemSnapshot, newFileDatabase, true); OnFilesLoaded(new FilesLoadedResult { OperationInfo = info, TreeVersion = fileSystemSnapshot.Version }); } }); }