Example #1
0
        public void Commit()
        {
            foreach (var item in cache)
            {
                switch (item.Value.State)
                {
                case TrackState.Added:
                case TrackState.Changed:
                    store.Put(Key(item.Key), item.Value.Node.ToArray());
                    break;

                case TrackState.Deleted:
                    store.Delete(Key(item.Key));
                    break;
                }
            }
            cache.Clear();
        }
Example #2
0
 protected override void AddInternal(StorageKey key, StorageItem value)
 {
     snapshot?.Put(key.ToArray(), value.ToArray());
 }
Example #3
0
 protected override void AddInternal(TKey key, TValue value)
 {
     snapshot?.Put(prefix, key.ToArray(), value.ToArray());
 }
Example #4
0
 public void AddLocalStateRoot(StateRoot state_root)
 {
     snapshot.Put(Keys.StateRoot(state_root.Index), state_root.ToArray());
     snapshot.Put(Keys.CurrentLocalRootIndex, BitConverter.GetBytes(state_root.Index));
 }
Example #5
0
 private void PutToStore(MPTNode node)
 {
     store.Put(Prefix, node.Hash.ToArray(), node.Encode());
 }
Example #6
0
 protected override void AddInternal(T item)
 {
     snapshot?.Put(prefix, null, item.ToArray());
 }