/// <summary> /// Creates a <see cref="HttpNodeJSService"/>. /// </summary> /// <param name="outOfProcessNodeJSServiceOptionsAccessor"></param> /// <param name="httpContentFactory"></param> /// <param name="embeddedResourcesService"></param> /// <param name="fileWatcherFactory"></param> /// <param name="monitorService"></param> /// <param name="taskService"></param> /// <param name="httpClientService"></param> /// <param name="jsonService"></param> /// <param name="nodeJSProcessFactory"></param> /// <param name="logger"></param> public HttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor, IHttpContentFactory httpContentFactory, IEmbeddedResourcesService embeddedResourcesService, IFileWatcherFactory fileWatcherFactory, IMonitorService monitorService, ITaskService taskService, IHttpClientService httpClientService, IJsonService jsonService, INodeJSProcessFactory nodeJSProcessFactory, ILogger <HttpNodeJSService> logger) : base(nodeJSProcessFactory, logger, outOfProcessNodeJSServiceOptionsAccessor, embeddedResourcesService, fileWatcherFactory, monitorService, taskService, typeof(HttpNodeJSService).GetTypeInfo().Assembly, SERVER_SCRIPT_NAME) { _httpClientService = httpClientService; _jsonService = jsonService; _logger = logger; _httpContentFactory = httpContentFactory; }
public QueryEvaluator( IFileWatcherFactory fileWatcherFactory, ILazyThumbnailFactory thumbnailFactory, IEntityManager entities, IExecutableQuery query) { _entities = entities; _fileWatcher = fileWatcherFactory.Create(); _thumbnailFactory = thumbnailFactory; Query = query; // initialize internal structures Cancellation = new CancellationTokenSource(); Comparer = new EntityViewComparer(Query.Comparer); _backBuffer = new List <Group>(); _frontBuffer = new List <Group>(); // register event handlers _fileWatcher.Renamed += FileWatcherOnRenamed; _fileWatcher.Deleted += FileWatcherOnDeleted; _fileWatcher.Created += FileWatcherOnCreated; _entities.Deleted += EntitiesOnDeleted; _entities.Changed += EntitiesOnChanged; _entities.Moved += EntitiesOnMoved; }
private HttpNodeJSService CreateHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor = null, IHttpContentFactory httpContentFactory = null, IEmbeddedResourcesService embeddedResourcesService = null, IFileWatcherFactory fileWatcherFactory = null, IMonitorService monitorService = null, ITaskService taskService = null, IHttpClientService httpClientService = null, IJsonService jsonService = null, INodeJSProcessFactory nodeProcessFactory = null, ILogger <HttpNodeJSService> logger = null) { if (logger == null) { Mock <ILogger <HttpNodeJSService> > mockLogger = _mockRepository.Create <ILogger <HttpNodeJSService> >(); logger = mockLogger.Object; } return(new HttpNodeJSService(outOfProcessNodeHostOptionsAccessor, httpContentFactory, embeddedResourcesService, fileWatcherFactory, monitorService, taskService, httpClientService, jsonService, nodeProcessFactory, logger)); }
public FileWatcherService(IFileWatcherFactory watcherFactory, TimeSpan quietPeriod) { this.watcherFactory = watcherFactory; Changes = changes .GroupBy(x => x.Path, StringComparer.InvariantCultureIgnoreCase) .Select(x => x.Sample(quietPeriod, ThreadPoolScheduler.Instance)) .SelectMany(x => x); }
public WatchService( IFolderSynchronizer folderSynchronizer, IFileWatcherFactory fileWatcherFactory, IFileEventDispatcher fileEventDispatcher ) { _folderSynchronizer = folderSynchronizer; _fileWatcherFactory = fileWatcherFactory; _fileEventDispatcher = fileEventDispatcher; }
public SourceWatcher(IBuildRunner buildRunner, IFileSystem fileSystem, IFileWatcherFactory fileWatcherFactory, GilesConfig config) { FileWatchers = new List<FileSystemWatcher>(); this.fileSystem = fileSystem; this.buildRunner = buildRunner; this.fileWatcherFactory = fileWatcherFactory; this.config = config; buildDelayTimer = new Timer { AutoReset = false, Enabled = false, Interval = config.BuildDelay }; config.PropertyChanged += config_PropertyChanged; buildDelayTimer.Elapsed += (sender, e) => RunNow(); }
public QueryViewManager( IQueryViewRepository queryViews, IFileSystem fileSystem, IFileWatcherFactory fileWatcherFactory) { _queryViews = queryViews; _fileSystem = fileSystem; _fileWatcher = fileWatcherFactory.Create(); _fileWatcher.Deleted += FileWatcherOnDeleted; _fileWatcher.Renamed += FileWatcherOnRenamed; _fileWatcher.Changed += FileWatcherOnChanged; }
public SourceWatcher(IBuildRunner buildRunner, IFileSystem fileSystem, IFileWatcherFactory fileWatcherFactory, GilesConfig config) { FileWatchers = new List <FileSystemWatcher>(); this.fileSystem = fileSystem; this.buildRunner = buildRunner; this.fileWatcherFactory = fileWatcherFactory; this.config = config; buildDelayTimer = new Timer { AutoReset = false, Enabled = false, Interval = config.BuildDelay }; config.PropertyChanged += config_PropertyChanged; buildDelayTimer.Elapsed += (sender, e) => RunNow(); }
/// <summary> /// Creates an <see cref="OutOfProcessNodeJSService"/> instance. /// </summary> /// <param name="nodeProcessFactory"></param> /// <param name="logger"></param> /// <param name="optionsAccessor"></param> /// <param name="embeddedResourcesService"></param> /// <param name="fileWatcherFactory"></param> /// <param name="monitorService"></param> /// <param name="taskService"></param> /// <param name="serverScriptAssembly"></param> /// <param name="serverScriptName"></param> protected OutOfProcessNodeJSService(INodeJSProcessFactory nodeProcessFactory, ILogger logger, IOptions <OutOfProcessNodeJSServiceOptions> optionsAccessor, IEmbeddedResourcesService embeddedResourcesService, IFileWatcherFactory fileWatcherFactory, IMonitorService monitorService, ITaskService taskService, Assembly serverScriptAssembly, string serverScriptName) : this(nodeProcessFactory, logger, optionsAccessor, embeddedResourcesService, serverScriptAssembly, serverScriptName) { _fileWatcherFactory = fileWatcherFactory; _monitorService = monitorService; _taskService = taskService; (_trackInvokeTasks, _trackedInvokeTasks, _invokeTaskCreationCountdown) = InitializeFileWatching(); }
private ExposedHttpNodeJSService CreateHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeHostOptionsAccessor = null, IHttpContentFactory httpContentFactory = null, IEmbeddedResourcesService embeddedResourcesService = null, IFileWatcherFactory fileWatcherFactory = null, IMonitorService monitorService = null, ITaskService taskService = null, IHttpClientService httpClientService = null, IJsonService jsonService = null, INodeJSProcessFactory nodeProcessFactory = null, ILogger <HttpNodeJSService> logger = null, StringBuilder loggerStringBuilder = null) { if (logger == null) { // Log output if (loggerStringBuilder != null) { var services = new ServiceCollection(); services.AddLogging(lb => { lb. AddProvider(new StringBuilderProvider(loggerStringBuilder)). AddFilter <StringBuilderProvider>((LogLevel LogLevel) => LogLevel >= LogLevel.Trace); }); logger = services.BuildServiceProvider().GetRequiredService <ILogger <HttpNodeJSService> >(); } else { Mock <ILogger <HttpNodeJSService> > mockLogger = _mockRepository.Create <ILogger <HttpNodeJSService> >(); logger = mockLogger.Object; } } return(new ExposedHttpNodeJSService(outOfProcessNodeHostOptionsAccessor, httpContentFactory, embeddedResourcesService, fileWatcherFactory, monitorService, taskService, httpClientService, jsonService, nodeProcessFactory, logger)); }
public ConflictFileWatcher( ISyncthingManager syncthingManager, IConflictFileManager conflictFileManager, IFileWatcherFactory fileWatcherFactory) { this.syncthingManager = syncthingManager; this.conflictFileManager = conflictFileManager; this.fileWatcherFactory = fileWatcherFactory; this.syncthingManager.StateChanged += this.SyncthingStateChanged; this.syncthingManager.Folders.FoldersChanged += this.FoldersChanged; this.backoffTimer = new System.Timers.Timer() // Interval will be set when it's started { AutoReset = false, }; this.backoffTimer.Elapsed += (o, e) => { this.RefreshConflictedFiles(); }; }
/// <summary> /// Creates an <see cref="HttpNodeJSService"/>. /// </summary> /// <param name="outOfProcessNodeJSServiceOptionsAccessor">The <see cref="OutOfProcessNodeJSServiceOptions"/> accessor.</param> /// <param name="httpNodeJSServiceOptionsAccessor">The <see cref="HttpNodeJSServiceOptions"/> accessor.</param> /// <param name="httpContentFactory">The factory for creating <see cref="HttpContent"/>s.</param> /// <param name="embeddedResourcesService">The service for retrieving NodeJS Http server scripts.</param> /// <param name="fileWatcherFactory">The service for creating <see cref="IFileWatcher"/>s</param> /// <param name="monitorService">The service for lock-based thread synchronization.</param> /// <param name="taskService">The service for utilizing tasks.</param> /// <param name="httpClientService">The service for utilizing <see cref="HttpClient"/>.</param> /// <param name="jsonService">The service for JSON serialization and deserialization.</param> /// <param name="nodeJSProcessFactory">The factory for creating <see cref="NodeJSProcess"/>s.</param> /// <param name="logger">The logger for the instance.</param> public HttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor, IOptions <HttpNodeJSServiceOptions> httpNodeJSServiceOptionsAccessor, IHttpContentFactory httpContentFactory, IEmbeddedResourcesService embeddedResourcesService, IFileWatcherFactory fileWatcherFactory, IMonitorService monitorService, ITaskService taskService, IHttpClientService httpClientService, IJsonService jsonService, INodeJSProcessFactory nodeJSProcessFactory, ILogger <HttpNodeJSService> logger) : base(nodeJSProcessFactory, logger, outOfProcessNodeJSServiceOptionsAccessor, embeddedResourcesService, fileWatcherFactory, monitorService, taskService, typeof(HttpNodeJSService).GetTypeInfo().Assembly, #if NETCOREAPP3_1 || NET5_0_OR_GREATER httpNodeJSServiceOptionsAccessor.Value.Version == HttpVersion.Version20 ? HTTP20_SERVER_SCRIPT_NAME : HTTP11_SERVER_SCRIPT_NAME)
public ExposedHttpNodeJSService(IOptions <OutOfProcessNodeJSServiceOptions> outOfProcessNodeJSServiceOptionsAccessor, IHttpContentFactory httpContentFactory, IEmbeddedResourcesService embeddedResourcesService, IFileWatcherFactory fileWatcherFactory, IMonitorService monitorService, ITaskService taskService, IHttpClientService httpClientService, IJsonService jsonService, INodeJSProcessFactory nodeJSProcessFactory, ILogger <HttpNodeJSService> logger) : base(outOfProcessNodeJSServiceOptionsAccessor, httpContentFactory, embeddedResourcesService, fileWatcherFactory, monitorService, taskService, httpClientService, jsonService, nodeJSProcessFactory, logger) { }
// Constructors public FileManager(IFileConfigurationReader fileConfigurationReader, IFileConfigurationWriter fileConfigurationWriter, IFileWatcherFactory fileWatcherFactory, IFileHandlingStrategySelector fileHandlingStrategySelector, IFileRestore fileRestore, ITransactionWriter transactionWriter, IConfigFilePathLocator configFilePathLocator) { _configFilePathLocator = configFilePathLocator; _transactionWriter = transactionWriter; _fileRestore = fileRestore; _fileHandlingStrategySelector = fileHandlingStrategySelector; _fileWatchers = new List <IFileWatcher>(); _fileConfigurationReader = fileConfigurationReader; _fileConfigurationWriter = fileConfigurationWriter; _fileWatcherFactory = fileWatcherFactory; _configuration = _fileConfigurationReader.Read(); foreach (var current in _configuration) { CreateFileWatcher(current); } }
public ConflictFileWatcher( ISyncthingManager syncthingManager, IConflictFileManager conflictFileManager, IFileWatcherFactory fileWatcherFactory) { this.syncthingManager = syncthingManager; this.conflictFileManager = conflictFileManager; this.fileWatcherFactory = fileWatcherFactory; this.syncthingManager.StateChanged += this.SyncthingStateChanged; this.syncthingManager.Folders.FoldersChanged += this.FoldersChanged; this.backoffTimer = new System.Timers.Timer() // Interval will be set when it's started { AutoReset = false, }; this.backoffTimer.Elapsed += (o, e) => { this.RefreshConflictedFiles(); }; }
public QueueWatcherFactory(IFileWatcherFactory fileWatcherFactory, IMessageProcessorFactory messageProcessorFactory) { this.fileWatcherFactory = fileWatcherFactory; this.messageProcessorFactory = messageProcessorFactory; }
public ServerMesssageService(IFileWatcherFactory fileWatcherFactory, IMessageProcessorFactory messageProcessorFactory) : base(fileWatcherFactory, messageProcessorFactory) { }
public BaseProcessorService(IFileWatcherFactory fileWatcherFactory, IMessageProcessorFactory messageProcessorFactory) { this.messageProcessorFactory = messageProcessorFactory; this.fileWatcherFactory = fileWatcherFactory; }
public QueryEvaluatorFactory(IFileWatcherFactory fileWatcherFactory, ILazyThumbnailFactory thumbnailFactory, IEntityManager entities) { _fileWatcherFactory = fileWatcherFactory; _thumbnailFactory = thumbnailFactory; _entities = entities; }