java.lang.Object
com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurablePage
Direct Known Subclasses:
CellBTreeBucketSingleValueV1, CellBTreeMultiValueV2Bucket, CellBTreeMultiValueV2EntryPoint, CellBTreeMultiValueV2NullBucket, CellBTreeNullBucketSingleValueV1, CellBTreeSingleValueBucketV3, CellBTreeSingleValueEntryPointV1, CellBTreeSingleValueEntryPointV3, CellBTreeSingleValueV3NullBucket, DirectoryPageV2, EntryPoint, FreeSpaceMapPage, HashIndexBucketV2, HashIndexMetadataPageV2, HashIndexNullBucketV2, OBonsaiBucketAbstract, OClusterPage, OClusterPositionMapBucket, ODirectoryPage, OHashIndexBucket, OHashIndexFileLevelMetadataPage, ONullBucket, OPaginatedClusterStateV0, OPaginatedClusterStateV1, OPaginatedClusterStateV2, OPaginatedVersionStateV0, OSBTreeBucketV1, OSBTreeBucketV2, OSBTreeNullBucketV1, OSBTreeNullBucketV2, OVersionPositionMapBucket

public class ODurablePage extends Object
Base page class for all durable data structures, that is data structures state of which can be consistently restored after system crash but results of last operations in small interval before crash may be lost.

This page has several booked memory areas with following offsets at the beginning:

  1. from 0 to 7 - Magic number
  2. from 8 to 11 - crc32 of all page content, which is calculated by cache system just before save
  3. from 12 to 23 - LSN of last operation which was stored for given page

Developer which will extend this class should use all page memory starting from NEXT_FREE_POSITION offset. All data structures which use this kind of pages should be derived from ODurableComponent class.

Since:
16.08.13
Author:
Andrey Lomakin (a.lomakin-at-orientdb.com)
  • Field Details

    • MAGIC_NUMBER_OFFSET

      public static final int MAGIC_NUMBER_OFFSET
      See Also:
    • CRC32_OFFSET

      protected static final int CRC32_OFFSET
      See Also:
    • WAL_SEGMENT_OFFSET

      public static final int WAL_SEGMENT_OFFSET
      See Also:
    • WAL_POSITION_OFFSET

      public static final int WAL_POSITION_OFFSET
      See Also:
    • MAX_PAGE_SIZE_BYTES

      public static final int MAX_PAGE_SIZE_BYTES
    • NEXT_FREE_POSITION

      public static final int NEXT_FREE_POSITION
      See Also:
  • Constructor Details

    • ODurablePage

      public ODurablePage(OCacheEntry cacheEntry)
  • Method Details

    • getPageIndex

      public final int getPageIndex()
    • getLSN

      public final OLogSequenceNumber getLSN()
    • getLogSequenceNumberFromPage

      public static OLogSequenceNumber getLogSequenceNumberFromPage(ByteBuffer buffer)
    • getPageData

      public static void getPageData(ByteBuffer buffer, byte[] data, int offset, int length)
      DO NOT DELETE THIS METHOD IT IS USED IN ENTERPRISE STORAGE

      Copies content of page into passed in byte array.

      Parameters:
      buffer - Buffer from which data will be copied
      data - Byte array to which data will be copied
      offset - Offset of data inside page
      length - Length of data to be copied
    • getLogSequenceNumber

      public static OLogSequenceNumber getLogSequenceNumber(int offset, byte[] data)
      DO NOT DELETE THIS METHOD IT IS USED IN ENTERPRISE STORAGE

      Get value of LSN from the passed in offset in byte array.

      Parameters:
      offset - Offset inside of byte array from which LSN value will be read.
      data - Byte array from which LSN value will be read.
    • getIntValue

      protected final int getIntValue(int pageOffset)
    • getIntArray

      protected final int[] getIntArray(int pageOffset, int size)
    • setIntArray

      protected void setIntArray(int pageOffset, int[] values, int offset)
    • getShortValue

      protected short getShortValue(int pageOffset)
    • getLongValue

      protected final long getLongValue(int pageOffset)
    • getBinaryValue

      protected final byte[] getBinaryValue(int pageOffset, int valLen)
    • getObjectSizeInDirectMemory

      protected int getObjectSizeInDirectMemory(OBinarySerializer<?> binarySerializer, int offset)
    • deserializeFromDirectMemory

      protected <T> T deserializeFromDirectMemory(OBinarySerializer<T> binarySerializer, int offset)
    • getByteValue

      protected final byte getByteValue(int pageOffset)
    • setIntValue

      protected final int setIntValue(int pageOffset, int value)
    • setShortValue

      protected final int setShortValue(int pageOffset, short value)
    • setByteValue

      protected final int setByteValue(int pageOffset, byte value)
    • setLongValue

      protected final int setLongValue(int pageOffset, long value)
    • setBinaryValue

      protected final int setBinaryValue(int pageOffset, byte[] value)
    • moveData

      protected final void moveData(int from, int to, int len)
    • getChanges

      public OWALChanges getChanges()
    • getCacheEntry

      public final OCacheEntry getCacheEntry()
    • restoreChanges

      public void restoreChanges(OWALChanges changes)
    • setLsn

      public final void setLsn(OLogSequenceNumber lsn)
    • toString

      public String toString()
      Overrides:
      toString in class Object