public FileSystemSnapshotManager(
            IFileSystemNameFactory fileSystemNameFactory,
            IFileSystem fileSystem,
            IFileRegistrationTracker fileRegistrationTracker,
            IFileSystemSnapshotBuilder fileSystemSnapshotBuilder,
            IOperationProcessor operationProcessor,
            IProjectDiscovery projectDiscovery,
            IDirectoryChangeWatcherFactory directoryChangeWatcherFactory,
            ITaskQueueFactory taskQueueFactory,
            ILongRunningFileSystemTaskQueue longRunningFileSystemTaskQueue)
        {
            _fileSystemNameFactory          = fileSystemNameFactory;
            _fileSystem                     = fileSystem;
            _fileSystemSnapshotBuilder      = fileSystemSnapshotBuilder;
            _operationProcessor             = operationProcessor;
            _projectDiscovery               = projectDiscovery;
            _longRunningFileSystemTaskQueue = longRunningFileSystemTaskQueue;
            _fileRegistrationTracker        = fileRegistrationTracker;

            _flushPathChangesTaskQueue = taskQueueFactory.CreateQueue("FileSystemSnapshotManager Path Changes Task Queue");
            _taskExecutor = taskQueueFactory.CreateQueue("FileSystemSnapshotManager State Change Task Queue");
            _fileRegistrationTracker.ProjectListChanged += FileRegistrationTrackerOnProjectListChanged;
            _currentSnapshot        = FileSystemSnapshot.Empty;
            _directoryChangeWatcher = directoryChangeWatcherFactory.CreateWatcher(TimeSpan.FromSeconds(60));
            _directoryChangeWatcher.PathsChanged += DirectoryChangeWatcherOnPathsChanged;
            _directoryChangeWatcher.Error        += DirectoryChangeWatcherOnError;
            _directoryChangeWatcher.Paused       += DirectoryChangeWatcherOnPaused;
            _directoryChangeWatcher.Resumed      += DirectoryChangeWatcherOnResumed;
        }
 public void InitializeOperationProcessor(IOperationProcessor operationProcessor, ConfigurationData configurationData)
 {
     foreach (var watcher in configurationData.Watchers)
     {
         operationProcessor.AssignOperation(GetOperation(configurationData, watcher));
     }
 }
Example #3
0
        public FileSystemSnapshotManager(
            IFileSystemNameFactory fileSystemNameFactory,
            IFileSystem fileSystem,
            IFileRegistrationTracker fileRegistrationTracker,
            IFileSystemSnapshotBuilder fileSystemSnapshotBuilder,
            IOperationProcessor operationProcessor,
            IProjectDiscovery projectDiscovery,
            IDirectoryChangeWatcherFactory directoryChangeWatcherFactory,
            ITaskQueueFactory taskQueueFactory,
            ILongRunningFileSystemTaskQueue longRunningFileSystemTaskQueue)
        {
            _fileSystemNameFactory          = fileSystemNameFactory;
            _fileSystem                     = fileSystem;
            _fileSystemSnapshotBuilder      = fileSystemSnapshotBuilder;
            _operationProcessor             = operationProcessor;
            _projectDiscovery               = projectDiscovery;
            _longRunningFileSystemTaskQueue = longRunningFileSystemTaskQueue;
            _fileRegistrationTracker        = fileRegistrationTracker;

            _flushPathChangesTaskQueue = taskQueueFactory.CreateQueue("FileSystemSnapshotManager Path Changes Task Queue");
            _fileRegistrationTracker.ProjectListChanged   += FileRegistrationTrackerOnProjectListChanged;
            _fileRegistrationTracker.ProjectListRefreshed += FileRegistrationTrackerOnProjectListRefreshed;
            _fileSystemSnapshot     = FileSystemSnapshot.Empty;
            _directoryChangeWatcher = directoryChangeWatcherFactory.CreateWatcher();
            _directoryChangeWatcher.PathsChanged += DirectoryChangeWatcherOnPathsChanged;
            _directoryChangeWatcher.Error        += DirectoryChangeWatcherOnError;
        }
Example #4
0
        /// <inheritdoc />
        public Task <OperationContainer> ProcessAsync(OperationContainer operation, CancellationToken cancellationToken)
        {
            ArgumentGuard.NotNull(operation, nameof(operation));

            IOperationProcessor processor = ResolveProcessor(operation);

            return(processor.ProcessAsync(operation, cancellationToken));
        }
Example #5
0
 public LogRecordsDispatcher(IOperationProcessor processor)
 {
     this.flushedRecords              = null;
     this.processingRecords           = null;
     this.processingIndex             = 0;
     this.concurrentRecords           = new List <LogRecord>();
     this.numberOfSpawnedTransactions = 0;
     this.processor = processor;
 }
 public RunOperationsCommand(
     IOperationProcessor processor,
     IOperationProvider provider,
     Action beforeStart,
     Action afterCompletion,
     Func <CancellationTokenSource> tokenSourceFunc)
 {
     this.processor       = processor;
     this.provider        = provider;
     _beforeStart         = beforeStart;
     _afterCompletion     = afterCompletion;
     this.tokenSourceFunc = tokenSourceFunc;
 }
 public RunOperationsCommand(
     IOperationProcessor processor,
     IOperationProvider provider,
     Action beforeStart,
     Action afterCompletion,
     Func<CancellationTokenSource> tokenSourceFunc)
 {
     this.processor = processor;
     this.provider = provider;
     _beforeStart = beforeStart;
     _afterCompletion = afterCompletion;
     this.tokenSourceFunc = tokenSourceFunc;
 }
 public FileSystemProcessor(
     IFileSystemNameFactory fileSystemNameFactory,
     IProjectDiscovery projectDiscovery,
     IDirectoryChangeWatcherFactory directoryChangeWatcherFactory,
     ITaskQueueFactory taskQueueFactory,
     IFileSystemSnapshotBuilder fileSystemSnapshotBuilder,
     IOperationProcessor <SnapshotComputedEventArgs> snapshotOperationProcessor)
 {
     _fileSystemNameFactory      = fileSystemNameFactory;
     _directoryChangeWatcher     = directoryChangeWatcherFactory.CreateWatcher();
     _fileSystemSnapshotBuilder  = fileSystemSnapshotBuilder;
     _snapshotOperationProcessor = snapshotOperationProcessor;
     _projectDiscovery           = projectDiscovery;
     _taskQueue = taskQueueFactory.CreateQueue();
     _directoryChangeWatcher.PathsChanged += DirectoryChangeWatcherOnPathsChanged;
     _fileSystemSnapshot = FileSystemTreeSnapshot.Empty;
 }
 public FileSystemProcessor(
     IFileSystemNameFactory fileSystemNameFactory,
     IProjectDiscovery projectDiscovery,
     IDirectoryChangeWatcherFactory directoryChangeWatcherFactory,
     ITaskQueueFactory taskQueueFactory,
     IFileSystemSnapshotBuilder fileSystemSnapshotBuilder,
     IOperationProcessor<SnapshotComputedEventArgs> snapshotOperationProcessor)
 {
     _fileSystemNameFactory = fileSystemNameFactory;
       _directoryChangeWatcher = directoryChangeWatcherFactory.CreateWatcher();
       _fileSystemSnapshotBuilder = fileSystemSnapshotBuilder;
       _snapshotOperationProcessor = snapshotOperationProcessor;
       _projectDiscovery = projectDiscovery;
       _taskQueue = taskQueueFactory.CreateQueue();
       _directoryChangeWatcher.PathsChanged += DirectoryChangeWatcherOnPathsChanged;
       _fileSystemSnapshot = FileSystemTreeSnapshot.Empty;
 }
        public FileSystemProcessor(
            IFileSystemNameFactory fileSystemNameFactory,
            IFileSystem fileSystem,
            IFileSystemSnapshotBuilder fileSystemSnapshotBuilder,
            IOperationProcessor operationProcessor,
            IProjectDiscovery projectDiscovery,
            IDirectoryChangeWatcherFactory directoryChangeWatcherFactory,
            ITaskQueueFactory taskQueueFactory)
        {
            _fileSystemNameFactory = fileSystemNameFactory;
              _fileSystem = fileSystem;
              _fileSystemSnapshotBuilder = fileSystemSnapshotBuilder;
              _operationProcessor = operationProcessor;
              _projectDiscovery = projectDiscovery;

              _taskQueue = taskQueueFactory.CreateQueue("FileSystemProcessor Task Queue");
              _fileSystemSnapshot = FileSystemTreeSnapshot.Empty;
              _directoryChangeWatcher = directoryChangeWatcherFactory.CreateWatcher();
              _directoryChangeWatcher.PathsChanged += DirectoryChangeWatcherOnPathsChanged;
        }
        public FileSystemProcessor(
            IFileSystemNameFactory fileSystemNameFactory,
            IFileSystem fileSystem,
            IFileSystemSnapshotBuilder fileSystemSnapshotBuilder,
            IOperationProcessor operationProcessor,
            IProjectDiscovery projectDiscovery,
            IDirectoryChangeWatcherFactory directoryChangeWatcherFactory,
            ITaskQueueFactory taskQueueFactory)
        {
            _fileSystemNameFactory     = fileSystemNameFactory;
            _fileSystem                = fileSystem;
            _fileSystemSnapshotBuilder = fileSystemSnapshotBuilder;
            _operationProcessor        = operationProcessor;
            _projectDiscovery          = projectDiscovery;

            _taskQueue              = taskQueueFactory.CreateQueue("FileSystemProcessor Task Queue");
            _fileSystemSnapshot     = FileSystemTreeSnapshot.Empty;
            _directoryChangeWatcher = directoryChangeWatcherFactory.CreateWatcher();
            _directoryChangeWatcher.PathsChanged += DirectoryChangeWatcherOnPathsChanged;
            _directoryChangeWatcher.Error        += DirectoryChangeWatcherOnError;
        }
Example #12
0
        public SearchEngine(
            IFileSystemSnapshotManager fileSystemSnapshotManager,
            IFileSystemNameFactory fileSystemNameFactory,
            ILongRunningFileSystemTaskQueue taskQueue,
            IFileDatabaseSnapshotFactory fileDatabaseSnapshotFactory,
            IProjectDiscovery projectDiscovery,
            ICompiledTextSearchDataFactory compiledTextSearchDataFactory,
            IOperationProcessor operationProcessor)
        {
            _fileSystemNameFactory         = fileSystemNameFactory;
            _taskQueue                     = taskQueue;
            _fileDatabaseSnapshotFactory   = fileDatabaseSnapshotFactory;
            _projectDiscovery              = projectDiscovery;
            _compiledTextSearchDataFactory = compiledTextSearchDataFactory;
            _operationProcessor            = operationProcessor;

            // Create a "Null" state
            _currentFileDatabase = _fileDatabaseSnapshotFactory.CreateEmpty();

            // Setup computing a new state everytime a new tree is computed.
            fileSystemSnapshotManager.SnapshotScanFinished += FileSystemSnapshotManagerOnSnapshotScanFinished;
            fileSystemSnapshotManager.FilesChanged         += FileSystemSnapshotManagerOnFilesChanged;
        }
Example #13
0
        public SearchEngine(
            IFileSystemProcessor fileSystemProcessor,
            IFileSystemNameFactory fileSystemNameFactory,
            ITaskQueueFactory taskQueueFactory,
            IFileDatabaseFactory fileDatabaseFactory,
            IProjectDiscovery projectDiscovery,
            ICompiledTextSearchDataFactory compiledTextSearchDataFactory,
            IOperationProcessor operationProcessor)
        {
            _fileSystemNameFactory         = fileSystemNameFactory;
            _taskQueue                     = taskQueueFactory.CreateQueue("SearchEngine Task Queue");
            _fileDatabaseFactory           = fileDatabaseFactory;
            _projectDiscovery              = projectDiscovery;
            _compiledTextSearchDataFactory = compiledTextSearchDataFactory;
            _operationProcessor            = operationProcessor;

            // Create a "Null" state
            _currentFileDatabase = _fileDatabaseFactory.CreateEmpty();

            // Setup computing a new state everytime a new tree is computed.
            fileSystemProcessor.SnapshotComputed += FileSystemProcessorOnSnapshotComputed;
            fileSystemProcessor.FilesChanged     += FileSystemProcessorOnFilesChanged;
        }
Example #14
0
        public SearchEngine(
            IFileSystemProcessor fileSystemProcessor,
            IFileSystemNameFactory fileSystemNameFactory,
            ICustomThreadPool customThreadPool,
            IFileDatabaseFactory fileDatabaseFactory,
            IProjectDiscovery projectDiscovery,
            ISearchStringParser searchStringParser,
            IOperationProcessor <OperationResultEventArgs> fileLoadingOperationProcessor)
        {
            _fileSystemNameFactory         = fileSystemNameFactory;
            _customThreadPool              = customThreadPool;
            _fileDatabaseFactory           = fileDatabaseFactory;
            _projectDiscovery              = projectDiscovery;
            _searchStringParser            = searchStringParser;
            _fileLoadingOperationProcessor = fileLoadingOperationProcessor;

            // Create a "Null" state
            _currentFileDatabase = _fileDatabaseFactory.CreateEmpty();

            // Setup computing a new state everytime a new tree is computed.
            fileSystemProcessor.SnapshotComputed += FileSystemProcessorOnSnapshotComputed;
            fileSystemProcessor.FilesChanged     += FileSystemProcessorOnFilesChanged;
        }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the TextProcessor class with the specified IOperationProcessor and MatchCountReplaceModel
 /// </summary>
 /// <param name="processor">Processing worker</param>
 /// <param name="data">Input search and replace string patterns</param>
 public TextProcessor(IOperationProcessor processor, MatchCountReplaceModel data) :
     this(processor)
 {
     CountReplaceData = data;
 }
Example #16
0
 /// <summary>
 /// Initializes a new instance of the TextProcessor class with the specified IOperationProcessor
 /// </summary>
 /// <param name="processor">Processing worker</param>
 public TextProcessor(IOperationProcessor processor)
 {
     worker = processor;
 }