com.timeindexing.io
Interface IndexFileWriter

All Known Subinterfaces:
IndexFileInteractor
All Known Implementing Classes:
AbstractFileIO, ExternalIndexIO, InlineIndexIO, ShadowIndexIO

public interface IndexFileWriter

An interface for writers of indexes.


Method Summary
 long close()
          Close the index.
 long create(IndexProperties indexProperties)
          create an Index
 long flush()
          Flush the index.
 long getAppendPosition()
          Get the append position
 java.nio.channels.FileLock getWriteLock()
          Get a write-lock on this index.
 boolean gotoAppendPosition()
          Goto the append position
 boolean isWriteLocked()
          Has the Index been write-locked.
 long open(IndexProperties indexProperties)
           
 boolean releaseWriteLock()
          Release a FileLock.
 long writeHeader(byte headerType)
          Write the header to the index.
 long writeItem(ManagedIndexItem item)
          Write an IndexItem to the index.
 

Method Detail

open

public long open(IndexProperties indexProperties)
          throws java.io.IOException,
                 IndexOpenException
Throws:
java.io.IOException
IndexOpenException

create

public long create(IndexProperties indexProperties)
            throws java.io.IOException,
                   IndexCreateException
create an Index

Throws:
java.io.IOException
IndexCreateException

writeHeader

public long writeHeader(byte headerType)
                 throws java.io.IOException
Write the header to the index.

Parameters:
headerType - the type of header, e.g FileType.INLINE_INDEX or FileType.EXTERNAL_INDEX
Throws:
java.io.IOException

writeItem

public long writeItem(ManagedIndexItem item)
               throws java.io.IOException
Write an IndexItem to the index.

Throws:
java.io.IOException

getAppendPosition

public long getAppendPosition()
Get the append position


gotoAppendPosition

public boolean gotoAppendPosition()
                           throws java.io.IOException
Goto the append position

Throws:
java.io.IOException

flush

public long flush()
           throws java.io.IOException
Flush the index.

Throws:
java.io.IOException

close

public long close()
           throws java.io.IOException
Close the index.

Throws:
java.io.IOException

getWriteLock

public java.nio.channels.FileLock getWriteLock()
Get a write-lock on this index.


releaseWriteLock

public boolean releaseWriteLock()
Release a FileLock.


isWriteLocked

public boolean isWriteLocked()
Has the Index been write-locked.