org.exist.storage.btree
Class Paged.PageHeader

java.lang.Object
  extended byorg.exist.storage.btree.Paged.PageHeader
Enclosing class:
Paged

public abstract static class Paged.PageHeader
extends java.lang.Object


Constructor Summary
Paged.PageHeader()
           
Paged.PageHeader(byte[] data, int offset)
           
 
Method Summary
 int getDataLen()
          The length of the Data
 long getLsn()
          Returns the LSN, i.e.
 long getNextPage()
          The next page for this Record (if overflowed)
 byte getStatus()
          The status of this page (UNUSED, RECORD, DELETED, etc...) - jmv - DESIGN_NOTE : 44 calls to this functions, mostly with switch; the "state" design pattern is appropriate to eliminate these non - object oriented switches, and put together all the behavior related to one state.
 boolean isDirty()
          Gets the dirty attribute of the PageHeader object
 int read(byte[] data, int offset)
           
 void setDataLen(int dataLen)
          The length of the Data
 void setDirty(boolean dirty)
           
 void setLsn(long lsn)
           
 void setNextPage(long nextPage)
          The next page for this Record (if overflowed)
 void setStatus(byte status)
          The status of this page (UNUSED, RECORD, DELETED, etc...)
 int write(byte[] data, int offset)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Paged.PageHeader

public Paged.PageHeader()

Paged.PageHeader

public Paged.PageHeader(byte[] data,
                        int offset)
                 throws java.io.IOException
Method Detail

getDataLen

public final int getDataLen()
The length of the Data

Returns:
The dataLen value

getNextPage

public final long getNextPage()
The next page for this Record (if overflowed)

Returns:
The nextPage value

getStatus

public final byte getStatus()
The status of this page (UNUSED, RECORD, DELETED, etc...) - jmv - DESIGN_NOTE : 44 calls to this functions, mostly with switch; the "state" design pattern is appropriate to eliminate these non - object oriented switches, and put together all the behavior related to one state.

Returns:
The status value

isDirty

public final boolean isDirty()
Gets the dirty attribute of the PageHeader object

Returns:
The dirty value

getLsn

public final long getLsn()
Returns the LSN, i.e. the log sequence number, of the last operation that modified this page. This information is used during recovery: if the log sequence number of a log record is smaller or equal to the LSN stored in this page header, then the page has already been written to disk before the database failure. Otherwise, the modification is not yet reflected in the page and the operation needs to be redone.

Returns:
log sequence number of the last operation that modified this page.

setLsn

public final void setLsn(long lsn)

read

public int read(byte[] data,
                int offset)
         throws java.io.IOException
Throws:
java.io.IOException

write

public int write(byte[] data,
                 int offset)
          throws java.io.IOException
Throws:
java.io.IOException

setDataLen

public final void setDataLen(int dataLen)
The length of the Data

Parameters:
dataLen - The new dataLen value

setDirty

public final void setDirty(boolean dirty)

setNextPage

public final void setNextPage(long nextPage)
The next page for this Record (if overflowed)

Parameters:
nextPage - The new nextPage value

setStatus

public final void setStatus(byte status)
The status of this page (UNUSED, RECORD, DELETED, etc...)

Parameters:
status - The new status value


Copyright (C) Wolfgang Meier. All rights reserved.