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(); } }
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); }