public IndexerClient(IndexerConfiguration configuration) { if(configuration == null) throw new ArgumentNullException("configuration"); _Configuration = configuration; BalancePartitionSize = 50; }
public static IndexerConfiguration FromConfiguration(IConfiguration configuration) { IndexerConfiguration indexerConfig = new IndexerConfiguration(); Fill(configuration, indexerConfig); return(indexerConfig); }
protected static void Fill(IndexerConfiguration config) { var account = GetValue("Azure.AccountName", true); var key = GetValue("Azure.Key", true); config.StorageCredentials = new StorageCredentials(account, key); config.StorageNamespace = GetValue("StorageNamespace", false); var network = GetValue("Bitcoin.Network", false) ?? "Main"; config.Network = network.Equals("main", StringComparison.OrdinalIgnoreCase) ? Network.Main : network.Equals("test", StringComparison.OrdinalIgnoreCase) ? Network.TestNet : network.Equals("seg", StringComparison.OrdinalIgnoreCase) ? Network.SegNet : network.Equals("regtest", StringComparison.OrdinalIgnoreCase) ? Network.RegTest : null; if (config.Network == null) throw new ConfigurationErrorsException("Invalid value " + network + " in appsettings (expecting Main, Test or Seg)"); config.Node = GetValue("Node", false); config.CheckpointSetName = GetValue("CheckpointSetName", false); if (string.IsNullOrWhiteSpace(config.CheckpointSetName)) config.CheckpointSetName = "default"; config.AzureStorageEmulatorUsed = bool.Parse(GetValue("AzureStorageEmulatorUsed", false)); }
protected static void Fill(IndexerConfiguration config) { var account = GetValue("Azure.AccountName", true); var key = GetValue("Azure.Key", true); config.StorageCredentials = new StorageCredentials(account, key); config.StorageNamespace = GetValue("StorageNamespace", false); var network = GetValue("Bitcoin.Network", false) ?? "Main"; config.Network = Network.GetNetwork(network); if (config.Network == null) { throw new ConfigurationErrorsException("Invalid value " + network + " in appsettings (expecting Main, Test or Seg)"); } config.Node = GetValue("Node", false); config.CheckpointSetName = GetValue("CheckpointSetName", false); if (string.IsNullOrWhiteSpace(config.CheckpointSetName)) { config.CheckpointSetName = "default"; } var emulator = GetValue("AzureStorageEmulatorUsed", false); if (!string.IsNullOrWhiteSpace(emulator)) { config.AzureStorageEmulatorUsed = bool.Parse(emulator); } }
public IndexerColoredTransactionRepository(IndexerConfiguration config) { if (config == null) throw new ArgumentNullException("config"); _Configuration = config; _Transactions = new IndexerTransactionRepository(config); }
public IndexerTransactionRepository(IndexerConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } _Configuration = config; }
public IndexerClient(IndexerConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } _Configuration = configuration; BalancePartitionSize = 50; }
public AzureIndexer(IndexerConfiguration configuration) { if(configuration == null) throw new ArgumentNullException("configuration"); TaskScheduler = TaskScheduler.Default; CheckpointInterval = TimeSpan.FromMinutes(15.0); _Configuration = configuration; FromHeight = 0; ToHeight = 99999999; }
public AzureIndexer(IndexerConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } TaskScheduler = TaskScheduler.Default; CheckpointInterval = TimeSpan.FromMinutes(15.0); _Configuration = configuration; FromHeight = 0; ToHeight = 99999999; }
public AzureIndexer(IndexerConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } CheckpointInterval = TimeSpan.FromMinutes(15.0); _Configuration = configuration; TaskCount = -1; FromHeight = 0; ToHeight = 99999999; }
protected static void Fill(IndexerConfiguration config) { var account = GetValue("Azure.AccountName", true); var key = GetValue("Azure.Key", true); config.StorageCredentials = new StorageCredentials(account, key); config.StorageNamespace = GetValue("StorageNamespace", false); var network = GetValue("Bitcoin.Network", false) ?? "Main"; config.Network = network.Equals("main", StringComparison.OrdinalIgnoreCase) ? Network.Main : network.Equals("test", StringComparison.OrdinalIgnoreCase) ? Network.TestNet : null; if (config.Network == null) { throw new ConfigurationErrorsException("Invalid value " + network + " in appsettings (expecting Main or Test)"); } config.MainDirectory = GetValue("MainDirectory", false); config.Node = GetValue("Node", false); }
public static AzureIndexer CreateIndexer(IConfiguration config) { var indexerConfig = IndexerConfiguration.FromConfiguration(config); return(indexerConfig.CreateIndexer()); }
public static IndexerConfiguration FromConfiguration() { IndexerConfiguration config = new IndexerConfiguration(); Fill(config); return config; }
protected static void Fill(IConfiguration config, IndexerConfiguration indexerConfig) { var account = GetValue(config, "Azure.AccountName", true); var key = GetValue(config, "Azure.Key", true); indexerConfig.StorageCredentials = new StorageCredentials(account, key); indexerConfig.StorageNamespace = GetValue(config, "StorageNamespace", false); var network = GetValue(config, "Bitcoin.Network", false); if (network == null) { network = GetValue(config, "Network", false); if (network == null) { network = "Main"; } else { var chainType = Network.GetNetwork(network)?.NetworkType; if (chainType == null) { throw new IndexerConfigurationErrorsException("Invalid value " + network + " in appsettings for key `Network` (expecting mainnet, testnet, regtest)"); } var chain = GetValue(config, "Chain", true); var networkSet = GetNetworkSet(chain); if (networkSet == null) { var parts = Altcoins.AltNetworkSets.GetAll().Select(s => s.CryptoCode).Concat(new[] { "BTC" }).ToArray(); throw new IndexerConfigurationErrorsException($"Invalid value {chain} in appsettings for key `Chain` (expecting {String.Join(", ", parts)})"); } network = networkSet.GetNetwork(chainType.Value).ToString(); } } indexerConfig.Network = Network.GetNetwork(network); if (indexerConfig.Network == null) { throw new IndexerConfigurationErrorsException("Invalid value " + network + " in appsettings for key `Bitcoin.Network` (expecting Main, Test or Seg)"); } // Make sure we don't use the same objects for different cryptos if (indexerConfig.Network.NetworkSet != NBitcoin.Bitcoin.Instance) { indexerConfig.StorageNamespace = indexerConfig.StorageNamespace ?? ""; indexerConfig.StorageNamespace = $"{network.ToString().Replace("-","")}{indexerConfig.StorageNamespace}"; } indexerConfig.Node = GetValue(config, "Node", false); indexerConfig.CheckpointSetName = GetValue(config, "CheckpointSetName", false); if (string.IsNullOrWhiteSpace(indexerConfig.CheckpointSetName)) { indexerConfig.CheckpointSetName = "default"; } var emulator = GetValue(config, "AzureStorageEmulatorUsed", false); if (!string.IsNullOrWhiteSpace(emulator)) { indexerConfig.AzureStorageEmulatorUsed = bool.Parse(emulator); } }