Пример #1
0
 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);
 }
Пример #2
0
        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);
        }
Пример #3
0
        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;
        }
Пример #5
0
 public CacheServer(SystemConfiguration systemConfig)
 {
     config = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Cache).Value;
     bootstrapper = new ApiBootstrapper();
 }
Пример #6
0
 public static Uri BuildUri(ServerConfiguration config)
 {
     var address = string.Format("http://{0}:{1}", config.IpAddress, config.Port);
     return new Uri(address);
 }