Class Chunk

java.lang.Object
org.h2.mvstore.Chunk

public final class Chunk extends Object
A chunk of data, containing one or multiple pages.

Minimum chunk size is usually 4096 bytes, and it grows in those fixed increments (blocks). Chunk's length and it's position in the underlying filestore are multiples of that increment (block size), therefore they both are measured in blocks, instead of bytes. There are at most 67 million (2^26) chunks, and each chunk is at most 2 GB large.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    long
    The start block number within the file.
    final int
    The chunk id.
    int
    The length in number of blocks.
    int
    The last used map id.
    static final int
    The maximum chunk id.
    long
    The sum of the max length of all pages.
    long
    The sum of the length of all pages that are still alive.
    long
    The predicted position of the next chunk.
    long
    When this chunk was created, in milliseconds after the store was created.
    long
    When this chunk was no longer needed, in milliseconds after the store was created.
    long
    The version stored in this chunk.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the chunk data as a string.
    boolean
     
    static Chunk
    Build a block from the given string.
    int
     
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • MAX_ID

      public static final int MAX_ID
      The maximum chunk id.
      See Also:
    • id

      public final int id
      The chunk id.
    • block

      public volatile long block
      The start block number within the file.
    • len

      public int len
      The length in number of blocks.
    • maxLen

      public long maxLen
      The sum of the max length of all pages.
    • maxLenLive

      public long maxLenLive
      The sum of the length of all pages that are still alive.
    • version

      public long version
      The version stored in this chunk.
    • time

      public long time
      When this chunk was created, in milliseconds after the store was created.
    • unused

      public long unused
      When this chunk was no longer needed, in milliseconds after the store was created. After this, the chunk is kept alive a bit longer (in case it is referenced in older versions).
    • mapId

      public int mapId
      The last used map id.
    • next

      public long next
      The predicted position of the next chunk.
  • Method Details

    • fromString

      public static Chunk fromString(String s)
      Build a block from the given string.
      Parameters:
      s - the string
      Returns:
      the block
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • asString

      public String asString()
      Get the chunk data as a string.
      Returns:
      the string
    • toString

      public String toString()
      Overrides:
      toString in class Object