示例#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);
        }
        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;
        }
示例#4
0
 public CacheServer(SystemConfiguration systemConfig)
 {
     config = systemConfig.Servers.First(kvp => kvp.Value.Type == ServerTypes.Cache).Value;
     bootstrapper = new ApiBootstrapper();
 }
示例#5
0
 public ServerFactory(SystemConfiguration configuration, AlgorithmFactory algoFactory, DataSource dataSource)
 {
     SystemConfig = configuration;
     AlgorithmFactory = algoFactory;
     DataSource = dataSource;
 }