org.siebengeisslein.core
Class BTreeNodeCache

java.lang.Object
  extended by org.siebengeisslein.core.BTreeNodeCache

public class BTreeNodeCache
extends java.lang.Object

TODO: This is not a cache anymore.... Move functionality to BTree?


Field Summary
static int CACHE_STRONG
           
static int CACHE_WEAK
           
static java.lang.String EXT
           
 
Constructor Summary
BTreeNodeCache(int size, java.lang.String filename, boolean create)
           
 
Method Summary
 void addValue(long index, long key, long value)
          TODO: This is only used for testing purposes !?!
 void close()
           
 void commit()
           
 java.util.SortedMap<java.lang.Long,java.lang.Long> getGarbageObjects()
           
 java.util.Set<java.lang.Long> getReferencedOIDs()
           
 long getValue(long index, long key, boolean exact)
           
 BTreeNode lock(long index)
           
 void moveEntries(DataStore store)
           
 void remove(long oid)
           
 void resetAllGCFlags()
           
 void setGCEvaluated(long index, long oid)
           
 void setGCReferenced(long index, long oid)
           
 void setValue(long index, long key, long value)
           
 void unlock(long index)
          This method may not be synchronized, because another thread might have a lock on the Cache.
protected  void writeNode(java.lang.Long index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXT

public static final java.lang.String EXT
See Also:
Constant Field Values

CACHE_WEAK

public static final int CACHE_WEAK
See Also:
Constant Field Values

CACHE_STRONG

public static final int CACHE_STRONG
See Also:
Constant Field Values
Constructor Detail

BTreeNodeCache

public BTreeNodeCache(int size,
                      java.lang.String filename,
                      boolean create)
               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setValue

public void setValue(long index,
                     long key,
                     long value)
              throws java.io.IOException,
                     UnknownOIDException
Throws:
java.io.IOException
UnknownOIDException

addValue

public void addValue(long index,
                     long key,
                     long value)
              throws java.io.IOException
TODO: This is only used for testing purposes !?! Remove?

Throws:
java.io.IOException

getValue

public long getValue(long index,
                     long key,
                     boolean exact)
              throws java.io.IOException,
                     UnknownOIDException
Throws:
java.io.IOException
UnknownOIDException

lock

public BTreeNode lock(long index)
               throws java.io.IOException
Throws:
java.io.IOException

unlock

public void unlock(long index)
            throws java.io.IOException
This method may not be synchronized, because another thread might have a lock on the Cache.

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

commit

public void commit()
            throws java.io.IOException
Throws:
java.io.IOException

writeNode

protected void writeNode(java.lang.Long index)
                  throws java.io.IOException
Throws:
java.io.IOException

setGCReferenced

public void setGCReferenced(long index,
                            long oid)
                     throws java.io.IOException,
                            UnknownOIDException
Throws:
java.io.IOException
UnknownOIDException

setGCEvaluated

public void setGCEvaluated(long index,
                           long oid)
                    throws java.io.IOException,
                           UnknownOIDException
Throws:
java.io.IOException
UnknownOIDException

resetAllGCFlags

public void resetAllGCFlags()
                     throws java.io.IOException
Throws:
java.io.IOException

getGarbageObjects

public java.util.SortedMap<java.lang.Long,java.lang.Long> getGarbageObjects()
                                                                     throws java.io.IOException
Throws:
java.io.IOException

getReferencedOIDs

public java.util.Set<java.lang.Long> getReferencedOIDs()
                                                throws java.io.IOException
Throws:
java.io.IOException

remove

public void remove(long oid)
            throws java.io.IOException,
                   UnknownOIDException
Throws:
java.io.IOException
UnknownOIDException

moveEntries

public void moveEntries(DataStore store)
                 throws java.io.IOException
Throws:
java.io.IOException