/** * Allocate a new rowid with the indicated size. */ private long alloc(int size) throws IOException { size = RecordHeader.roundAvailableSize(size); long retval = freeman.get(size); if (retval == 0) { retval = allocNew(size, pageman.getLast(Magic.USED_PAGE)); } return retval; }
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(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); }
/** * Returns the indicated root rowid. * * @see #getRootCount */ public synchronized long getRoot( int id ) throws IOException { checkIfClosed(); return pageMgr.getFileHeader().getRoot( id ); }
public synchronized void setRoot( int id, long rowid ) throws IOException { checkIfClosed(); _physPageman.getFileHeader().setRoot( id, rowid ); }
/** * Returns the first block of the indicated list */ long getFirstOf( int list ) { return block.readLong( offsetOfFirst( list ) ); }
/** Returns the next block. */ long getNext() { paranoiaMagicOk(); return block.readLong( O_NEXT ); }
/** * Returns the last block of the indicated list */ long getLastOf(int list) { return block.readLong(offsetOfLast(list)); }
/** * Factory method to create or return a data page for the indicated block. */ static FreePhysicalRowIdPage getFreePhysicalRowIdPageView(BlockIo block,int pageSize) { BlockView view = block.getView(); if (view != null && view instanceof FreePhysicalRowIdPage) return (FreePhysicalRowIdPage) view; else return new FreePhysicalRowIdPage(block, pageSize); }
/** * Factory method to create or return a page header for the * indicated block. */ static PageHeader getView(BlockIo block) { BlockView view = block.getView(); if (view != null && view instanceof PageHeader) return (PageHeader) view; else return new PageHeader(block); }
/** Sets the next block. */ void setNext(long next) { paranoiaMagicOk(); block.writeLong(O_NEXT, next); }
/** Returns the value of the indicated slot */ FreePhysicalRowId get( int slot ) { if ( slots[slot] == null ) { slots[slot] = new FreePhysicalRowId( block, slotToOffset( slot ) ) ; } return slots[slot]; }
/** Returns the size */ int FreePhysicalRowId_getSize(short pos) { int slot = offsetToSlot(pos); if(sizeCache[slot] == -1) sizeCache[slot] = block.readInt(pos + FreePhysicalRowId_O_SIZE); return sizeCache[slot]; }
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() ); }