/** * Returns the page before the indicated block */ long getPrev(long block) throws IOException { try { return PageHeader.getView(file.get(block)).getPrev(); } finally { file.release(block, false); } }
/** * Creates a new page manager using the indicated record file. */ PageManager(RecordFile file) throws IOException { this.file = file; // check the file header. If the magic is 0, we assume a new // file. Note that we hold on to the file header node. headerBuf = file.get(0); if (headerBuf.readShort(0) == 0) header = new FileHeader(headerBuf, true); else header = new FileHeader(headerBuf, false); }
/** * Returns the page following the indicated block */ long getNext(long block) throws IOException { try { return PageHeader.getView(file.get(block)).getNext(); } finally { file.release(block, false); } }
/** * Returns the page following the indicated block */ long getNext( long block ) throws IOException { try { return PageHeader.getView( recordFile.get( block ) ).getNext(); } finally { recordFile.release( block, false ); } }
/** * Returns the page before the indicated block */ long getPrev( long block ) throws IOException { try { return PageHeader.getView( recordFile.get( block ) ).getPrev(); } finally { recordFile.release( block, false ); } }
/** * Returns the page before the indicated block */ long getPrev( long block ) throws IOException { try { return PageHeader.getView( recordFile.get( block ) ).getPrev(); } finally { recordFile.release( block, false ); } }
/** * Commit all pending (in-memory) data by flushing the page manager. * This forces a flush of all outstanding blocks (this is an implicit * {@link RecordFile#commit} as well). */ void commit() throws IOException { // write the header out file.release( headerBuf ); file.commit(); // and obtain it again headerBuf = file.get( 0 ); header = new FileHeader( headerBuf, false ); }
/** * Commit all pending (in-memory) data by flushing the page manager. * This forces a flush of all outstanding blocks (this it's an implicit * {@link RecordFile#commit} as well). */ void commit() throws IOException { // write the header out file.release(headerBuf); file.commit(); // and obtain it again headerBuf = file.get(0); header = new FileHeader(headerBuf, false); }
/** * Commit all pending (in-memory) data by flushing the page manager. * This forces a flush of all outstanding blocks (this is an implicit * {@link RecordFile#commit} as well). */ void commit() throws IOException { // write the header out recordFile.release( headerBuf ); recordFile.commit(); // and obtain it again headerBuf = recordFile.get( 0 ); header = new FileHeader( headerBuf, false ); }
/** * Returns the page following the indicated block */ long getNext( long block ) throws IOException { try { return PageHeader.getView( file.get( block ) ).getNext(); } finally { file.release( block, false ); } }
/** * Returns the page before the indicated block */ long getPrev( long block ) throws IOException { try { return PageHeader.getView( file.get( block ) ).getPrev(); } finally { file.release( block, false ); } }
/** * Returns the page following the indicated block */ long getNext( long block ) throws IOException { try { return PageHeader.getView( recordFile.get( block ) ).getNext(); } finally { recordFile.release( block, false ); } }
/** * Commit all pending (in-memory) data by flushing the page manager. * This forces a flush of all outstanding blocks (this is an implicit * {@link RecordFile#commit} as well). */ void commit() throws IOException { // write the header out recordFile.release( headerBuf ); recordFile.commit(); // and obtain it again headerBuf = recordFile.get( 0 ); header = new FileHeader( headerBuf, false ); }
private void free( Location id ) throws IOException { // get the rowid, and write a zero current size into it. BlockIo curBlock = file.get( id.getBlock() ); RecordHeader hdr = new RecordHeader( curBlock, id.getOffset() ); hdr.setCurrentSize( 0 ); file.release( id.getBlock(), true ); // write the rowid to the free list freePageManager.put( id, hdr.getAvailableSize() ); }
private void free( Location id ) throws IOException { // get the rowid, and write a zero current size into it. BlockIo curBlock = file.get( id.getBlock() ); RecordHeader hdr = new RecordHeader( curBlock, id.getOffset() ); hdr.setCurrentSize( 0 ); file.release( id.getBlock(), true ); // write the rowid to the free list freeman.put( id, hdr.getAvailableSize() ); }
private void free( Location id ) throws IOException { // get the rowid, and write a zero current size into it. BlockIo curBlock = file.get( id.getBlock() ); RecordHeader hdr = new RecordHeader( curBlock, id.getOffset() ); hdr.setCurrentSize( 0 ); file.release( id.getBlock(), true ); // write the rowid to the free list freeman.put( id, hdr.getAvailableSize() ); }
private void free(long id) throws IOException { // get the rowid, and write a zero current size into it. BlockIo curBlock = file.get(Location.getBlock(id)); DataPage curPage = DataPage.getDataPageView(curBlock,BLOCK_SIZE); RecordHeader.setCurrentSize(curBlock, Location.getOffset(id), 0); file.release(Location.getBlock(id), true); // write the rowid to the free list freeman.put(id, RecordHeader.getAvailableSize(curBlock, Location.getOffset(id))); }
/** * Releases the indicated logical rowid. */ void delete(long rowid) throws IOException { //zero out old location, is needed for defragmentation TranslationPage xlatPage = TranslationPage.getTranslationPageView(file.get(Location.getBlock(rowid)),blockSize); xlatPage.setLocationBlock(Location.getOffset(rowid), 0); xlatPage.setLocationOffset(Location.getOffset(rowid), (short)0); file.release(Location.getBlock(rowid), true); freeman.put(rowid); }
/** * Updates the mapping * * @param rowid The logical rowid * @param loc The physical rowid */ void update( Location rowid, Location loc ) throws IOException { TranslationPage xlatPage = TranslationPage.getTranslationPageView( recordFile.get( rowid.getBlock() ) ); PhysicalRowId physid = xlatPage.get( rowid.getOffset() ); physid.setBlock( loc.getBlock() ); physid.setOffset( loc.getOffset() ); recordFile.release( rowid.getBlock(), true ); }
/** * Updates the mapping * * @param rowid The logical rowid * @param loc The physical rowid */ void update( Location rowid, Location loc ) throws IOException { TranslationPage xlatPage = TranslationPage.getTranslationPageView( recordFile.get( rowid.getBlock() ) ); PhysicalRowId physid = xlatPage.get( rowid.getOffset() ); physid.setBlock( loc.getBlock() ); physid.setOffset( loc.getOffset() ); recordFile.release( rowid.getBlock(), true ); }