Пример #1
0
        private void ConfigureDataStorage(IServiceCollection services)
        {
            DataStorageConfiguration dataStorageConfiguration =
                Configuration.GetSection("DataStorageConfiguration").Get <DataStorageConfiguration>();

            services.AddSingleton(dataStorageConfiguration);
        }
Пример #2
0
        public void TestIgniteStartsFromSpringXml()
        {
            // When Spring XML is used, .NET overrides Spring.
            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
            {
                DataStorageConfiguration = null,
                SpringConfigUrl = @"Config\spring-test.xml",
                NetworkSendRetryDelay = TimeSpan.FromSeconds(45),
                MetricsHistorySize = 57
            };

            using (var ignite = Ignition.Start(cfg))
            {
                var resCfg = ignite.GetConfiguration();

                Assert.AreEqual(45, resCfg.NetworkSendRetryDelay.TotalSeconds);  // .NET overrides XML
                Assert.AreEqual(2999, resCfg.NetworkTimeout.TotalMilliseconds);  // Not set in .NET -> comes from XML
                Assert.AreEqual(57, resCfg.MetricsHistorySize);  // Only set in .NET

                var disco = resCfg.DiscoverySpi as TcpDiscoverySpi;
                Assert.IsNotNull(disco);
                Assert.AreEqual(TimeSpan.FromMilliseconds(300), disco.SocketTimeout);

                // DataStorage defaults.
                var dsCfg = new DataStorageConfiguration
                {
                    DefaultDataRegionConfiguration = new DataRegionConfiguration
                    {
                        Name = "default"
                    }
                };
                AssertExtensions.ReflectionEqual(dsCfg, resCfg.DataStorageConfiguration);
            }
        }
Пример #3
0
        /// <summary>
        /// Checks the default properties.
        /// </summary>
        /// <param name="cfg">Config.</param>
        private static void CheckDefaultProperties(DataStorageConfiguration cfg)
        {
            Assert.AreEqual(DataStorageConfiguration.DefaultTlbSize, cfg.WalThreadLocalBufferSize);
            Assert.AreEqual(DataStorageConfiguration.DefaultCheckpointFrequency, cfg.CheckpointFrequency);
            Assert.AreEqual(DataStorageConfiguration.DefaultCheckpointThreads, cfg.CheckpointThreads);
            Assert.AreEqual(DataStorageConfiguration.DefaultLockWaitTime, cfg.LockWaitTime);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalFlushFrequency, cfg.WalFlushFrequency);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalFsyncDelayNanos, cfg.WalFsyncDelayNanos);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalHistorySize, cfg.WalHistorySize);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalRecordIteratorBufferSize,
                            cfg.WalRecordIteratorBufferSize);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalSegmentSize, cfg.WalSegmentSize);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalSegments, cfg.WalSegments);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalMode, cfg.WalMode);
            Assert.IsFalse(cfg.MetricsEnabled);
            Assert.AreEqual(DataStorageConfiguration.DefaultMetricsSubIntervalCount, cfg.MetricsSubIntervalCount);
            Assert.AreEqual(DataStorageConfiguration.DefaultMetricsRateTimeInterval, cfg.MetricsRateTimeInterval);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalPath, cfg.WalPath);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalArchivePath, cfg.WalArchivePath);
            Assert.AreEqual(DataStorageConfiguration.DefaultCheckpointWriteOrder, cfg.CheckpointWriteOrder);
            Assert.AreEqual(DataStorageConfiguration.DefaultWriteThrottlingEnabled, cfg.WriteThrottlingEnabled);

            Assert.AreEqual(DataStorageConfiguration.DefaultSystemRegionInitialSize, cfg.SystemRegionInitialSize);
            Assert.AreEqual(DataStorageConfiguration.DefaultSystemRegionMaxSize, cfg.SystemRegionMaxSize);
            Assert.AreEqual(DataStorageConfiguration.DefaultPageSize, cfg.PageSize);
            Assert.AreEqual(DataStorageConfiguration.DefaultConcurrencyLevel, cfg.ConcurrencyLevel);
            Assert.AreEqual(DataStorageConfiguration.DefaultWalAutoArchiveAfterInactivity,
                            cfg.WalAutoArchiveAfterInactivity);
        }
Пример #4
0
        public SystemService(
            ILogger <SystemService> logger,
            IServiceProvider serviceProvider,
            IXNodeConnectionRepository xNodeConnectionRepository,
            SystemIOService systemIOService,
            TenantIOService tenantIOService,
            ProducerIOService producerIOService,
            ConsumerIOService consumerIOService,
            MessageIOService messageIOService2)
        {
            _logger          = logger;
            _serviceProvider = serviceProvider;

            _xNodeConnectionRepository = xNodeConnectionRepository;
            _systemIOService           = systemIOService;
            _tenantIOService           = tenantIOService;
            _producerIOService         = producerIOService;
            _consumerIOService         = consumerIOService;
            _messageIOService2         = messageIOService2;
            nodes       = _serviceProvider.GetService(typeof(List <XNodeConfiguration>)) as List <XNodeConfiguration>;
            dataStorage = _serviceProvider.GetService(typeof(DataStorageConfiguration)) as DataStorageConfiguration;
            agent       = _serviceProvider.GetService(typeof(AgentConfiguration)) as AgentConfiguration;
            partition   = _serviceProvider.GetService(typeof(PartitionConfiguration)) as PartitionConfiguration;
            credentials = _serviceProvider.GetService(typeof(CredentialsConfiguration)) as CredentialsConfiguration;


            DoFileConfiguration();

            UpdateXNodesConfiguration();
            UpdateDataStorageConfiguration();
            UpdateCredentials();

            InitializeServices();
        }
Пример #5
0
 /// <summary>
 /// Creates a new instance of <see cref="ImageController"/>
 /// </summary>
 /// <param name="azureBlobStorageService"></param>
 /// <param name="dataStorageConfiguration"></param>
 /// <param name="blazorRestaurantDbContext"></param>
 public ImageController(AzureBlobStorageService azureBlobStorageService,
                        DataStorageConfiguration dataStorageConfiguration, BlazorRestaurantDbContext blazorRestaurantDbContext)
 {
     this.AzureBlobStorageService   = azureBlobStorageService;
     this.DataStorageConfiguration  = dataStorageConfiguration;
     this.BlazorRestaurantDbContext = blazorRestaurantDbContext;
 }
Пример #6
0
        private static void BindDataStorageConfiguration(this IServiceCollection services, IConfiguration configuration)
        {
            var storageConfiguration = new DataStorageConfiguration();

            configuration.Bind("DataStorage", storageConfiguration);
            services.AddSingleton(storageConfiguration);
        }
Пример #7
0
        public XNodeEventService(ILogger <SystemService> logger,
                                 string agentId,
                                 XNodeConfiguration nodeConfig,
                                 DataStorageConfiguration dataStorageConfig,
                                 AgentConfiguration agentConfiguration,
                                 IXNodeConnectionRepository xNodeConnectionRepository,
                                 TenantIOService tenantIOService,
                                 ProducerIOService producerIOService,
                                 ConsumerIOService consumerIOService,
                                 MessageIOService messageIOService)
        {
            this.logger = logger;
            this.xNodeConnectionRepository = xNodeConnectionRepository;
            this.tenantIOService           = tenantIOService;
            this.producerIOService         = producerIOService;
            this.consumerIOService         = consumerIOService;
            this.messageIOService          = messageIOService;
            this.agentId    = agentId;
            this.nodeConfig = nodeConfig;

            var provider = new XNodeConnectionProvider(nodeConfig, dataStorageConfig, agentConfiguration, agentId);

            _connection = provider.GetHubConnection();

            _connection.On <AgentConnectedArgs>("StorageConnected", connectedArgs => StorageConnected?.Invoke(connectedArgs));
            _connection.On <AgentDisconnectedArgs>("StorageDisconnected", disconnectedArgs => StorageDisconnected?.Invoke(disconnectedArgs));

            _connection.On <TenantCreatedArgs>("TenantCreated", tenantCreated => TenantCreated?.Invoke(tenantCreated));
            _connection.On <TenantUpdatedArgs>("TenantUpdated", tenantUpdated => TenantUpdated?.Invoke(tenantUpdated));

            _connection.On <ProductCreatedArgs>("ProductCreated", productCreated => ProductCreated?.Invoke(productCreated));
            _connection.On <ProductUpdatedArgs>("ProductUpdated", productUpdated => ProductUpdated?.Invoke(productUpdated));

            _connection.On <ComponentCreatedArgs>("ComponentCreated", componentCreated => ComponentCreated?.Invoke(componentCreated));
            _connection.On <ComponentUpdatedArgs>("ComponentUpdated", componentUpdated => ComponentUpdated?.Invoke(componentUpdated));

            _connection.On <TopicCreatedArgs>("TopicCreated", topicCreated => TopicCreated?.Invoke(topicCreated));
            _connection.On <TopicUpdatedArgs>("TopicUpdated", topicUpdated => TopicUpdated?.Invoke(topicUpdated));

            _connection.On <ProducerConnectedArgs>("ProducerConnected", producerConnected => ProducerConnected?.Invoke(producerConnected));
            _connection.On <ProducerDisconnectedArgs>("ProducerDisconnected", producerDisconnected => ProducerDisconnected?.Invoke(producerDisconnected));

            _connection.On <ConsumerConnectedArgs>("ConsumerConnected", consumerConnected => ConsumerConnected?.Invoke(consumerConnected));
            _connection.On <ConsumerDisconnectedArgs>("ConsumerDisconnected", consumerDisconnected => ConsumerDisconnected?.Invoke(consumerDisconnected));
            _connection.On <ConsumerConnectedArgs>("ConsumerUnacknowledgedMessagesRequested", consumerConnected => ConsumerUnacknowledgedMessagesRequested?.Invoke(consumerConnected));
            _connection.On <MessageAcknowledgedArgs>("MessageAcknowledged", messageAcked => MessageAcknowledged?.Invoke(messageAcked));

            _connection.On <MessageStoredArgs>("MessageStored", msgStored => MessageStored?.Invoke(msgStored));

            InitializeEventHandlers();

            ConnectAsync();

            xNodeConnectionRepository.AddService(nodeConfig.ServiceUrl, agentId, this);
        }
Пример #8
0
 /// <summary>
 /// Initializes <see cref="FilesaveController"/>
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="azureBlobStorageService"></param>
 /// <param name="dataStorageConfiguration"></param>
 /// <param name="currentUserProvider"></param>
 public FilesaveController(
     ILogger <FilesaveController> logger,
     AzureBlobStorageService azureBlobStorageService,
     DataStorageConfiguration dataStorageConfiguration,
     ICurrentUserProvider currentUserProvider)
 {
     this.logger = logger;
     this.AzureBlobStorageService  = azureBlobStorageService;
     this.DataStorageConfiguration = dataStorageConfiguration;
     this.CurrentUserProvider      = currentUserProvider;
 }
 public XNodeConnectionProvider(XNodeConfiguration nodeConfig,
                                DataStorageConfiguration dataStorageConfig,
                                AgentConfiguration agentConfiguration,
                                string agentId)
 {
     this.nodeConfig         = nodeConfig;
     this.dataStorageConfig  = dataStorageConfig;
     this.agentConfiguration = agentConfiguration;
     this.agentId            = agentId;
     ConnectToXNode();
 }
Пример #10
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            var dataStorageConfiguration = new DataStorageConfiguration(
                Configuration.GetConnectionString("DefaultConnection"));

            // Setting Data Storage Configuration Dependency
            services.AddSingleton(dataStorageConfiguration);

            // Setting Address Repository Dependency
            services.AddSingleton <IAddressRepository, AddressRepository>();
        }
 public static bool WriteStorageConfigurationFromFile(DataStorageConfiguration storageConfiguration)
 {
     if (File.Exists(SystemLocations.GetStorageCredentialsConfigFile()))
     {
         File.Delete(SystemLocations.GetStorageCredentialsConfigFile());
     }
     try
     {
         File.WriteAllText(SystemLocations.GetStorageCredentialsConfigFile(), storageConfiguration.ToJsonAndEncrypt());
         return(true);
     }
     catch (System.Exception)
     {
         return(false);
     }
 }
Пример #12
0
        private void UpdateDataStorageConfiguration()
        {
            DataStorageConfiguration newConfig = dataStorage;

            if (File.Exists(SystemLocations.GetStorageCredentialsConfigFile()))
            {
                var actualConfig = SystemConfigurationReader.ReadStorageConfigurationFromFile();
                if (newConfig.Name != actualConfig.Name || newConfig.Status != actualConfig.Status)
                {
                    SystemConfigurationWriter.WriteStorageConfigurationFromFile(newConfig);
                }
            }
            else
            {
                SystemConfigurationWriter.WriteStorageConfigurationFromFile(newConfig);
            }
        }
Пример #13
0
 public VideoService(AzureVideoIndexerService azureVideoIndexerService, AzureBlobStorageService azureBlobStorageService,
                     DataStorageConfiguration dataStorageConfiguration, ICurrentUserProvider currentUserProvider,
                     FairplaytubeDatabaseContext fairplaytubeDatabaseContext,
                     AzureVideoIndexerConfiguration azureVideoIndexerConfiguration,
                     CustomHttpClient customHttpClient,
                     IHubContext <NotificationHub, INotificationHub> hubContext,
                     EmailService emailService,
                     IConfiguration configuration)
 {
     this.AzureVideoIndexerService       = azureVideoIndexerService;
     this.AzureBlobStorageService        = azureBlobStorageService;
     this.DataStorageConfiguration       = dataStorageConfiguration;
     this.CurrentUserProvider            = currentUserProvider;
     this.FairplaytubeDatabaseContext    = fairplaytubeDatabaseContext;
     this.AzureVideoIndexerConfiguration = azureVideoIndexerConfiguration;
     this.CustomHttpClient = customHttpClient;
     this.HubContext       = hubContext;
     this.EmailService     = emailService;
     this.Configuration    = configuration;
 }
Пример #14
0
 public AddressRepository(DataStorageConfiguration dataStorageConfiguration)
 {
     _dataStorageConfiguration = dataStorageConfiguration;
 }