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.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| public volatile long | block
The start block number within the file. |
| public volatile ByteBuffer | buffer
ByteBuffer holding this Chunk's serialized content before it gets saved to file store. |
| pack-priv int | collectPriority
The garbage collection priority. |
| pack-priv static final int | FOOTER_LENGTH
The length of the chunk footer. |
| public final int | id
The chunk id. |
| pack-priv long | layoutRootPos
The position of the root of layout map. |
| public int | len
The length in number of blocks. |
| public int | mapId
The last used map id. |
| pack-priv static final int | MAX_HEADER_LENGTH
The maximum length of a chunk header, in bytes. |
| public static final int | MAX_ID
The maximum chunk id. |
| public long | maxLen
The sum of the max length of all pages. |
| public long | maxLenLive
The sum of the length of all pages that are still alive. |
| public long | next
The predicted position of the next chunk. |
| pack-priv BitSet | occupancy
Collection of "deleted" flags for all pages in the chunk. |
| pack-priv int | pageCount
The total number of pages in this chunk. |
| pack-priv int | pageCountLive
The number of pages that are still alive in the latest version of the store. |
| private int | pinCount
Number of live pinned pages. |
| public long | time
When this chunk was created, in milliseconds since the store was created. |
| pack-priv int | tocPos
Byte offset (from the beginning of the chunk) for the table of content (ToC). |
| public long | unused
When this chunk was no longer needed, in milliseconds after the store was created. |
| pack-priv long | unusedAtVersion
Version of the store at which chunk become unused and therefore can be considered "dead" and collected after this version is no longer in use. |
| public long | version
The version stored in this chunk. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | Returns: true if all of the pages, this chunk contains, were already removed, and false otherwisesequential page number within the chunk pageNo, int on disk of the removed page pageLength, boolean whether removed page was pinned pinned, long is a moment in time (since creation of the store), when
removal is recorded, and retention period starts now, long at which page was removed version)Modifies internal state to reflect the fact that one the pages within this chunk was removed from the map. |
| pack-priv void | accountForWrittenPage(int
size of the page pageLengthOnDisk, boolean indicates whether page belongs to append mode capable map
(single writer map). Such pages are "pinned" to the chunk,
they can't be evacuated (moved to a different chunk) while singleWriter)Modifies internal state to reflect the fact that one more page is stored within this chunk. |
| public final String | |
| protected void | |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| pack-priv int | |
| pack-priv int | |
| pack-priv byte[] | |
| public String | |
| private byte[] | |
| pack-priv static String | Returns: the metadata keythe chunk id chunkId)Get the metadata key for the given chunk id. |
| public int | |
| pack-priv boolean | |
| private boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv ByteBuffer | Returns: ByteBuffer containing page data.to use fileStore, int of the page data offset, long page pos pos)Read a page of data into a ByteBuffer. |
| pack-priv static String | Returns: the chunkthe source buffer buff)Read the header from the byte buffer. |
| protected abstract ByteBuffer | |
| pack-priv long[] | |
| public String | |
| pack-priv void | writeChunkHeader(WriteBuffer
the target buffer buff, int length of the area reserved for the header maxLength)Write the chunk header. |
| ATTR_BLOCK | back to summary |
|---|---|
| private static final String ATTR_BLOCK | |
| ATTR_CHUNK | back to summary |
|---|---|
| private static final String ATTR_CHUNK | |
| ATTR_FLETCHER | back to summary |
|---|---|
| private static final String ATTR_FLETCHER | |
| ATTR_LEN | back to summary |
|---|---|
| private static final String ATTR_LEN | |
| ATTR_LIVE_MAX | back to summary |
|---|---|
| private static final String ATTR_LIVE_MAX | |
| ATTR_LIVE_PAGES | back to summary |
|---|---|
| private static final String ATTR_LIVE_PAGES | |
| ATTR_MAP | back to summary |
|---|---|
| private static final String ATTR_MAP | |
| ATTR_MAX | back to summary |
|---|---|
| private static final String ATTR_MAX | |
| ATTR_NEXT | back to summary |
|---|---|
| private static final String ATTR_NEXT | |
| ATTR_OCCUPANCY | back to summary |
|---|---|
| private static final String ATTR_OCCUPANCY | |
| ATTR_PAGES | back to summary |
|---|---|
| private static final String ATTR_PAGES | |
| ATTR_PIN_COUNT | back to summary |
|---|---|
| private static final String ATTR_PIN_COUNT | |
| ATTR_ROOT | back to summary |
|---|---|
| private static final String ATTR_ROOT | |
| ATTR_TIME | back to summary |
|---|---|
| private static final String ATTR_TIME | |
| ATTR_TOC | back to summary |
|---|---|
| private static final String ATTR_TOC | |
| ATTR_UNUSED | back to summary |
|---|---|
| private static final String ATTR_UNUSED | |
| ATTR_UNUSED_AT_VERSION | back to summary |
|---|---|
| private static final String ATTR_UNUSED_AT_VERSION | |
| ATTR_VERSION | back to summary |
|---|---|
| private static final String ATTR_VERSION | |
| block | back to summary |
|---|---|
| public volatile long block The start block number within the file. | |
| buffer | back to summary |
|---|---|
| public volatile 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. | |
| collectPriority | back to summary |
|---|---|
| pack-priv int collectPriority The garbage collection priority. Priority 0 means it needs to be collected, a high value means low priority. | |
| FOOTER_LENGTH | back to summary |
|---|---|
| pack-priv static final int FOOTER_LENGTH The length of the chunk footer. The longest footer is: chunk:ffffffff,len:ffffffff,version:ffffffffffffffff,fletcher:ffffffff | |
| id | back to summary |
|---|---|
| public final int id The chunk id. | |
| layoutRootPos | back to summary |
|---|---|
| pack-priv long layoutRootPos The position of the root of layout map. | |
| len | back to summary |
|---|---|
| public int len The length in number of blocks. | |
| mapId | back to summary |
|---|---|
| public int mapId The last used map id. | |
| MAX_HEADER_LENGTH | back to summary |
|---|---|
| pack-priv static final int MAX_HEADER_LENGTH The maximum length of a chunk header, in bytes. chunk:ffffffff,len:ffffffff,pages:ffffffff,pinCount:ffffffff,max:ffffffffffffffff,map:ffffffff, root:ffffffffffffffff,time:ffffffffffffffff,version:ffffffffffffffff,next:ffffffffffffffff,toc:ffffffff | |
| MAX_ID | back to summary |
|---|---|
| public static final int MAX_ID The maximum chunk id. | |
| maxLen | back to summary |
|---|---|
| public long maxLen The sum of the max length of all pages. | |
| maxLenLive | back to summary |
|---|---|
| public long maxLenLive The sum of the length of all pages that are still alive. | |
| next | back to summary |
|---|---|
| public long next The predicted position of the next chunk. | |
| occupancy | back to summary |
|---|---|
| pack-priv BitSet occupancy Collection of "deleted" flags for all pages in the chunk. | |
| pageCount | back to summary |
|---|---|
| pack-priv int pageCount The total number of pages in this chunk. | |
| pageCountLive | back to summary |
|---|---|
| pack-priv int pageCountLive The number of pages that are still alive in the latest version of the store. | |
| pinCount | back to summary |
|---|---|
| private int pinCount Number of live pinned pages. | |
| time | back to summary |
|---|---|
| public long time When this chunk was created, in milliseconds since the store was created. | |
| tocPos | back to summary |
|---|---|
| pack-priv int tocPos Byte offset (from the beginning of the chunk) for the table of content (ToC). Table of content is holding a value of type "long" for each page in the chunk. This value consists of map id, page offset, page length and page type. Format is the same as page's position id, but with map id replacing chunk id.
| |
| unused | back to summary |
|---|---|
| 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). | |
| unusedAtVersion | back to summary |
|---|---|
| pack-priv long unusedAtVersion Version of the store at which chunk become unused and therefore can be considered "dead" and collected after this version is no longer in use. | |
| version | back to summary |
|---|---|
| public long version The version stored in this chunk. | |
| Chunk | back to summary |
|---|---|
| pack-priv Chunk(String s) | |
| Chunk | back to summary |
|---|---|
| pack-priv Chunk(Map<String, String> map, boolean full) | |
| Chunk | back to summary |
|---|---|
| pack-priv Chunk(int id) | |
| accountForRemovedPage | back to summary |
|---|---|
| pack-priv boolean accountForRemovedPage(int pageNo, int pageLength, boolean pinned, long now, long version) Modifies internal state to reflect the fact that one the pages within this chunk was removed from the map.
| |
| accountForWrittenPage | back to summary |
|---|---|
| pack-priv void accountForWrittenPage(int pageLengthOnDisk, boolean singleWriter) Modifies internal state to reflect the fact that one more page is stored within this chunk.
| |
| asString | back to summary |
|---|---|
| public final String asString() Get the chunk metadata as a string to be stored in a layout map.
| |
| dump | back to summary |
|---|---|
| protected void dump(StringBuilder buff) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| estimateHeaderSize | back to summary |
|---|---|
| pack-priv int estimateHeaderSize() Write the chunk header.
| |
| getFillRate | back to summary |
|---|---|
| pack-priv int getFillRate() Calculate the fill rate in %. 0 means empty, 100 means full.
| |
| getFooterBytes | back to summary |
|---|---|
| pack-priv byte[] getFooterBytes() | |
| getHeader | back to summary |
|---|---|
| public String getHeader() | |
| getHeaderBytes | back to summary |
|---|---|
| private byte[] getHeaderBytes() | |
| getMetaKey | back to summary |
|---|---|
| pack-priv static String getMetaKey(int chunkId) Get the metadata key for the given chunk id.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isAllocated | back to summary |
|---|---|
| pack-priv boolean isAllocated() | |
| isEvacuatable | back to summary |
|---|---|
| private boolean isEvacuatable() | |
| isLive | back to summary |
|---|---|
| pack-priv boolean isLive() | |
| isRewritable | back to summary |
|---|---|
| pack-priv boolean isRewritable() | |
| isSaved | back to summary |
|---|---|
| pack-priv boolean isSaved() | |
| readBufferForPage | back to summary |
|---|---|
| pack-priv ByteBuffer readBufferForPage(FileStore<C> fileStore, int offset, long pos) Read a page of data into a ByteBuffer.
| |
| readChunkHeader | back to summary |
|---|---|
| pack-priv static String readChunkHeader(ByteBuffer buff) Read the header from the byte buffer.
| |
| readFully | back to summary |
|---|---|
| protected abstract ByteBuffer readFully(FileStore<C> fileStore, long filePos, int length) | |
| readToC | back to summary |
|---|---|
| pack-priv long[] readToC(FileStore<C> fileStore) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| writeChunkHeader | back to summary |
|---|---|
| pack-priv void writeChunkHeader(WriteBuffer buff, int maxLength) Write the chunk header.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Comparator |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(C
the first object to be compared. one, C the second object to be compared. two)Implements java. Compares its two arguments for order. |
| public static <C extends Chunk |
| INSTANCE | back to summary |
|---|---|
| public static final Comparator<? extends Chunk<?>> INSTANCE | |
| PositionComparator | back to summary |
|---|---|
| private PositionComparator() | |
| compare | back to summary |
|---|---|
| public int compare(C one, C two) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| instance | back to summary |
|---|---|
public static <C extends Chunk
| |