Ejemplo n.º 1
0
 public void Initialize()
 {
     var keystoreConfig = new KeyStoreConfig();
     var networkConfig  = new NetworkConfig();
     var jsonRpcConfig  = new JsonRpcConfig();
     var statsConfig    = new StatsConfig();
 }
Ejemplo n.º 2
0
        public void Initialize()
        {
            NetworkNodeDecoder.Init();
            var privateKey = new PrivateKey(TestPrivateKeyHex);

            _publicKey = privateKey.PublicKey;
            var logManager = NullLogManager.Instance;

            IDiscoveryConfig discoveryConfig = new DiscoveryConfig();

            discoveryConfig.PongTimeout = 100;

            IStatsConfig statsConfig = new StatsConfig();

            _messageSender = Substitute.For <IMessageSender>();
            var calculator = new NodeDistanceCalculator(discoveryConfig);

            _nodeTable = new NodeTable(calculator, discoveryConfig, logManager);
            _nodeTable.Initialize(TestItem.PublicKeyA);

            _timestamp = new Timestamp();

            var evictionManager  = new EvictionManager(_nodeTable, logManager);
            var lifecycleFactory = new NodeLifecycleManagerFactory(_nodeTable, new DiscoveryMessageFactory(_timestamp), evictionManager, new NodeStatsManager(statsConfig, logManager), discoveryConfig, logManager);

            _nodes = new[] { new Node("192.168.1.18", 1), new Node("192.168.1.19", 2) };

            IFullDb nodeDb = new SimpleFilePublicKeyDb("test_db", logManager);

            _discoveryManager = new DiscoveryManager(lifecycleFactory, _nodeTable, new NetworkStorage(nodeDb, logManager), discoveryConfig, logManager);
            _discoveryManager.MessageSender = _messageSender;
        }
Ejemplo n.º 3
0
        public void Initialize()
        {
            NetworkNodeDecoder.Init();
            var privateKey = new PrivateKey(TestPrivateKeyHex);

            _publicKey = privateKey.PublicKey;
            var logManager = NullLogManager.Instance;

            IKeyStoreConfig keyStoreConfig = new KeyStoreConfig();
            INetworkConfig  networkConfig  = new NetworkConfig();

            networkConfig.PongTimeout = 100;
            IStatsConfig statsConfig = new StatsConfig();

            _messageSender = Substitute.For <IMessageSender>();
            var calculator = new NodeDistanceCalculator(networkConfig);


            _nodeTable = new NodeTable(new FileKeyStore(keyStoreConfig, new EthereumJsonSerializer(), new AesEncrypter(keyStoreConfig, logManager), new CryptoRandom(), logManager), calculator, networkConfig, logManager);
            _nodeTable.Initialize(TestItem.PublicKeyA);

            _timestamp = new Timestamp();

            var evictionManager  = new EvictionManager(_nodeTable, logManager);
            var lifecycleFactory = new NodeLifecycleManagerFactory(_nodeTable, new DiscoveryMessageFactory(networkConfig, _timestamp), evictionManager, new NodeStatsManager(statsConfig, logManager), networkConfig, logManager);

            _nodes = new[] { new Node("192.168.1.18", 1), new Node("192.168.1.19", 2) };

            _discoveryManager = new DiscoveryManager(lifecycleFactory, _nodeTable, new NetworkStorage("test", networkConfig, logManager, new PerfService(logManager)), networkConfig, logManager);
            _discoveryManager.MessageSender = _messageSender;
        }
Ejemplo n.º 4
0
        protected override void OnInitialize(ModuleConfiguration configuration)
        {
            StatsConfig statsConfig = configuration as StatsConfig;

            Health  = new Stat(statsConfig.MaxHealth, statsConfig.HasHealth);
            Stamina = new Stat(statsConfig.MaxStamina, statsConfig.HasStamina);
        }
Ejemplo n.º 5
0
        public void Initialize()
        {
            var nodeFactory = new NodeFactory(LimboLogs.Instance);

            _node   = nodeFactory.CreateNode("192.1.1.1", 3333);
            _config = new StatsConfig();
            _config.CaptureNodeLatencyStatsEventHistory = true;
        }
        public void Initialize()
        {
            var keystoreConfig = new KeyStoreConfig();
            var networkConfig  = new NetworkConfig();
            var jsonRpcConfig  = new JsonRpcConfig();
            var statsConfig    = new StatsConfig();

            _configProvider = new JsonConfigProvider("SampleJsonConfig.cfg");
        }
Ejemplo n.º 7
0
        public void Initialize()
        {
            var         nodeFactory = new NodeFactory();
            var         node        = nodeFactory.CreateNode("192.1.1.1", 3333);
            StatsConfig config      = new StatsConfig();

            config.CaptureNodeLatencyStatsEventHistory = true;
            _nodeStats = new NodeStats(node, config, NullLogManager.Instance);
        }
Ejemplo n.º 8
0
        protected void Application_Start()
        {
            // Initialize log4net
            InitializeLogging();

            // Initialize DI

            // Using implicit container creation
            //GlobalConfiguration.Configuration.UseStructureMap(ServiceConfig.RegisterServices);

            // Using explicit container creation
            var container = CreateContainer();

            GlobalConfiguration.Configuration.UseStructureMap(container);

            // Web API configuration
            GlobalConfiguration.Configure(WebApiConfig.Register);

            // Enable (unhandled) exception handling
            GlobalConfiguration.Configure(ExceptionsConfig.Register);

            // Enable stats and health checks
            GlobalConfiguration.Configure(config => StatsConfig.Register(config, GetApplicationHealthChecks));
        }
Ejemplo n.º 9
0
 public void Initialize()
 {
     _node   = new Node("192.1.1.1", 3333);
     _config = new StatsConfig();
     _config.CaptureNodeLatencyStatsEventHistory = true;
 }
Ejemplo n.º 10
0
 public IAsyncAction SetStatsConfigAsync(StatsConfig config)
 {
     return(InvokeHubChannelAsync <IMediaSettingsChannel>(config).AsTask().AsAsyncAction());
 }
 public IAsyncAction SetStatsConfigAsync(StatsConfig config)
 {
     StatsConfig = config;
     return(Task.CompletedTask.AsAsyncAction());
 }