01: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
02:
03: This file is part of the db4o open source object database.
04:
05: db4o is free software; you can redistribute it and/or modify it under
06: the terms of version 2 of the GNU General Public License as published
07: by the Free Software Foundation and as clarified by db4objects' GPL
08: interpretation policy, available at
09: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11: Suite 350, San Mateo, CA 94403, USA.
12:
13: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14: WARRANTY; without even the implied warranty of MERCHANTABILITY or
15: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16: for more details.
17:
18: You should have received a copy of the GNU General Public License along
19: with this program; if not, write to the Free Software Foundation, Inc.,
20: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21: package com.db4o;
22:
23: import com.db4o.internal.*;
24:
25: /**
26: * The index record that is written to the database file.
27: * Don't obfuscate.
28: *
29: * @exclude
30: * @persistent
31: */
32: public class MetaIndex implements Internal4 {
33:
34: // The number of entries an the length are redundant, because the handler should
35: // return a fixed length, but we absolutely want to make sure, we don't free
36: // a slot into nowhere.
37:
38: public int indexAddress;
39: public int indexEntries;
40: public int indexLength;
41:
42: // TODO: make sure this aren't really needed
43: // and remove them
44: private final int patchAddress = 0;
45: private final int patchEntries = 0;
46: private final int patchLength = 0;
47:
48: public void read(Buffer reader) {
49: indexAddress = reader.readInt();
50: indexEntries = reader.readInt();
51: indexLength = reader.readInt();
52:
53: // no longer used apparently
54: /*patchAddress = */reader.readInt();
55: /*patchEntries = */reader.readInt();
56: /*patchLength = */reader.readInt();
57: }
58:
59: public void write(Buffer writer) {
60: writer.writeInt(indexAddress);
61: writer.writeInt(indexEntries);
62: writer.writeInt(indexLength);
63: writer.writeInt(patchAddress);
64: writer.writeInt(patchEntries);
65: writer.writeInt(patchLength);
66: }
67:
68: public void free(LocalObjectContainer file) {
69: file.free(indexAddress, indexLength);
70: indexAddress = 0;
71: indexLength = 0;
72: // file.free(patchAddress, patchLength);
73: // patchAddress = 0;
74: // patchLength = 0;
75: }
76: }
|