public synchronized void delete( long logRowId ) throws IOException { checkIfClosed(); if ( logRowId <= 0 ) { throw new IllegalArgumentException( "Argument 'recid' is invalid: " + logRowId ); } if ( DEBUG ) { System.out.println( "BaseRecordManager.delete() recid " + logRowId ) ; } logRowId = decompressRecid(logRowId); long physRowId = _logicMgr.fetch( logRowId ); _physMgr.delete( physRowId ); _logicMgr.delete( logRowId ); }
private <A> void update2(long logRecid, A obj, Serializer<A> serializer,byte[] insertBuffer, OpenByteArrayOutputStream insertBAO, SerializerOutput insertOut) throws IOException { logRecid = decompressRecid(logRecid); long physRecid = _logicMgr.fetch( logRecid ); if(physRecid == 0) throw new IOException("Can not update, recid does not exist: "+logRecid); insertBAO.reset(insertBuffer); serializer.serialize(insertOut, obj ); if(compress){ byte[] data = compress(insertBAO.getBuf(),insertBAO.size()); insertBAO.reset(insertBuffer); insertBAO.write(data); } if ( DEBUG ) { System.out.println( "BaseRecordManager.update() recid " + logRecid + " length " + insertBAO.size() ) ; } long newRecid = _physMgr.update( physRecid, insertBAO.getBuf(), 0, insertBAO.size() ); _logicMgr.update( logRecid, newRecid ); }
private <A> A fetch2(long recid, Serializer<A> serializer,byte[] insertBuffer, OpenByteArrayOutputStream insertBAO, SerializerOutput insertOut, OpenByteArrayInputStream insertBAI, SerializerInput insertIn) throws IOException { recid = decompressRecid(recid); insertBAO.reset(insertBuffer); long physLocation = _logicMgr.fetch(recid); if(physLocation == 0){ //throw new IOException("Record not found, recid: "+recid); return null; } _physMgr.fetch(insertBAO, physLocation); if ( DEBUG ) { System.out.println( "BaseRecordManager.fetch() recid " + recid + " length " + insertBAO.size() ) ; } insertBAI.reset(insertBAO.getBuf(), insertBAO.size()); try{ if(compress) return serializer.deserialize(decompress( insertIn )); else return serializer.deserialize( insertIn ); }catch(ClassNotFoundException e){ throw new IOError(e); } }