public void Start(Cluster.Configuration config, List <NodeModel> nodes) { var dirs = config.FileSystemMapping.Select(_ => _.LocalPath); foreach (var dir in dirs) { try { var watcher = new FileSystemWatcher(dir) { NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName, IncludeSubdirectories = true }; watcher.Changed += OnChanged; watcher.Created += OnChanged; watcher.Deleted += OnChanged; watcher.Renamed += OnRenamed; watcher.EnableRaisingEvents = true; _watchers.Add(watcher); } catch (Exception ex) { ConsoleLogger.Log(ex.Message); } } _nodes = nodes; }
public static void SaveConfiguration(Cluster.Configuration model) { Prepare(); var text = JsonConvert.SerializeObject(model, Formatting.Indented); FileWithAcl.WriteAllText(IpFile, text, "644", "root", "wheel"); ConsoleLogger.Log("[cluster] configuration saved"); }
private void SaveFileSystemSync(Cluster.Configuration config, List <NodeModel> nodes) { Application.VfsWatcher.Stop(); Application.VfsWatcher.Start(config, nodes); }