Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public void IterateOid(ulong oid)
        {
            if (!SkipAlreadyVisitedOidChecks && !_visitedOids.Add(oid))
            {
                return;
            }
            if (!_trkv.FindExactKey(Vuint2ByteBuffer(ObjectDB.AllObjectsPrefix, oid)))
            {
                return; // Object oid was deleted
            }
            _fastVisitor.MarkCurrentKeyAsUsed(_trkv);
            var reader  = new SpanReader(_trkv.GetValue());
            var tableId = reader.ReadVUInt32();
            var version = reader.ReadVUInt32();

            MarkTableIdVersionFieldInfo(tableId, version);
            if (_visitor != null && !_visitor.StartObject(oid, tableId, _tableId2Name.TryGetValue(tableId, out var 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(ref reader, fi.Handler !, false, knownInlineId);
                    _visitor?.EndField();
                }
                else
                {
                    IterateHandler(ref reader, fi.Handler !, true, knownInlineId);
                }
            }
            _visitor?.EndObject();
        }