/[gzz]/gzz/lava/gzz/storm/IndexedPool.java
ViewVC logotype

Diff of /gzz/lava/gzz/storm/IndexedPool.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by benja, Sun Dec 29 02:01:41 2002 UTC revision 1.7 by benja, Mon Dec 30 13:16:20 2002 UTC
# Line 41  import java.util.*; Line 41  import java.util.*;
41   */   */
42  public interface IndexedPool extends StormPool {  public interface IndexedPool extends StormPool {
43    
44      interface Index {      final class Mapping {
45          Object get(Object key);          public final byte[] key, value;
46            public Mapping(byte[] k, byte[] v) { key=k; value=v; }
47      }      }
48    
49      interface DB {      interface DB {
50            /** Collect <code>IndexedPool.Mappings</code>s
51             *  with the given key from this DB.
52             */
53          Collector get(byte[] key);          Collector get(byte[] key);
54      }      }
55    
56      interface Indexer {      interface IndexType {
57          /**          /**
58           *  @return The set of <code>IndexedPool.Mapping</code>s           *  @return The set of <code>IndexedPool.Mapping</code>s
59           *          this index wants to extract from this block.           *          this index wants to extract from this block.
60           */           */
61          Set index(Block b);          Set process(Block b);
62    
63          /** Set the <code>DB</code> object this <code>Indexer</code>'s          /** A factory method for the public interface
64           *  associated <code>Index</code> object will use for lookups.           *  of this type of index.
65             *  This is the object that <code>IndexedPool.getIndex()</code>
66             *  returns, i.e. the object that clients of the pool
67             *  use to retrieve the data in the index.
68             *  The actual interface isn't in any way constrained
69             *  by Storm, because different indexes will want to
70             *  provide very different interfaces; therefore, we simply
71             *  return an <code>Object</code> that has to be cast
72             *  to the desired interface first.
73           */           */
74          void setDB(DB db);          Object createIndex(DB db);
75    
         Index getIndex();  
76          String getIndexTypeURI();          String getIndexTypeURI();
77      }      }
78    
79      /** Get the Index object for a given IndexType.      /** Get the Index object for a given IndexType.
80       *  Equivalent to <code>(Index)getIndices().get(type)</code>.       *  Equivalent to <code>getIndices().get(type)</code>.
81       */       */
82      Index getIndex(String typeURI);      Object getIndex(String typeURI);
83    
84      /** Return a mapping from index type URIs      /** Return a mapping from index type URIs
85       *  to <code>Index</code> objects. This map       *  to <code>Index</code> objects. This map
# Line 83  public interface IndexedPool extends Sto Line 94  public interface IndexedPool extends Sto
94       *  </pre>       *  </pre>
95       */       */
96      Pointer getPointer(String uri);      Pointer getPointer(String uri);
   
     public final class Mapping {  
         public final byte[] key, value;  
         public Mapping(byte[] k, byte[] v) { key=k; value=v; }  
     }  
97  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26