/** * 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); }
/** * Creates a new page manager using the indicated record file. */ PageManager( RecordFile file ) throws IOException { this.file = file; // Note that we hold on to the file header node. headerBuf = file.get( 0 ); // Assume file is new if the file header's magic number is 0. if ( headerBuf.readShort( 0 ) == 0 ) { header = new FileHeader( headerBuf, true ); } else // header is for existing file { header = new FileHeader( headerBuf, false ); } }
/** * Creates a new page manager using the indicated record recordFile. */ PageManager( RecordFile recordFile ) throws IOException { this.recordFile = recordFile; // Note that we hold on to the recordFile header node. headerBuf = recordFile.get( 0 ); // Assume recordFile is new if the recordFile header's magic number is 0. if ( headerBuf.readShort( 0 ) == 0 ) { header = new FileHeader( headerBuf, true ); } else // header is for existing recordFile { header = new FileHeader( headerBuf, false ); } }
/** * Flushes the page manager. This forces a flush of all outstanding * blocks (this it's an implicit {@link RecordFile#commit} as well). */ void rollback() throws IOException { // release header file.discard(headerBuf); file.rollback(); // and obtain it again headerBuf = file.get(0); if (headerBuf.readShort(0) == 0) header = new FileHeader(headerBuf, true); else header = new FileHeader(headerBuf, false); }
/** * Creates a new page manager using the indicated record recordFile. * We will load in memory the associated FileHeader, which is * read from the RecordFile if it exists, or is created if it doesn't. * * @param The associated RecordFile * @throws IOException If there is an issue storing data into the recordFile */ PageManager( RecordFile recordFile ) throws IOException { this.recordFile = recordFile; // Note that we hold on to the recordFile header node. headerBuf = recordFile.get( 0 ); // Assume recordFile is new if the recordFile header's magic number is 0. boolean isNew = headerBuf.readShort( 0 ) == 0; header = new FileHeader( headerBuf, isNew ); }
/** * Flushes the page manager. This forces a flush of all outstanding * blocks (this is an implicit {@link RecordFile#commit} as well). * * @TODO completely wrong description of method */ void rollback() throws IOException { // release header recordFile.discard( headerBuf ); recordFile.rollback(); // and obtain it again headerBuf = recordFile.get( 0 ); if ( headerBuf.readShort( 0 ) == 0 ) { header = new FileHeader( headerBuf, true ); } else { header = new FileHeader( headerBuf, false ); } }
/** * Flushes the page manager. This forces a flush of all outstanding * blocks (this is an implicit {@link RecordFile#commit} as well). * * @TODO completely wrong description of method */ void rollback() throws IOException { // release header file.discard( headerBuf ); file.rollback(); // and obtain it again headerBuf = file.get( 0 ); if ( headerBuf.readShort( 0 ) == 0 ) { header = new FileHeader( headerBuf, true ); } else { header = new FileHeader( headerBuf, false ); } }
/** * Flushes the page manager. This forces a flush of all outstanding * blocks (this is an implicit {@link RecordFile#commit} as well). * * @TODO completely wrong description of method */ void rollback() throws IOException { // release header recordFile.discard( headerBuf ); recordFile.rollback(); // and obtain it again headerBuf = recordFile.get( 0 ); if ( headerBuf.readShort( 0 ) == 0 ) { header = new FileHeader( headerBuf, true ); } else { 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 ); }
/** * 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 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 ); }