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.config;
22:
23: /**
24: * interface to configure the freespace system to be used.
25: * <br><br>All methods should be called before opening database files.
26: * If db4o is instructed to exchange the system
27: * ( {@link #useIndexSystem()} , {@link #useRamSystem()} )
28: * this will happen on opening the database file.<br><br>
29: * By default the index-based system will be used.
30: */
31: public interface FreespaceConfiguration {
32:
33: /**
34: * tuning feature: configures the minimum size of free space slots in the database file
35: * that are to be reused.
36: * <br><br>When objects are updated or deleted, the space previously occupied in the
37: * database file is marked as "free", so it can be reused. db4o maintains two lists
38: * in RAM, sorted by address and by size. Adjacent entries are merged. After a large
39: * number of updates or deletes have been executed, the lists can become large, causing
40: * RAM consumption and performance loss for maintenance. With this method you can
41: * specify an upper bound for the byte slot size to discard.
42: * <br><br>Pass <code>Integer.MAX_VALUE</code> to this method to discard all free slots for
43: * the best possible startup time.<br><br>
44: * The downside of setting this value: Database files will necessarily grow faster.
45: * <br><br>Default value:<br>
46: * <code>0</code> all space is reused
47: * @param byteCount Slots with this size or smaller will be lost.
48: */
49: public void discardSmallerThan(int byteCount);
50:
51: /**
52: * Configure a way to overwrite freed space in the database file with custom
53: * (for example: random) bytes. Will slow down I/O operation.
54: *
55: * The value of this setting may be cached internally and can thus not be
56: * reliably set after an object container has been opened.
57: *
58: * @param freespaceFiller The freespace overwriting callback to use
59: */
60: public void freespaceFiller(FreespaceFiller freespaceFiller);
61:
62: /**
63: * configures db4o to use a BTree-based freespace system.
64: * <br><br><b>Advantages</b><br>
65: * - ACID, no freespace is lost on abnormal system termination<br>
66: * - low memory consumption<br>
67: * <br><b>Disadvantages</b><br>
68: * - slower than the RAM-based system, since freespace information
69: * is written during every commit<br>
70: */
71: public void useBTreeSystem();
72:
73: /**
74: * configures db4o to use an index-based freespace system.
75: * <br><br><b>Advantages</b><br>
76: * - ACID, no freespace is lost on abnormal system termination<br>
77: * - low memory consumption<br>
78: * <br><b>Disadvantages</b><br>
79: * - slower than the RAM-based system, since freespace information
80: * is written during every commit<br>
81: */
82: public void useIndexSystem();
83:
84: /**
85: * configures db4o to use a RAM-based freespace system.
86: * <br><br><b>Advantages</b><br>
87: * - best performance<br>
88: * <br><b>Disadvantages</b><br>
89: * - upon abnormal system termination all freespace is lost<br>
90: * - memory consumption<br>
91: */
92: public void useRamSystem();
93:
94: }
|