Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: CURSOR reader() throws java.io.IOException
        internal virtual CURSOR Reader()
        {
            if (!_allocated)
            {
                return(Reader(new ByteArrayPageCursor(_noEntries)));
            }

            // Reuse the existing buffer because we're not writing while reading anyway
            _buffer.clear();
            ReadAheadChannel <StoreChannel> channel = new ReadAheadChannel <StoreChannel>(_fs.open(_file, OpenMode.READ), _buffer);
            PageCursor pageCursor = new ReadableChannelPageCursor(channel);

            return(Reader(pageCursor));
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: EntryRecordCursor(Reader reader, org.neo4j.causalclustering.messaging.marshalling.ChannelMarshal<org.neo4j.causalclustering.core.replication.ReplicatedContent> contentMarshal, long currentIndex, long wantedIndex, SegmentFile segment) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        internal EntryRecordCursor(Reader reader, ChannelMarshal <ReplicatedContent> contentMarshal, long currentIndex, long wantedIndex, SegmentFile segment)
        {
            this._bufferedReader = new ReadAheadChannel <StoreChannel>(reader.Channel());
            this._reader         = reader;
            this._contentMarshal = contentMarshal;
            this._segment        = segment;

            /* The cache lookup might have given us an earlier position, scan forward to the exact position. */
            while (currentIndex < wantedIndex)
            {
                read(_bufferedReader, contentMarshal);
                currentIndex++;
            }

            this._position = new LogPosition(currentIndex, _bufferedReader.position());
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void close() throws java.io.IOException
        public override void Close()
        {
            if (_closed)
            {
                /* This is just a defensive measure, for catching user errors from messing up the refCount. */
                throw new System.InvalidOperationException("Already closed");
            }

            _bufferedReader = null;
            _closed         = true;
            _segment.refCount().decrease();

            if (_hadError)
            {
                /* If the reader had en error, then it should be closed instead of returned to the pool. */
                _reader.Dispose();
            }
            else
            {
                _segment.positionCache().put(_position);
                _segment.readerPool().release(_reader);
            }
        }