01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.index;
07:
08: import java.sql.SQLException;
09:
10: import org.h2.store.DataPage;
11: import org.h2.store.Record;
12:
13: /**
14: * The head page of a linear hash index.
15: */
16: public class LinearHashHead extends Record {
17:
18: private LinearHashIndex index;
19: int baseSize;
20: int nextToSplit;
21: int recordCount, bucketCount;
22:
23: LinearHashHead(LinearHashIndex index) {
24: this .index = index;
25: }
26:
27: LinearHashHead(LinearHashIndex index, DataPage s) {
28: this .index = index;
29: baseSize = s.readInt();
30: nextToSplit = s.readInt();
31: recordCount = s.readInt();
32: bucketCount = s.readInt();
33: }
34:
35: public int getByteCount(DataPage dummy) throws SQLException {
36: return index.getBucketSize();
37: }
38:
39: public void write(DataPage buff) throws SQLException {
40: buff.writeByte((byte) 'H');
41: buff.writeInt(baseSize);
42: buff.writeInt(nextToSplit);
43: buff.writeInt(recordCount);
44: buff.writeInt(bucketCount);
45: }
46:
47: public boolean isPinned() {
48: return true;
49: }
50:
51: }
|