/** * Factory method to create or return a data page for the indicated block. */ static DataPage getDataPageView( BlockIo blockIo ) { BlockView view = blockIo.getView(); if ( ( view != null ) && ( view instanceof DataPage ) ) { return ( DataPage ) view; } else { return new DataPage( blockIo ); } }
/** * {@inheritDoc} */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( "DataPage ( " ); // The blockIO sb.append( super.toString() ).append( ", " ); // The first rowId sb.append( "first rowId: " ).append( getFirst() ).append( ", " ); // The data per page sb.append( "[p:" ).append( getPrev() ).append( ", " ); // The next page sb.append( "n:" ).append( getNext() ).append( "] )" ); return sb.toString(); } }
/** Sets the first rowid's offset */ void setFirst(short value) { paranoiaMagicOk(); if (value > 0 && value < O_DATA) throw new Error("DataPage.setFirst: offset " + value + " too small"); block.writeShort(O_FIRST, value); } }
curPage = DataPage.getDataPageView(curBlock,BLOCK_SIZE); curPage.setFirst(DataPage.O_DATA); RecordHeader.setAvailableSize(curBlock, DataPage.O_DATA, 0); RecordHeader.setCurrentSize(curBlock, DataPage.O_DATA, 0); } else { curBlock = file.get(start); curPage = DataPage.getDataPageView(curBlock,BLOCK_SIZE); short pos = curPage.getFirst(); if (pos == 0) { start = pageman.allocate(Magic.USED_PAGE); curBlock = file.get(start); curPage = DataPage.getDataPageView(curBlock, BLOCK_SIZE); curPage.setFirst((short) 0); // no rowids, just data file.release(start, true); neededLeft -= DATA_PER_PAGE; curPage = DataPage.getDataPageView(curBlock, BLOCK_SIZE); curPage.setFirst((short) (DataPage.O_DATA + neededLeft)); file.release(start, true);
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))); }
curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( DataPage.O_DATA ); RecordHeader hdr = new RecordHeader( curBlock, DataPage.O_DATA ); hdr.setAvailableSize( 0 ); curPage = DataPage.getDataPageView( curBlock ); short pos = curPage.getFirst(); curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( (short) 0 ); // no rowids, just data file.release( start, true ); neededLeft -= DataPage.DATA_PER_PAGE; curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( (short) (DataPage.O_DATA + neededLeft) ); file.release( start, true );
curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( DataPage.O_DATA ); RecordHeader hdr = new RecordHeader( curBlock, DataPage.O_DATA ); hdr.setAvailableSize( 0 ); } else { curBlock = file.get( start ); curPage = DataPage.getDataPageView( curBlock ); short pos = curPage.getFirst(); if ( pos == 0 ) { start = pageManager.allocate( Magic.USED_PAGE ); curBlock = file.get( start ); curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( (short) 0 ); // no rowids, just data file.release( start, true ); neededLeft -= DataPage.DATA_PER_PAGE; curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( (short) (DataPage.O_DATA + neededLeft) ); file.release( start, true );
/** Sets the first rowid's offset */ void setFirst( short value ) { paranoiaMagicOk(); if ( value > 0 && value < O_DATA ) { throw new Error( I18n.err( I18n.ERR_543, value ) ); } block.writeShort( O_FIRST, value ); } }
/** * Factory method to create or return a data page for the indicated block. */ static DataPage getDataPageView( BlockIo block ) { BlockView view = block.getView(); if ( view != null && view instanceof DataPage ) { return ( DataPage ) view; } else { return new DataPage( block ); } }
curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( DataPage.O_DATA ); RecordHeader hdr = new RecordHeader( curBlock, DataPage.O_DATA ); hdr.setAvailableSize( 0 ); } else { curBlock = file.get( start ); curPage = DataPage.getDataPageView( curBlock ); short pos = curPage.getFirst(); if ( pos == 0 ) { start = pageman.allocate( Magic.USED_PAGE ); curBlock = file.get( start ); curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( (short) 0 ); // no rowids, just data file.release( start, true ); neededLeft -= DataPage.DATA_PER_PAGE; curPage = DataPage.getDataPageView( curBlock ); curPage.setFirst( (short) (DataPage.O_DATA + neededLeft) ); file.release( start, true );
/** * Sets the first rowid's offset */ void setFirst( short value ) { paranoiaMagicOk(); if ( value > 0 && value < O_DATA ) { throw new Error( I18n.err( I18n.ERR_543, value ) ); } blockIo.writeShort( O_FIRST, value ); }
/** * Factory method to create or return a data page for the indicated block. */ static DataPage getDataPageView(BlockIo block, int blockSize) { BlockView view = block.getView(); if (view != null && view instanceof DataPage) return (DataPage) view; else return new DataPage(block, blockSize); }
/** Sets the first rowid's offset */ void setFirst( short value ) { paranoiaMagicOk(); if ( value > 0 && value < O_DATA ) { throw new Error( I18n.err( I18n.ERR_543, value ) ); } block.writeShort( O_FIRST, value ); } }
/** * Factory method to create or return a data page for the indicated block. */ static DataPage getDataPageView( BlockIo block ) { BlockView view = block.getView(); if ( view != null && view instanceof DataPage ) { return ( DataPage ) view; } else { return new DataPage( block ); } }