KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > config > FreespaceConfiguration


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 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      * configures db4o to use an index-based freespace system.
53      * <br><br><b>Advantages</b><br>
54      * - ACID, no freespace is lost on abnormal system termination<br>
55      * - low memory consumption<br>
56      * <br><b>Disadvantages</b><br>
57      * - slower than the RAM-based system, since freespace information
58      * is written during every commit<br>
59      */

60     public void useIndexSystem();
61
62     /**
63      * configures db4o to use a RAM-based freespace system.
64      * <br><br><b>Advantages</b><br>
65      * - best performance<br>
66      * <br><b>Disadvantages</b><br>
67      * - upon abnormal system termination all freespace is lost<br>
68      * - memory consumption<br>
69      */

70     public void useRamSystem();
71     
72 }
73
Popular Tags