Ejemplo n.º 1
0
        public virtual void Commit()
        {
            ContractStateRepository parentSync = this.parent == null ? this : this.parent;

            lock (parentSync)
            {
                this.storageCache.Flush();
                this.codeCache.Flush();
                this.vinCache.Flush();
                this.accountStateCache.Flush();
            }
        }
Ejemplo n.º 2
0
        public IContractStateRepository StartTracking()
        {
            ISource <byte[], AccountState>          trackAccountStateCache = new WriteCache <AccountState>(this.accountStateCache, WriteCache <AccountState> .CacheType.SIMPLE);
            ISource <byte[], ContractUnspentOutput> trackVinCache          = new WriteCache <ContractUnspentOutput>(this.vinCache, WriteCache <ContractUnspentOutput> .CacheType.SIMPLE);
            ISource <byte[], byte[]> trackCodeCache = new WriteCache <byte[]>(this.codeCache, WriteCache <byte[]> .CacheType.SIMPLE);
            MultiCache <ICachedSource <byte[], byte[]> > trackStorageCache = new RealMultiCache(this.storageCache);

            var stateRepository = new ContractStateRepository(trackAccountStateCache, trackCodeCache, trackStorageCache, trackVinCache)
            {
                parent = this
            };

            return(stateRepository);
        }