Package org.h2.mvstore
Class Chunk<C extends Chunk<C>>
- java.lang.Object
-
- org.h2.mvstore.Chunk<C>
-
- Direct Known Subclasses:
SFChunk
public abstract class Chunk<C extends Chunk<C>> extends java.lang.ObjectA 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 classChunk.PositionComparator<C extends Chunk<C>>
-
Field Summary
Fields Modifier and Type Field Description longblockThe start block number within the file.java.nio.ByteBufferbufferByteBuffer holding this Chunk's serialized content before it gets saved to file store.intidThe chunk id.intlenThe length in number of blocks.intmapIdThe last used map id.static intMAX_IDThe maximum chunk id.longmaxLenThe sum of the max length of all pages.longmaxLenLiveThe sum of the length of all pages that are still alive.longnextThe predicted position of the next chunk.longtimeWhen this chunk was created, in milliseconds since the store was created.longunusedWhen this chunk was no longer needed, in milliseconds after the store was created.longversionThe version stored in this chunk.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringasString()Get the chunk metadata as a string to be stored in a layout map.protected voiddump(java.lang.StringBuilder buff)booleanequals(java.lang.Object o)java.lang.StringgetHeader()inthashCode()protected abstract java.nio.ByteBufferreadFully(FileStore<C> fileStore, long filePos, int length)java.lang.StringtoString()
-
-
-
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 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 since 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.
-
buffer
public volatile java.nio.ByteBuffer buffer
ByteBuffer holding this Chunk's serialized content before it gets saved to file store. This allows to release pages of this Chunk earlier, allowing them to be garbage collected.
-
-
Method Detail
-
readFully
protected abstract java.nio.ByteBuffer readFully(FileStore<C> fileStore, long filePos, int length)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
asString
public final java.lang.String asString()
Get the chunk metadata as a string to be stored in a layout map.- Returns:
- the string
-
dump
protected void dump(java.lang.StringBuilder buff)
-
getHeader
public java.lang.String getHeader()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-