/** * Creates a log rowid manager using the indicated record file and * page manager */ LogicalRowIdManager(RecordFile file, PageManager pageman) throws IOException { this.file = file; this.pageman = pageman; this.freeman = new FreeLogicalRowIdPageManager(file, pageman); }
/** * Releases the indicated logical rowid. */ void delete( Location rowid ) throws IOException { freeman.put( rowid ); }
void commit() throws IOException{ freeman.commit(); }
/** * Creates a new logical rowid pointing to the indicated physical id */ long insert(long loc) throws IOException { // check whether there's a free rowid to reuse long retval = freeman.get(); if (retval == 0) { // no. This means that we bootstrap things by allocating // a new translation page and freeing all the rowids on it. long firstPage = pageman.allocate(Magic.TRANSLATION_PAGE); short curOffset = TranslationPage.O_TRANS; for (int i = 0; i < ELEMS_PER_PAGE; i++) { freeman.put(Location.toLong(firstPage, curOffset)); curOffset += PageHeader.PhysicalRowId_SIZE; } retval = freeman.get(); if (retval == 0) { throw new Error("couldn't obtain free translation"); } } // write the translation. update(retval, loc); return retval; }
/** * Creates a new logical rowid pointing to the indicated physical * id */ Location insert(Location loc) throws IOException { // check whether there's a free rowid to reuse Location retval = freeman.get(); if (retval == null) { // no. This means that we bootstrap things by allocating // a new translation page and freeing all the rowids on it. long firstPage = pageman.allocate(Magic.TRANSLATION_PAGE); short curOffset = TranslationPage.O_TRANS; for (int i = 0; i < TranslationPage.ELEMS_PER_PAGE; i++) { freeman.put(new Location(firstPage, curOffset)); curOffset += PhysicalRowId.SIZE; } retval = freeman.get(); if (retval == null) { throw new Error( I18n.err( I18n.ERR_545 ) ); } } // write the translation. update(retval, loc); return retval; }
/** * Creates a new logical rowid pointing to the indicated physical * id */ Location insert( Location loc ) throws IOException { // check whether there's a free rowid to reuse Location retval = freeman.get(); if ( retval == null ) { // no. This means that we bootstrap things by allocating // a new translation page and freeing all the rowids on it. long firstPage = pageManager.allocate( Magic.TRANSLATION_PAGE ); short curOffset = TranslationPage.O_TRANS; for ( int i = 0; i < TranslationPage.ELEMS_PER_PAGE; i++ ) { freeman.put( new Location( firstPage, curOffset ) ); curOffset += PhysicalRowId.SIZE; } retval = freeman.get(); if ( retval == null ) { throw new Error( I18n.err( I18n.ERR_545 ) ); } } // write the translation. update( retval, loc ); return retval; }
/** * Releases the indicated logical rowid. */ void delete( Location rowid ) throws IOException { freeman.put( rowid ); }
/** * Creates a log rowid manager using the indicated record recordFile and * page manager */ LogicalRowIdManager( PageManager pageManager ) throws IOException { this.recordFile = pageManager.getRecordFile(); this.pageManager = pageManager; this.freeman = new FreeLogicalRowIdPageManager( pageManager ); }
/** * Creates a new logical rowid pointing to the indicated physical * id */ Location insert( Location loc ) throws IOException { // check whether there's a free rowid to reuse Location retval = freeman.get(); if ( retval == null ) { // no. This means that we bootstrap things by allocating // a new translation page and freeing all the rowids on it. long firstPage = pageManager.allocate( Magic.TRANSLATION_PAGE ); short curOffset = TranslationPage.O_TRANS; for ( int i = 0; i < TranslationPage.ELEMS_PER_PAGE; i++ ) { freeman.put( new Location( firstPage, curOffset ) ); curOffset += PhysicalRowId.SIZE; } retval = freeman.get(); if ( retval == null ) { throw new Error( I18n.err( I18n.ERR_545 ) ); } } // write the translation. update( retval, loc ); return retval; }
/** * Releases the indicated logical rowid. */ void delete(Location rowid) throws IOException { freeman.put(rowid); }
/** * Creates a log rowid manager using the indicated record recordFile and * page manager */ LogicalRowIdManager( PageManager pageManager ) throws IOException { this.recordFile = pageManager.getRecordFile(); this.pageManager = pageManager; this.freeman = new FreeLogicalRowIdPageManager( pageManager ); }
/** * 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); }
private void reopen() throws IOException { _physFileFree = new RecordFile( _filename + DBF, FREE_BLOCK_SIZE); _physPagemanFree = new PageManager(_physFileFree); _physFile = new RecordFile( _filename + DBR, DATA_BLOCK_SIZE); _physPageman = new PageManager( _physFile ); _physMgr = new PhysicalRowIdManager( _physFile, _physPageman, new FreePhysicalRowIdPageManager(_physFileFree, _physPagemanFree)); _logicFileFree= new RecordFile( _filename +IDF,FREE_BLOCK_SIZE ); _logicPagemanFree = new PageManager( _logicFileFree ); if(TRANS_BLOCK_SIZE>256*8) throw new InternalError(); //to big page, slot number would not fit into page _logicFile = new RecordFile( _filename +IDR,TRANS_BLOCK_SIZE ); _logicPageman = new PageManager( _logicFile ); _logicMgr = new LogicalRowIdManager( _logicFile, _logicPageman, new FreeLogicalRowIdPageManager(_logicFileFree, _logicPagemanFree)); long versionNumber = getRoot(STORE_VERSION_NUMBER_ROOT); if(versionNumber>STORE_FORMAT_VERSION) throw new IOException("Unsupported version of store. Please update JDBM. Minimal supported ver:"+STORE_FORMAT_VERSION+", store ver:"+versionNumber); setRoot(STORE_VERSION_NUMBER_ROOT, STORE_FORMAT_VERSION); }