org.apache.labs.bananadb.store
Class Store

java.lang.Object
  extended by org.apache.labs.bananadb.store.Store
Direct Known Subclasses:
EntityStore

public class Store
extends java.lang.Object

This is the core Index that is stored on filesystem.

Since:
2009-mar-16 15:34:56
Author:
kalle
See Also:
todo make sure deleted postings are the last postings in all hash code chains!

todo comsider implementing lock per file rather than store wide lock! but make sure it makes sense!


Constructor Summary
Store(Configuration configuration)
           
Store(java.io.File dataPath)
           
 
Method Summary
 void close()
           
 boolean containsKey(Accessor accessor, byte[] key, long hashCode)
           
 boolean containsKey(Accessor accessor, byte[] key, long hashCode, long revision)
           
 Accessor createAccessor(boolean readOnly)
           
 byte[] get(Accessor accessor, byte[] key, long hashCode)
           
 byte[] get(Accessor accessor, byte[] key, long hashCode, long revision)
           
 Configuration getConfiguration()
           
 SequenceManager getSequenceManager()
           
 Cursor keys()
           
 void open()
           
 void optimize()
          Removes all deleted postings from the store Write locking.
 byte[] put(Accessor accessor, byte[] key, long hashCode, byte[] value, long revision)
          Write locking.
 void rehash(Accessor accessor, int resolution)
          Rehashes the hash table file.
 byte[] remove(Accessor accessor, byte[] key, long hashCode, long revision)
          Write locking.
 void setSequenceManager(SequenceManager sequenceManager)
           
 Cursor values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Store

public Store(java.io.File dataPath)
      throws java.io.IOException
Throws:
java.io.IOException

Store

public Store(Configuration configuration)
Method Detail

open

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

getSequenceManager

public SequenceManager getSequenceManager()

createAccessor

public Accessor createAccessor(boolean readOnly)
                        throws java.io.IOException
Throws:
java.io.IOException

close

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

get

public byte[] get(Accessor accessor,
                  byte[] key,
                  long hashCode)
           throws java.io.IOException
Throws:
java.io.IOException

get

public byte[] get(Accessor accessor,
                  byte[] key,
                  long hashCode,
                  long revision)
           throws java.io.IOException
Throws:
java.io.IOException

put

public byte[] put(Accessor accessor,
                  byte[] key,
                  long hashCode,
                  byte[] value,
                  long revision)
           throws java.io.IOException
Write locking.

Parameters:
accessor -
key -
hashCode -
value -
revision -
Returns:
Throws:
java.io.IOException

remove

public byte[] remove(Accessor accessor,
                     byte[] key,
                     long hashCode,
                     long revision)
              throws java.io.IOException
Write locking.

Parameters:
accessor -
key -
hashCode -
revision - revision flaggad as deletion revision
Returns:
Throws:
java.io.IOException

containsKey

public boolean containsKey(Accessor accessor,
                           byte[] key,
                           long hashCode)
                    throws java.io.IOException
Throws:
java.io.IOException

containsKey

public boolean containsKey(Accessor accessor,
                           byte[] key,
                           long hashCode,
                           long revision)
                    throws java.io.IOException
Throws:
java.io.IOException

values

public Cursor values()

keys

public Cursor keys()

optimize

public void optimize()
Removes all deleted postings from the store Write locking.


rehash

public void rehash(Accessor accessor,
                   int resolution)
            throws java.io.IOException
Rehashes the hash table file.

Parameters:
accessor -
resolution - resolution in number of hashtable postings in new hashtable file.
Throws:
java.io.IOException

getConfiguration

public Configuration getConfiguration()

setSequenceManager

public void setSequenceManager(SequenceManager sequenceManager)


Copyright © 2009 Apache Software Foundation. All Rights Reserved.