comparison src/org/dancres/blitz/entry/ci/FifoIndexer.java @ 0:3dc0c5604566

Initial checkin of blitz 2.0 fcs - no installer yet.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 21 Mar 2009 11:00:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.entry.ci;
2
3 import java.util.*;
4
5 import java.util.logging.*;
6
7 import org.dancres.blitz.entry.EntrySleeve;
8 import org.dancres.blitz.entry.TupleLocator;
9
10 import org.dancres.blitz.mangler.MangledField;
11 import org.dancres.blitz.mangler.MangledEntry;
12
13 import org.dancres.blitz.cache.Cache;
14 import org.dancres.blitz.cache.CacheListener;
15 import org.dancres.blitz.cache.Identifiable;
16
17 import org.dancres.blitz.oid.OID;
18
19 import org.dancres.blitz.Logging;
20
21 /**
22 <p>This CacheIndexer enforces ordering of its UIDs such that searches
23 favour the smallest UID's first. There is a corresponding policy in
24 UID allocation which must be adopted for Fifo guarentees which is to ensure
25 that we allocate UID's serially from smallest to largets.</p>
26
27 <p>Finally, we have to ensure that all searches favour disk then dirty
28 cache then Entry cache because the oldest Entry's are more likely to be
29 on disk than in the cache.</p>
30
31 @see org.dancres.blitz.oid.AllocatorFactory
32 @see org.dancres.blitz.entry.SleeveCache
33 */
34 public class FifoIndexer extends CacheIndexerImpl {
35
36 FifoIndexer(String aType) {
37 super(aType);
38 }
39
40 Set newIds() {
41 /*
42 In order to ensure FIFO ordering of searches we must use some
43 form of SortedSet thus we use TreeSet which guarentees us that
44 iteration and toArray etc give us the ordering we require so long as
45 the OIDs are allocated appropriately.
46 */
47 return new TreeSet();
48 }
49
50 CacheLines[] newLinesArray(int aSize) {
51 return new FifoCacheLines[aSize];
52 }
53
54 CacheLines newLines(int anIndex, String aFieldName) {
55 return new FifoCacheLines(anIndex, aFieldName);
56 }
57 }