Exemple #1
0
 public void Add(T nodeId)
 {
     if (store.ContainsKey(nodeId))
     {
         return;
     }
     AddNode(nodeId);
 }
Exemple #2
0
        public bool ContainsBlock(Hash hash)
        {
            if (hash == null)
            {
                return(false);
            }

            return(_blocks.ContainsKey(hash));
        }
Exemple #3
0
        public Archive FindArchive(Hash hash)
        {
            if (_archiveEntries.ContainsKey(hash))
            {
                return(_archiveEntries.Get(hash));
            }

            return(null);
        }
Exemple #4
0
        public void TestDBStorageContains()
        {
            _testStorage.Set("test1", "Value11");
            bool result = _testStorage.ContainsKey("test1");

            Assert.IsTrue(result);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        public Block FindBlockByHeight(BigInteger height)
        {
            if (_blockHeightMap.ContainsKey(height))
            {
                var hash = _blockHeightMap[height];
                return(FindBlockByHash(hash));
            }

            return(null); // TODO Should thrown an exception?
        }
Exemple #7
0
        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);
        }
Exemple #9
0
 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;
         }
     }
 }
Exemple #10
0
        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)));
            }
        }
Exemple #11
0
 public bool ContainsTransaction(Hash hash)
 {
     return(_transactions.ContainsKey(hash));
 }
Exemple #12
0
 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);
 }