public MediatorServer(SystemConfiguration systemConfig, DataSource dataSource) { config = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Mediator).Value; controller = new Controller(dataSource); // bootstrapper = new MediatorBootstrapper(controller); bootstrapper = new ApiBootstrapper(controller); }
public ComputeServer(SystemConfiguration systemConfig, string name, AlgorithmFactory algoFactory) { uuid = Guid.NewGuid().ToString(); this.name = name; config = systemConfig.Servers[name]; var mediatorConfig = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Mediator).Value; mediator = new MediatorConnector(mediatorConfig); workerPool = new WorkerPool(config.PoolSize, uuid, mediator); //bootstrapper = new ComputeBootstrapper(this, workerPool); bootstrapper = new ApiBootstrapper(this, workerPool, algoFactory); }
public ComputeConnector(string uuid, string name, ServerConfiguration computeInfo) { UUID = uuid; Name = name; this.computeNodeInfo = computeInfo; serviceInterface = new ServiceInterface(computeNodeInfo.IpAddress, computeNodeInfo.Port); workers = new List<WorkerAdapter>(); for (int i = 0; i < computeInfo.PoolSize; i++) { var workerInfo = new WorkerAdapter(); workerInfo.Id = string.Format("Worker_{0}", i); workerInfo.Status = RunnerStatus.Idle; workerInfo.Connector = this; workers.Add(workerInfo); } }
public SystemConfiguration GetDummyConfiguration() { var dummyMasterConfig = new ServerConfiguration { Type = ServerTypes.Mediator, IpAddress = "127.0.0.1", Port = 8080 }; var dummySlaveConfig = new ServerConfiguration { Type = ServerTypes.Compute, IpAddress = "127.0.0.1", Port = 8081 }; var servers = new Dictionary<string, ServerConfiguration>() { { "master", dummyMasterConfig }, { "slave", dummySlaveConfig } }; var dummySystemConfig = new SystemConfiguration(); dummySystemConfig.Servers = servers; var configJson = JsonConvert.SerializeObject(dummySystemConfig); Console.WriteLine(configJson); return dummySystemConfig; }
public CacheServer(SystemConfiguration systemConfig) { config = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Cache).Value; bootstrapper = new ApiBootstrapper(); }
public static Uri BuildUri(ServerConfiguration config) { var address = string.Format("http://{0}:{1}", config.IpAddress, config.Port); return new Uri(address); }