Debian Codegraph @

src/main/org/h2/mvstore/MFChunk.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.mvstore;
7
8 import java.nio.ByteBuffer;
9 import java.util.Map;
10
11 /**
12 * Class MFChunk.
13 * <UL>
14 * <LI> 4/23/22 12:49 PM initial creation
15 * </UL>
16 *
17 * @author <a href="mailto:[email protected]">Andrei Tokar</a>
18 */
19 final class MFChunk extends Chunk<MFChunk>
20 {
21 private static final String ATTR_VOLUME = "vol";
22
23 /**
24 * The index of the file (0-based), containing this chunk.
25 */
26 public volatile int volumeId;
27
28 MFChunk(int id) {
29 super(id);
30 }
31
32 MFChunk(String line) {
33 super(line);
34 }
35
36 MFChunk(Map<String, String> map) {
37 super(map, false);
38 volumeId = DataUtils.readHexInt(map, ATTR_VOLUME, 0);
39 }
40
41 @Override
42 protected ByteBuffer readFully(FileStore<MFChunk> fileStore, long filePos, int length) {
43 return fileStore.readFully(this, filePos, length);
44 }
45
46 @Override
47 protected void dump(StringBuilder buff) {
48 super.dump(buff);
49 if (volumeId != 0) {
50 DataUtils.appendMap(buff, ATTR_VOLUME, volumeId);
51 }
52 }
53 }