com.aelitis.azureus.core.diskmanager.cache
Interface CacheFile

All Known Implementing Classes:
CacheFileWithCache, CacheFileWithoutCache, CacheFileWithoutCacheMT

public interface CacheFile

Author:
parg

Field Summary
static int CF_READ
           
static int CF_WRITE
           
static short CP_FLUSH
           
static short CP_NONE
           
static short CP_READ_CACHE
           
static int CT_COMPACT
           
static int CT_LINEAR
           
static int CT_PIECE_REORDER
           
static int CT_PIECE_REORDER_COMPACT
           
 
Method Summary
 void clearCache()
          flushes the cache and discards entries
 void close()
           
 long compareLength(long compare_to)
           
 void delete()
           
 boolean exists()
           
 void flushCache()
          flushes the cache to disk but retains entries
 int getAccessMode()
           
 long getLength()
           
 long getSessionBytesRead()
           
 long getSessionBytesWritten()
           
 int getStorageType()
           
 TOTorrentFile getTorrentFile()
           
 boolean isOpen()
           
 void moveFile(java.io.File new_file)
           
 void read(DirectByteBuffer[] buffers, long offset, short policy)
           
 void read(DirectByteBuffer buffer, long offset, short policy)
           
 void renameFile(java.lang.String new_name)
           
 void setAccessMode(int mode)
           
 void setLength(long length)
           
 void setPieceComplete(int piece_number, DirectByteBuffer piece_data)
           
 void setStorageType(int type)
           
 void write(DirectByteBuffer[] buffers, long position)
           
 void write(DirectByteBuffer buffer, long position)
           
 void writeAndHandoverBuffer(DirectByteBuffer buffer, long position)
          writes the block to the cache and gives control of the buffer to the cache.
 void writeAndHandoverBuffers(DirectByteBuffer[] buffers, long position)
           
 

Field Detail

CT_LINEAR

static final int CT_LINEAR
See Also:
Constant Field Values

CT_COMPACT

static final int CT_COMPACT
See Also:
Constant Field Values

CT_PIECE_REORDER

static final int CT_PIECE_REORDER
See Also:
Constant Field Values

CT_PIECE_REORDER_COMPACT

static final int CT_PIECE_REORDER_COMPACT
See Also:
Constant Field Values

CF_READ

static final int CF_READ
See Also:
Constant Field Values

CF_WRITE

static final int CF_WRITE
See Also:
Constant Field Values

CP_NONE

static final short CP_NONE
See Also:
Constant Field Values

CP_READ_CACHE

static final short CP_READ_CACHE
See Also:
Constant Field Values

CP_FLUSH

static final short CP_FLUSH
See Also:
Constant Field Values
Method Detail

getTorrentFile

TOTorrentFile getTorrentFile()

exists

boolean exists()

moveFile

void moveFile(java.io.File new_file)
              throws CacheFileManagerException
Throws:
CacheFileManagerException

renameFile

void renameFile(java.lang.String new_name)
                throws CacheFileManagerException
Throws:
CacheFileManagerException

setAccessMode

void setAccessMode(int mode)
                   throws CacheFileManagerException
Throws:
CacheFileManagerException

getAccessMode

int getAccessMode()

setStorageType

void setStorageType(int type)
                    throws CacheFileManagerException
Throws:
CacheFileManagerException

getStorageType

int getStorageType()

getLength

long getLength()
               throws CacheFileManagerException
Throws:
CacheFileManagerException

compareLength

long compareLength(long compare_to)
                   throws CacheFileManagerException
Throws:
CacheFileManagerException

setLength

void setLength(long length)
               throws CacheFileManagerException
Throws:
CacheFileManagerException

setPieceComplete

void setPieceComplete(int piece_number,
                      DirectByteBuffer piece_data)
                      throws CacheFileManagerException
Throws:
CacheFileManagerException

read

void read(DirectByteBuffer buffer,
          long offset,
          short policy)
          throws CacheFileManagerException
Throws:
CacheFileManagerException

read

void read(DirectByteBuffer[] buffers,
          long offset,
          short policy)
          throws CacheFileManagerException
Throws:
CacheFileManagerException

write

void write(DirectByteBuffer buffer,
           long position)
           throws CacheFileManagerException
Throws:
CacheFileManagerException

write

void write(DirectByteBuffer[] buffers,
           long position)
           throws CacheFileManagerException
Throws:
CacheFileManagerException

writeAndHandoverBuffer

void writeAndHandoverBuffer(DirectByteBuffer buffer,
                            long position)
                            throws CacheFileManagerException
writes the block to the cache and gives control of the buffer to the cache.

Parameters:
buffer -
position -
Throws:
CacheFileManagerException - write failed and buffer *not* taken - i.e. caller must de-allocate

writeAndHandoverBuffers

void writeAndHandoverBuffers(DirectByteBuffer[] buffers,
                             long position)
                             throws CacheFileManagerException
Throws:
CacheFileManagerException

flushCache

void flushCache()
                throws CacheFileManagerException
flushes the cache to disk but retains entries

Throws:
CacheFileManagerException

clearCache

void clearCache()
                throws CacheFileManagerException
flushes the cache and discards entries

Throws:
CacheFileManagerException

close

void close()
           throws CacheFileManagerException
Throws:
CacheFileManagerException

isOpen

boolean isOpen()

getSessionBytesRead

long getSessionBytesRead()

getSessionBytesWritten

long getSessionBytesWritten()

delete

void delete()
            throws CacheFileManagerException
Throws:
CacheFileManagerException