org.h2.mvstore

## Class Chunk

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

    public class Chunk
    extends java.lang.Object

A chunk of data, containing one or multiple pages.

Chunks are page aligned (each page is usually 4096 bytes). There are at most 67 million (2^26) chunks, each chunk is at most 2 GB large.

### Field Summary

Fields
`long` `block` The start block number within the file.
`int` `collectPriority` The garbage collection priority.
`int` `id` The chunk id.
`int` `len` The length in number of blocks.
`int` `mapId` The last used map id.
`static int` `MAX_ID` The maximum chunk id.
`long` `maxLen` The sum of the max length of all pages.
`long` `maxLenLive` The sum of the max length of all pages that are in use.
`long` `metaRootPos` The position of the meta root.
`long` `next` The predicted position of the next chunk.
`int` `pageCount` The total number of pages in this chunk.
`int` `pageCountLive` The number of pages still alive.
`long` `time` When this chunk was created, in milliseconds after the store was created.
`long` `unused` When this chunk was no longer needed, in milliseconds after the store was created.
`long` `version` The version stored in this chunk.

### Method Summary

Methods
`java.lang.String` `asString()` Get the chunk data as a string.
`boolean` `equals(java.lang.Object o)`
`static Chunk` `fromString(java.lang.String s)` Build a block from the given string.
`int` `getFillRate()` Calculate the fill rate in %.
`int` `hashCode()`
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### MAX_ID

    public static final int MAX_ID

The maximum chunk id.

See Also:
  Constant Field Values

#### id

    public final int id

The chunk id.

#### block

    public long block

The start block number within the file.

#### len

    public int len

The length in number of blocks.

#### pageCount

    public int pageCount

The total number of pages in this chunk.

#### pageCountLive

    public int pageCountLive

The number of pages still alive.

#### maxLen

    public long maxLen

The sum of the max length of all pages.

#### maxLenLive

    public long maxLenLive

The sum of the max length of all pages that are in use.

#### collectPriority

    public int collectPriority

The garbage collection priority. Priority 0 means it needs to be collected, a high value means low priority.

#### metaRootPos

    public long metaRootPos

The position of the meta root.

#### 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 Detail

#### fromString

    public static Chunk fromString(java.lang.String s)

Build a block from the given string.

Parameters:
  `s` - the string
Returns:
  the block

#### getFillRate

    public int getFillRate()

Calculate the fill rate in %. 0 means empty, 100 means full.

Returns:
  the fill rate

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `java.lang.Object`

#### asString

    public java.lang.String asString()

Get the chunk data as a string.

Returns:
  the string

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`