org.apache.labs.bananadb.store.data.bananatrie
Class Hashtable

java.lang.Object
  extended by org.apache.labs.bananadb.store.data.FileHandler<Hashtable.Header,Hashtable.Posting>
      extended by org.apache.labs.bananadb.store.data.bananatrie.Hashtable

public class Hashtable
extends FileHandler<Hashtable.Header,Hashtable.Posting>

Hashtable file. There is never more than one of these that are valid at any given time.

The position in the hashtable for a given hash code is calculated as (hash & (capacity - 1)). At this position there is a posting that points at the first known hash code posting.

This file is affected by rehashing.

Since:
2009-mar-16 14:00:56
Author:
kalle

Nested Class Summary
static class Hashtable.Header
           
static class Hashtable.Posting
           
 
Field Summary
static int HEADER_BYTE_SIZE
           
 
Constructor Summary
Hashtable(java.io.File directory, int versionId, java.lang.String access, LockFactory lockFactory)
           
 
Method Summary
 int calculateHashCodePostingOffset(long hashCode)
           
 int getHeaderByteSize()
           
 int getVersionId()
           
 void markPostingAsDeleted(int startOffset, java.io.RandomAccessFile RAF, long revision)
           
 void open()
           
 void readHeader(Hashtable.Header header, java.io.RandomAccessFile RAF)
           
 void readPosting(Hashtable.Posting posting, java.io.RandomAccessFile RAF)
           
 void writeHeader(Hashtable.Header header, java.io.RandomAccessFile RAF)
           
 void writePosting(Hashtable.Posting posting, java.io.RandomAccessFile RAF)
           
 
Methods inherited from class org.apache.labs.bananadb.store.data.FileHandler
close, exists, format, format, getFile, getLock, getRAF, markPostingAsDeleted, readHeader, readHeader, readHeader, readPosting, readPosting, writeHeader, writeHeader, writeHeader, writePosting, writePosting, writePosting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEADER_BYTE_SIZE

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

Hashtable

public Hashtable(java.io.File directory,
                 int versionId,
                 java.lang.String access,
                 LockFactory lockFactory)
          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

open

public void open()
          throws java.io.IOException
Overrides:
open in class FileHandler<Hashtable.Header,Hashtable.Posting>
Throws:
java.io.IOException

getVersionId

public int getVersionId()

getHeaderByteSize

public int getHeaderByteSize()
Specified by:
getHeaderByteSize in class FileHandler<Hashtable.Header,Hashtable.Posting>

readHeader

public void readHeader(Hashtable.Header header,
                       java.io.RandomAccessFile RAF)
                throws java.io.IOException
Specified by:
readHeader in class FileHandler<Hashtable.Header,Hashtable.Posting>
Throws:
java.io.IOException

writeHeader

public void writeHeader(Hashtable.Header header,
                        java.io.RandomAccessFile RAF)
                 throws java.io.IOException
Specified by:
writeHeader in class FileHandler<Hashtable.Header,Hashtable.Posting>
Throws:
java.io.IOException

calculateHashCodePostingOffset

public int calculateHashCodePostingOffset(long hashCode)

readPosting

public void readPosting(Hashtable.Posting posting,
                        java.io.RandomAccessFile RAF)
                 throws java.io.IOException
Specified by:
readPosting in class FileHandler<Hashtable.Header,Hashtable.Posting>
Throws:
java.io.IOException

writePosting

public void writePosting(Hashtable.Posting posting,
                         java.io.RandomAccessFile RAF)
                  throws java.io.IOException
Specified by:
writePosting in class FileHandler<Hashtable.Header,Hashtable.Posting>
Throws:
java.io.IOException

markPostingAsDeleted

public void markPostingAsDeleted(int startOffset,
                                 java.io.RandomAccessFile RAF,
                                 long revision)
                          throws java.io.IOException
Specified by:
markPostingAsDeleted in class FileHandler<Hashtable.Header,Hashtable.Posting>
Throws:
java.io.IOException


Copyright © 2009 Apache Software Foundation. All Rights Reserved.