Ejemplo n.º 1
0
        public ReadSession(
            SegmentInfo version,
            DocHashReader docHashReader,
            BlockInfoReader addressReader,
            Stream stream)
        {
            Version = version;

            Stream        = stream;
            DocHashReader = docHashReader;
            AddressReader = addressReader;
            BlockSize     = BlockSerializer.SizeOfBlock();
            Stream.Seek(Version.KeyIndexOffset, SeekOrigin.Begin);
            KeyIndex = DocumentSerializer.ReadKeyIndex(Stream, Version.KeyIndexSize);
        }
Ejemplo n.º 2
0
        public DocumentTableStream(Stream stream, SegmentInfo ix, int skip = 0, int take = int.MaxValue)
            : base(ix.PrimaryKeyFieldName)
        {
            _dataFile = stream;
            _ix       = ix;
            _dataFile.Seek(_ix.KeyIndexOffset, SeekOrigin.Begin);
            var keyIndex = DocumentSerializer.ReadKeyIndex(_dataFile, _ix.KeyIndexSize);

            _hashReader     = new DocHashReader(_dataFile, _ix.DocHashOffset, leaveOpen: false);
            _addressReader  = new BlockInfoReader(_dataFile, _ix.DocAddressesOffset);
            _documentReader = new DocumentReader(
                _dataFile, _ix.Compression, keyIndex, _ix.KeyIndexOffset + _ix.KeyIndexSize, leaveOpen: false);

            _skip = skip;
            _take = take;
        }