org.apache.labs.bananadb.store.data
Class FileHandler<H extends FileHandler.Header,P extends FileHandler.Posting>

java.lang.Object
  extended by org.apache.labs.bananadb.store.data.FileHandler<H,P>
Direct Known Subclasses:
HashCodesPartition, Hashtable, KeysPartition, Metadata, ValuesPartition

public abstract class FileHandler<H extends FileHandler.Header,P extends FileHandler.Posting>
extends java.lang.Object

Since:
2009-mar-16 15:28:29
Author:
kalle

Nested Class Summary
static class FileHandler.Header
           
static class FileHandler.Posting
           
 
Constructor Summary
protected FileHandler(java.io.File directory, int id, java.lang.String suffix, java.lang.String access, LockFactory lockFactory)
           
 
Method Summary
 void close()
           
 boolean exists()
           
 void format(long size)
           
 void format(long size, byte defaultValue)
           
 java.io.File getFile()
           
abstract  int getHeaderByteSize()
           
 Lock getLock()
           
 java.io.RandomAccessFile getRAF()
           
 void markPostingAsDeleted(int startOffset, long revision)
          Marks the posting at the start offset as deleted
abstract  void markPostingAsDeleted(int startOffset, java.io.RandomAccessFile RAF, long revision)
           
 void open()
           
 void readHeader(H header)
           
 void readHeader(H header, int startOffset)
           
 void readHeader(H header, int startOffset, java.io.RandomAccessFile RAF)
           
abstract  void readHeader(H header, java.io.RandomAccessFile RAF)
           
 void readPosting(P posting, int startOffset)
           
 void readPosting(P posting, int startOffset, java.io.RandomAccessFile RAF)
           
abstract  void readPosting(P posting, java.io.RandomAccessFile RAF)
           
 void writeHeader(H header)
           
 void writeHeader(H header, int startOffset)
           
 void writeHeader(H header, int startOffset, java.io.RandomAccessFile RAF)
           
abstract  void writeHeader(H header, java.io.RandomAccessFile RAF)
           
 void writePosting(P posting)
           
 void writePosting(P posting, int startOffset)
           
 void writePosting(P posting, int startOffset, java.io.RandomAccessFile RAF)
           
abstract  void writePosting(P posting, java.io.RandomAccessFile RAF)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHandler

protected FileHandler(java.io.File directory,
                      int id,
                      java.lang.String suffix,
                      java.lang.String access,
                      LockFactory lockFactory)
               throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getLock

public Lock getLock()

format

public void format(long size)
            throws java.io.IOException
Throws:
java.io.IOException

exists

public boolean exists()

format

public void format(long size,
                   byte defaultValue)
            throws java.io.IOException
Throws:
java.io.IOException

open

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

close

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

getHeaderByteSize

public abstract int getHeaderByteSize()

getFile

public java.io.File getFile()

getRAF

public java.io.RandomAccessFile getRAF()

markPostingAsDeleted

public void markPostingAsDeleted(int startOffset,
                                 long revision)
                          throws java.io.IOException
Marks the posting at the start offset as deleted

Parameters:
startOffset -
revision -
Throws:
java.io.IOException

markPostingAsDeleted

public abstract void markPostingAsDeleted(int startOffset,
                                          java.io.RandomAccessFile RAF,
                                          long revision)
                                   throws java.io.IOException
Throws:
java.io.IOException

writePosting

public void writePosting(P posting,
                         int startOffset)
                  throws java.io.IOException
Throws:
java.io.IOException

writePosting

public void writePosting(P posting,
                         int startOffset,
                         java.io.RandomAccessFile RAF)
                  throws java.io.IOException
Throws:
java.io.IOException

writePosting

public void writePosting(P posting)
                  throws java.io.IOException
Throws:
java.io.IOException

writePosting

public abstract void writePosting(P posting,
                                  java.io.RandomAccessFile RAF)
                           throws java.io.IOException
Throws:
java.io.IOException

readPosting

public void readPosting(P posting,
                        int startOffset)
                 throws java.io.IOException
Throws:
java.io.IOException

readPosting

public void readPosting(P posting,
                        int startOffset,
                        java.io.RandomAccessFile RAF)
                 throws java.io.IOException
Throws:
java.io.IOException

readPosting

public abstract void readPosting(P posting,
                                 java.io.RandomAccessFile RAF)
                          throws java.io.IOException
Throws:
java.io.IOException

writeHeader

public void writeHeader(H header)
                 throws java.io.IOException
Throws:
java.io.IOException

writeHeader

public void writeHeader(H header,
                        int startOffset)
                 throws java.io.IOException
Throws:
java.io.IOException

writeHeader

public void writeHeader(H header,
                        int startOffset,
                        java.io.RandomAccessFile RAF)
                 throws java.io.IOException
Throws:
java.io.IOException

writeHeader

public abstract void writeHeader(H header,
                                 java.io.RandomAccessFile RAF)
                          throws java.io.IOException
Throws:
java.io.IOException

readHeader

public void readHeader(H header)
                throws java.io.IOException
Throws:
java.io.IOException

readHeader

public void readHeader(H header,
                       int startOffset)
                throws java.io.IOException
Throws:
java.io.IOException

readHeader

public void readHeader(H header,
                       int startOffset,
                       java.io.RandomAccessFile RAF)
                throws java.io.IOException
Throws:
java.io.IOException

readHeader

public abstract void readHeader(H header,
                                java.io.RandomAccessFile RAF)
                         throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2009 Apache Software Foundation. All Rights Reserved.