public int ReIndex() { var last = _Index.Get <DiskBlockPos>(IndexedLimit); int count = 0; List <TStoredItem> lastBlocks = null; foreach (var blocks in EnumerateForIndex(new DiskBlockPosRange(last)).Partition(400)) { count += blocks.Count; _Index.PutBatch(blocks.Select(b => new Tuple <String, IBitcoinSerializable>(GetKey(b.Item), b.BlockPosition))); lastBlocks = blocks; } if (lastBlocks != null && lastBlocks.Count > 0) { var block = lastBlocks.Last(); _Index.Put(IndexedLimit, new DiskBlockPos(block.BlockPosition.File, block.BlockPosition.Position + (uint)block.GetStorageSize())); } return(count); }
public override async Task PutBatch(IEnumerable <Tuple <string, IBitcoinSerializable> > values) { await base.PutBatch(values).ConfigureAwait(false); await _InnerRepository.PutBatch(values).ConfigureAwait(false); }