void LoadVersionInfos(IKeyValueDBTransaction tr) { LastPersistedVersion = 0; var writer = new ByteBufferWriter(); writer.WriteByteArrayRaw(ObjectDB.RelationVersionsPrefix); writer.WriteVUInt32(_id); tr.SetKeyPrefix(writer.Data); if (!tr.FindFirstKey()) { return; } var keyReader = new KeyValueDBKeyReader(tr); var valueReader = new KeyValueDBValueReader(tr); do { keyReader.Restart(); valueReader.Restart(); LastPersistedVersion = keyReader.ReadVUInt32(); var relationVersionInfo = RelationVersionInfo.Load(valueReader, _relationInfoResolver.FieldHandlerFactory, _name); _relationVersions[LastPersistedVersion] = relationVersionInfo; } while (tr.FindNextKey()); }
public bool MoveNext() { if (!_seekNeeded) { _pos++; } if (_pos >= _count) { return(false); } _keyValueTrProtector.Start(); if (_keyValueTrProtector.WasInterupted(_prevProtectionCounter)) { _manipulator.CheckModifiedDuringEnum(_prevModificationCounter); _keyValueTr.SetKeyPrefix(_keyBytes); Seek(); } else if (_seekNeeded) { Seek(); } else { if (_ascending) { _keyValueTr.FindNextKey(); } else { _keyValueTr.FindPreviousKey(); } } _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; return(true); }
public RelationAdvancedEnumerator( IRelationDbManipulator manipulator, ByteBuffer prefixBytes, uint prefixFieldCount, int loaderIndex) { _prefixFieldCount = prefixFieldCount; _manipulator = manipulator; ItemLoader = _manipulator.RelationInfo.ItemLoaderInfos[loaderIndex]; _ascending = true; _tr = manipulator.Transaction; _keyValueTr = _tr.KeyValueDBTransaction; _keyValueTrProtector = _tr.TransactionProtector; _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; _keyBytes = prefixBytes; _keyValueTrProtector.Start(); _keyValueTr.SetKeyPrefix(_keyBytes); _prevModificationCounter = manipulator.ModificationCounter.ModificationCounter; _count = (uint)_keyValueTr.GetKeyValueCount(); _startPos = _ascending ? 0 : _count - 1; _pos = 0; _seekNeeded = true; _lengthOfNonDataPrefix = manipulator.RelationInfo.Prefix.Length; }
public bool MoveNext() { if (!_seekNeeded) { _pos++; } _keyValueTrProtector.Start(); if (_keyValueTrProtector.WasInterupted(_prevProtectionCounter)) { _modificationCounter.CheckModifiedDuringEnum(_prevModificationCounter); _keyValueTr.SetKeyPrefix(KeyBytes); } var ret = Seek(); _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; return(ret); }
internal void CommitLastDictId(ulong newLastDictId, IKeyValueDBTransaction tr) { if (_lastDictId != newLastDictId) { tr.SetKeyPrefix(null); var w = new ByteBufferWriter(); w.WriteVUInt64(newLastDictId); tr.CreateOrUpdateKeyValue(LastDictIdKey, w.Data.ToByteArray()); _lastDictId = newLastDictId; } }
static IEnumerable <string> LoadTablesEnum(IKeyValueDBTransaction tr) { tr.SetKeyPrefix(TableNamesPrefix); var valueReader = new KeyValueDBValueReader(tr); while (tr.Enumerate()) { valueReader.Restart(); yield return(valueReader.ReadString()); } }
void DeleteSecondaryKey(IKeyValueDBTransaction keyValueTr, uint prevIdx) { var writer = new ByteBufferWriter(); writer.WriteBlock(ObjectDB.AllRelationsSKPrefix); writer.WriteVUInt32(Id); writer.WriteVUInt32(prevIdx); keyValueTr.SetKeyPrefix(writer.Data); keyValueTr.EraseAll(); }
public void SetKeyPrefix(byte[] prefix, int prefixOfs, int prefixLen) { lock (_log) { _log.WriteUInt8((byte)KVReplayOperation.SetKeyPrefix); _log.WriteVUInt32(TrIndex); _log.WriteVInt32(prefixLen); _log.WriteVInt32(prefixOfs); _log.WriteBlock(prefix, prefixOfs, prefixLen); _log.FlushBuffer(); } _tr.SetKeyPrefix(prefix, prefixOfs, prefixLen); }
public int RemoveByKeyPrefixWithoutIterate(ByteBuffer keyBytesPrefix) { if (_hasSecondaryIndexes) { //keyBytePrefix contains [Index Relation, Primary key prefix] we need // [Index Relation, Secondary Key Index, Primary key prefix] int idBytesLength = ObjectDB.AllRelationsPKPrefix.Length + PackUnpack.LengthVUInt(_relationInfo.Id); var writer = new ByteBufferWriter(); foreach (var secKey in _relationInfo.ClientRelationVersionInfo.SecondaryKeys) { WriteSKPrefix(writer); writer.WriteVUInt32(_relationInfo.Id); writer.WriteVUInt32(secKey.Key); writer.WriteBlock(keyBytesPrefix.Buffer, idBytesLength, keyBytesPrefix.Length - idBytesLength); _kvtr.SetKeyPrefix(writer.Data); _kvtr.EraseAll(); writer.Reset(); } } return(RemovePrimaryKeysByPrefix(keyBytesPrefix)); }
void IterateOid(ulong oid) { if (!_visitedOids.Add(oid)) { return; } _tr.TransactionProtector.Start(); _trkv.SetKeyPrefix(ObjectDB.AllObjectsPrefix); if (_trkv.Find(Vuint2ByteBuffer(oid)) != FindResult.Exact) { return; // Object oid was deleted } _fastVisitor.MarkCurrentKeyAsUsed(_trkv); var reader = new KeyValueDBValueReader(_trkv); var tableId = reader.ReadVUInt32(); var version = reader.ReadVUInt32(); MarkTableIdVersionFieldInfo(tableId, version); string tableName; if (_visitor != null && !_visitor.StartObject(oid, tableId, _tableId2Name.TryGetValue(tableId, out tableName) ? tableName : null, version)) { return; } var tvi = GetTableVersionInfo(tableId, version); var knownInlineId = new HashSet <int>(); for (var i = 0; i < tvi.FieldCount; i++) { var fi = tvi[i]; if (_visitor == null || _visitor.StartField(fi.Name)) { IterateHandler(reader, fi.Handler, false, knownInlineId); _visitor?.EndField(); } else { IterateHandler(reader, fi.Handler, true, knownInlineId); } } _visitor?.EndObject(); }
public RelationEnumerator(IInternalObjectDBTransaction tr, RelationInfo relationInfo, ByteBuffer keyBytes) { RelationInfo = relationInfo; _tr = tr; _keyValueTr = _tr.KeyValueDBTransaction; _keyValueTrProtector = _tr.TransactionProtector; _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; KeyBytes = keyBytes; _keyValueTr.SetKeyPrefix(KeyBytes); _pos = 0; _seekNeeded = true; _prevModificationCounter = relationInfo.ModificationCounter; }
void ImportKeysWithPrefix(byte[] prefix, IKeyValueDBTransaction sourceKvTr) { sourceKvTr.SetKeyPrefix(prefix); if (!sourceKvTr.FindFirstKey()) return; using (var kvtr = _keyValueDb.StartWritingTransaction().Result) { kvtr.SetKeyPrefix(prefix); do { //create all keys, instead of value store only byte length of value kvtr.CreateOrUpdateKeyValue(sourceKvTr.GetKey(), Vuint2ByteBuffer(sourceKvTr.GetStorageSizeOfCurrentKey().Value)); } while (sourceKvTr.FindNextKey()); kvtr.Commit(); } }
internal static ByteBuffer FindLastKeyWithPrefix(ByteBuffer keyBytes, ByteBuffer endKeyBytes, IKeyValueDBTransaction keyValueTr, KeyValueDBTransactionProtector keyValueTrProtector) { var buffer = ByteBuffer.NewEmpty(); buffer = buffer.ResizingAppend(keyBytes).ResizingAppend(endKeyBytes); keyValueTrProtector.Start(); keyValueTr.SetKeyPrefix(buffer); if (!keyValueTr.FindLastKey()) { return(endKeyBytes); } var key = keyValueTr.GetKeyIncludingPrefix(); return(key.Slice(keyBytes.Length)); }
void ImportKeysWithPrefix(byte[] prefix, IKeyValueDBTransaction sourceKvTr) { sourceKvTr.SetKeyPrefix(prefix); if (!sourceKvTr.FindFirstKey()) { return; } using (var kvtr = _keyValueDb.StartWritingTransaction().Result) { kvtr.SetKeyPrefix(prefix); do { //create all keys, instead of value store only byte length of value kvtr.CreateOrUpdateKeyValue(sourceKvTr.GetKey(), Vuint2ByteBuffer(sourceKvTr.GetStorageSizeOfCurrentKey().Value)); } while (sourceKvTr.FindNextKey()); kvtr.Commit(); } }
public RelationEnumerator(IInternalObjectDBTransaction tr, RelationInfo relationInfo, ByteBuffer keyBytes, IRelationModificationCounter modificationCounter, int loaderIndex) { RelationInfo = relationInfo; Transaction = tr; ItemLoader = relationInfo.ItemLoaderInfos[loaderIndex]; _keyValueTr = Transaction.KeyValueDBTransaction; _keyValueTrProtector = Transaction.TransactionProtector; _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; KeyBytes = keyBytes; _modificationCounter = modificationCounter; _keyValueTrProtector.Start(); _keyValueTr.SetKeyPrefix(KeyBytes); _pos = 0; _seekNeeded = true; _prevModificationCounter = _modificationCounter.ModificationCounter; }
public bool NextKey(out TKey key) { if (_seekState == SeekState.Ready) { _pos++; } if (_pos >= _count) { key = default(TKey); return(false); } _keyValueTrProtector.Start(); if (_keyValueTrProtector.WasInterupted(_prevProtectionCounter)) { _keyValueTr.SetKeyPrefix(_keyBytes); Seek(); } else if (_seekState != SeekState.Ready) { Seek(); } else { if (_ascending) { _keyValueTr.FindNextKey(); } else { _keyValueTr.FindPreviousKey(); } } _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; //read key var keyData = _keyValueTr.GetKeyAsByteArray(); var reader = new ByteArrayReader(keyData); key = _keyReader(reader, null); return(true); }
public bool MoveNext() { if (_seekState == SeekState.Ready) { _pos++; } if (_pos >= _count) { Current = default; return(false); } _keyValueTrProtector.Start(); if (_keyValueTrProtector.WasInterupted(_prevProtectionCounter)) { if (_prevModificationCounter != _owner._modificationCounter) { ThrowModifiedDuringEnum(); } _keyValueTr.SetKeyPrefix(_owner._prefix); Seek(); } else if (_seekState != SeekState.Ready) { Seek(); } else { if (_ascending) { _keyValueTr.FindNextKey(); } else { _keyValueTr.FindPreviousKey(); } } _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; Current = _owner.ByteArrayToKey(_keyValueTr.GetKey()); return(true); }
public bool NextKey(out TKey key) { if (!_seekNeeded) { _pos++; } if (_pos >= _count) { key = default(TKey); return(false); } _keyValueTrProtector.Start(); if (_keyValueTrProtector.WasInterupted(_prevProtectionCounter)) { if (_prevModificationCounter != _owner._modificationCounter) { ThrowModifiedDuringEnum(); } _keyValueTr.SetKeyPrefix(_owner._prefix); Seek(); } else if (_seekNeeded) { Seek(); } else { if (_ascending) { _keyValueTr.FindNextKey(); } else { _keyValueTr.FindPreviousKey(); } } key = _owner.ByteArrayToKey(_keyValueTr.GetKeyAsByteArray()); return(true); }
public AbstractBufferedWriter PrepareToWriteObject(ulong id) { var shouldStop = false; try { _keyValueTrProtector.Start(ref shouldStop); _keyValueTr.SetKeyPrefix(ObjectDB.AllObjectsPrefix); var key = new byte[PackUnpack.LengthVUInt(id)]; var ofs = 0; PackUnpack.PackVUInt(key, ref ofs, id); _keyValueTr.CreateKey(key); var writer = new KeyValueDBValueProtectedWriter(_keyValueTr, _keyValueTrProtector); shouldStop = false; return(writer); } finally { if (shouldStop) { _keyValueTrProtector.Stop(); } } }
public static void SetKeyPrefix(this IKeyValueDBTransaction transaction, byte[] prefix) { transaction.SetKeyPrefix(prefix, 0, prefix == null ? 0 : prefix.Length); }
public RelationAdvancedEnumerator( IRelationDbManipulator manipulator, ByteBuffer prefixBytes, uint prefixFieldCount, EnumerationOrder order, KeyProposition startKeyProposition, ByteBuffer startKeyBytes, KeyProposition endKeyProposition, ByteBuffer endKeyBytes, int loaderIndex) { _prefixFieldCount = prefixFieldCount; _manipulator = manipulator; ItemLoader = _manipulator.RelationInfo.ItemLoaderInfos[loaderIndex]; _ascending = order == EnumerationOrder.Ascending; _tr = manipulator.Transaction; _keyValueTr = _tr.KeyValueDBTransaction; _keyValueTrProtector = _tr.TransactionProtector; _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; _keyBytes = prefixBytes; if (endKeyProposition == KeyProposition.Included) { endKeyBytes = FindLastKeyWithPrefix(_keyBytes, endKeyBytes, _keyValueTr, _keyValueTrProtector); } _keyValueTrProtector.Start(); _keyValueTr.SetKeyPrefix(_keyBytes); _prevModificationCounter = manipulator.ModificationCounter.ModificationCounter; long startIndex; long endIndex; if (endKeyProposition == KeyProposition.Ignored) { endIndex = _keyValueTr.GetKeyValueCount() - 1; } else { switch (_keyValueTr.Find(endKeyBytes)) { case FindResult.Exact: endIndex = _keyValueTr.GetKeyIndex(); if (endKeyProposition == KeyProposition.Excluded) { endIndex--; } break; case FindResult.Previous: endIndex = _keyValueTr.GetKeyIndex(); break; case FindResult.Next: endIndex = _keyValueTr.GetKeyIndex() - 1; break; case FindResult.NotFound: endIndex = -1; break; default: throw new ArgumentOutOfRangeException(); } } if (startKeyProposition == KeyProposition.Ignored) { startIndex = 0; } else { switch (_keyValueTr.Find(startKeyBytes)) { case FindResult.Exact: startIndex = _keyValueTr.GetKeyIndex(); if (startKeyProposition == KeyProposition.Excluded) { startIndex++; } break; case FindResult.Previous: startIndex = _keyValueTr.GetKeyIndex() + 1; break; case FindResult.Next: startIndex = _keyValueTr.GetKeyIndex(); break; case FindResult.NotFound: startIndex = 0; break; default: throw new ArgumentOutOfRangeException(); } } _count = (uint)Math.Max(0, endIndex - startIndex + 1); _startPos = (uint)(_ascending ? startIndex : endIndex); _pos = 0; _seekNeeded = true; _lengthOfNonDataPrefix = manipulator.RelationInfo.Prefix.Length; }
static IEnumerable<string> LoadTablesEnum(IKeyValueDBTransaction tr) { tr.SetKeyPrefix(TableNamesPrefix); var valueReader = new KeyValueDBValueReader(tr); while (tr.Enumerate()) { valueReader.Restart(); yield return valueReader.ReadString(); } }
public void SetKeyPrefix(ByteBuffer prefix) { _keyValueDBTransaction.SetKeyPrefix(prefix); }
public RelationAdvancedOrderedEnumerator(IRelationDbManipulator manipulator, ByteBuffer prefixBytes, uint prefixFieldCount, EnumerationOrder order, KeyProposition startKeyProposition, ByteBuffer startKeyBytes, KeyProposition endKeyProposition, ByteBuffer endKeyBytes, bool initKeyReader, int loaderIndex) { _prefixFieldCount = prefixFieldCount; _manipulator = manipulator; ItemLoader = _manipulator.RelationInfo.ItemLoaderInfos[loaderIndex]; _tr = manipulator.Transaction; _ascending = order == EnumerationOrder.Ascending; _keyValueTr = _tr.KeyValueDBTransaction; _keyValueTrProtector = _tr.TransactionProtector; _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; _keyBytes = prefixBytes; if (endKeyProposition == KeyProposition.Included) { endKeyBytes = RelationAdvancedEnumerator <TValue> .FindLastKeyWithPrefix(_keyBytes, endKeyBytes, _keyValueTr, _keyValueTrProtector); } _keyValueTrProtector.Start(); _keyValueTr.SetKeyPrefix(_keyBytes); long startIndex; long endIndex; if (endKeyProposition == KeyProposition.Ignored) { endIndex = _keyValueTr.GetKeyValueCount() - 1; } else { switch (_keyValueTr.Find(endKeyBytes)) { case FindResult.Exact: endIndex = _keyValueTr.GetKeyIndex(); if (endKeyProposition == KeyProposition.Excluded) { endIndex--; } break; case FindResult.Previous: endIndex = _keyValueTr.GetKeyIndex(); break; case FindResult.Next: endIndex = _keyValueTr.GetKeyIndex() - 1; break; case FindResult.NotFound: endIndex = -1; break; default: throw new ArgumentOutOfRangeException(); } } if (startKeyProposition == KeyProposition.Ignored) { startIndex = 0; } else { switch (_keyValueTr.Find(startKeyBytes)) { case FindResult.Exact: startIndex = _keyValueTr.GetKeyIndex(); if (startKeyProposition == KeyProposition.Excluded) { startIndex++; } break; case FindResult.Previous: startIndex = _keyValueTr.GetKeyIndex() + 1; break; case FindResult.Next: startIndex = _keyValueTr.GetKeyIndex(); break; case FindResult.NotFound: startIndex = 0; break; default: throw new ArgumentOutOfRangeException(); } } _count = (uint)Math.Max(0, endIndex - startIndex + 1); _startPos = (uint)(_ascending ? startIndex : endIndex); _pos = 0; _seekState = SeekState.Undefined; if (initKeyReader) { var primaryKeyFields = manipulator.RelationInfo.ClientRelationVersionInfo.GetPrimaryKeyFields(); var advancedEnumParamField = primaryKeyFields[(int)_prefixFieldCount]; if (advancedEnumParamField.Handler.NeedsCtx()) { throw new BTDBException("Not supported."); } _keyReader = (Func <AbstractBufferedReader, IReaderCtx, TKey>)manipulator.RelationInfo .GetSimpleLoader(new RelationInfo.SimpleLoaderType(advancedEnumParamField.Handler, typeof(TKey))); _lengthOfNonDataPrefix = manipulator.RelationInfo.Prefix.Length; } }
public AdvancedEnumerator(ODBSet <TKey> owner, AdvancedEnumeratorParam <TKey> param) { _owner = owner; _keyValueTrProtector = _owner._keyValueTrProtector; _keyValueTr = _owner._keyValueTr; _ascending = param.Order == EnumerationOrder.Ascending; _keyValueTrProtector.Start(); _prevModificationCounter = _owner._modificationCounter; _prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; _keyValueTr.SetKeyPrefix(_owner._prefix); long startIndex; long endIndex; if (param.EndProposition == KeyProposition.Ignored) { endIndex = _keyValueTr.GetKeyValueCount() - 1; } else { var keyBytes = _owner.KeyToByteArray(param.End); switch (_keyValueTr.Find(keyBytes)) { case FindResult.Exact: endIndex = _keyValueTr.GetKeyIndex(); if (param.EndProposition == KeyProposition.Excluded) { endIndex--; } break; case FindResult.Previous: endIndex = _keyValueTr.GetKeyIndex(); break; case FindResult.Next: endIndex = _keyValueTr.GetKeyIndex() - 1; break; case FindResult.NotFound: endIndex = -1; break; default: throw new ArgumentOutOfRangeException(); } } if (param.StartProposition == KeyProposition.Ignored) { startIndex = 0; } else { var keyBytes = _owner.KeyToByteArray(param.Start); switch (_keyValueTr.Find(keyBytes)) { case FindResult.Exact: startIndex = _keyValueTr.GetKeyIndex(); if (param.StartProposition == KeyProposition.Excluded) { startIndex++; } break; case FindResult.Previous: startIndex = _keyValueTr.GetKeyIndex() + 1; break; case FindResult.Next: startIndex = _keyValueTr.GetKeyIndex(); break; case FindResult.NotFound: startIndex = 0; break; default: throw new ArgumentOutOfRangeException(); } } _count = (uint)Math.Max(0, endIndex - startIndex + 1); _startPos = (uint)(_ascending ? startIndex : endIndex); _pos = 0; _seekState = SeekState.Undefined; }
public void Clear() { _keyValueTrProtector.Start(); _modificationCounter++; _keyValueTr.SetKeyPrefix(_prefix); _keyValueTr.EraseAll(); _count = 0; }
public static void SetKeyPrefix(this IKeyValueDBTransaction transaction, byte[] prefix) { transaction.SetKeyPrefix(prefix == null ? ByteBuffer.NewEmpty() : ByteBuffer.NewSync(prefix)); }
public IEnumerable <object> Enumerate(Type type) { if (type == typeof(object)) { type = null; } else if (type != null) { AutoRegisterType(type); } ulong oid = 0; ulong finalOid = _owner.GetLastAllocatedOid(); long prevProtectionCounter = 0; while (true) { _keyValueTrProtector.Start(); if (oid == 0) { prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; _keyValueTr.SetKeyPrefix(ObjectDB.AllObjectsPrefix); if (!_keyValueTr.FindFirstKey()) { break; } } else { if (_keyValueTrProtector.WasInterupted(prevProtectionCounter)) { _keyValueTr.SetKeyPrefix(ObjectDB.AllObjectsPrefix); oid++; var key = BuildKeyFromOid(oid); var result = _keyValueTr.Find(ByteBuffer.NewSync(key)); if (result == FindResult.Previous) { if (!_keyValueTr.FindNextKey()) { result = FindResult.NotFound; } } if (result == FindResult.NotFound) { oid--; break; } } else { if (!_keyValueTr.FindNextKey()) { break; } } prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; } oid = ReadOidFromCurrentKeyInTransaction(); var o = GetObjFromObjCacheByOid(oid); if (o != null) { if (type == null || type.IsInstanceOfType(o)) { yield return(o); } continue; } TableInfo tableInfo; var reader = ReadObjStart(oid, out tableInfo); if (type != null && !type.IsAssignableFrom(tableInfo.ClientType)) { continue; } var obj = ReadObjFinish(oid, tableInfo, reader); yield return(obj); } if (_dirtyObjSet == null) { yield break; } var dirtyObjsToEnum = _dirtyObjSet.Where(p => p.Key > oid && p.Key <= finalOid).ToList(); dirtyObjsToEnum.Sort((p1, p2) => { if (p1.Key < p2.Key) { return(-1); } if (p1.Key > p2.Key) { return(1); } return(0); }); foreach (var dObjPair in dirtyObjsToEnum) { var obj = dObjPair.Value; if (type != null && !type.IsInstanceOfType(obj)) { continue; } yield return(obj); } }
void FreeContent(IReaderCtx readerCtx, int cfgId) { var config = (ODBDictionaryConfiguration)((IInstanceRegistry)readerCtx).FindInstance(cfgId); var ctx = (DBReaderWithFreeInfoCtx)readerCtx; if (config.FreeContent == null) { var method = ILBuilder.Instance .NewMethod <Action <IInternalObjectDBTransaction, AbstractBufferedReader, IList <ulong> > >( $"IDictFinder_Cfg_{cfgId}"); var ilGenerator = method.Generator; var readerLoc = ilGenerator.DeclareLocal(typeof(IReaderCtx)); ilGenerator .Ldarg(0) .Ldarg(1) .Ldarg(2) .Newobj(() => new DBReaderWithFreeInfoCtx(null, null, null)) .Stloc(readerLoc); Action <IILGen> readerOrCtx; if (_valueHandler.NeedsCtx()) { readerOrCtx = il => il.Ldloc(readerLoc); } else { readerOrCtx = il => il.Ldarg(1); } _valueHandler.FreeContent(ilGenerator, readerOrCtx); ilGenerator.Ret(); config.FreeContent = method.Create(); } var findIDictAction = (Action <IInternalObjectDBTransaction, AbstractBufferedReader, IList <ulong> >)config.FreeContent; long prevProtectionCounter = 0; long pos = 0; while (true) { _keyValueTrProtector.Start(); if (pos == 0) { _keyValueTr.SetKeyPrefix(_prefix); if (!_keyValueTr.FindFirstKey()) { break; } } else { if (_keyValueTrProtector.WasInterupted(prevProtectionCounter)) { _keyValueTr.SetKeyPrefix(_prefix); if (!_keyValueTr.SetKeyIndex(pos)) { break; } } else { if (!_keyValueTr.FindNextKey()) { break; } } } prevProtectionCounter = _keyValueTrProtector.ProtectionCounter; var valueBytes = _keyValueTr.GetValueAsByteArray(); var valueReader = new ByteArrayReader(valueBytes); findIDictAction(ctx.GetTransaction(), valueReader, ctx.DictIds); pos++; } }