public void Add(T nodeId) { if (store.ContainsKey(nodeId)) { return; } AddNode(nodeId); }
public bool ContainsBlock(Hash hash) { if (hash == null) { return(false); } return(_blocks.ContainsKey(hash)); }
public Archive FindArchive(Hash hash) { if (_archiveEntries.ContainsKey(hash)) { return(_archiveEntries.Get(hash)); } return(null); }
public void TestDBStorageContains() { _testStorage.Set("test1", "Value11"); bool result = _testStorage.ContainsKey("test1"); Assert.IsTrue(result); }
public bool DeleteArchive(Archive archive) { Throw.IfNull(archive, nameof(archive)); for (int i = 0; i < archive.BlockCount; i++) { var blockHash = archive.MerkleTree.GetHash(i); if (_archiveContents.ContainsKey(blockHash)) { _archiveContents.Remove(blockHash); } } _archiveEntries.Remove(archive.Hash); return(true); }
public Block FindBlockByHeight(BigInteger height) { if (_blockHeightMap.ContainsKey(height)) { var hash = _blockHeightMap[height]; return(FindBlockByHash(hash)); } return(null); // TODO Should thrown an exception? }
public Block FindTransactionBlock(Hash hash) { if (_transactionBlockMap.ContainsKey(hash)) { var blockHash = _transactionBlockMap[hash]; return(FindBlockByHash(blockHash)); } return(null); }
private string LookUpChainNameByAddress(Address address) { var key = ChainAddressMapKey + address.Text; if (_vars.ContainsKey(key)) { var bytes = _vars.Get(key); return(Encoding.UTF8.GetString(bytes)); } return(null); }
public void SetUp(RawlerBase rawler) { if (string.IsNullOrEmpty(this.ConsumerKey) || string.IsNullOrEmpty(this.ConsumerSecret)) { if (KeyValueStore.ContainsKey(rawler, "ConsumerKey", "ConsumerSecret")) { this.ConsumerKey = KeyValueStore.GetValueByKey(rawler, "ConsumerKey"); this.ConsumerSecret = KeyValueStore.GetValueByKey(rawler, "ConsumerSecret"); ReportManage.Report(rawler, "KeyValueStoreからのAPI Keyを使います", true, true); } else if (string.IsNullOrEmpty(SetTwitterApiKeys.consumerKey) || string.IsNullOrEmpty(SetTwitterApiKeys.consumerSecret)) { this.ConsumerKey = "gHVupgapEXlTZdu7rf3oOg"; this.ConsumerSecret = "YOicLtW8utx3NJyy88wtzq8QN3ilXeQoEGCPIJNzo"; ReportManage.Report(rawler, "RawlerのAPI Keyを使います", true, true); } else { this.ConsumerKey = SetTwitterApiKeys.consumerKey; this.ConsumerSecret = SetTwitterApiKeys.consumerSecret; } } }
public SpookOracle(Spook cli, Nexus nexus, Logger logger) : base(nexus) { this._cli = cli; nexus.Attach(this); platforms = new KeyValueStore <string, string>(CreateKeyStoreAdapter(StorageConst.Platform.ToString())); this.logger = logger; logger.Message("Platform count: " + platforms.Count); var nexusPlatforms = (nexus as Nexus).GetPlatforms(nexus.RootStorage); foreach (var nexusPlatform in nexusPlatforms) { if (!platforms.ContainsKey(nexusPlatform)) { platforms.Set(nexusPlatform, nexusPlatform); } _keyValueStore.Add(nexusPlatform + StorageConst.Block, new KeyValueStore <string, InteropBlock>(CreateKeyStoreAdapter(nexusPlatform + StorageConst.Block))); _keyValueStore.Add(nexusPlatform + StorageConst.Transaction, new KeyValueStore <string, InteropTransaction>(CreateKeyStoreAdapter(nexusPlatform + StorageConst.Transaction))); _keyValueStore.Add(nexusPlatform + StorageConst.CurrentHeight, new KeyValueStore <string, string>(CreateKeyStoreAdapter(nexusPlatform + StorageConst.CurrentHeight))); } }
public bool ContainsTransaction(Hash hash) { return(_transactions.ContainsKey(hash)); }
public bool HasContract(string contractName) { return(_contracts.ContainsKey(contractName)); }
public List <String> GetConfigurationItemArray(String key) { return((KeyValueStore.ContainsKey(key)) ? KeyValueStore[key].Split(';').Select(x => x.Trim()).ToList() : null); }