Class CacheFileWithoutCacheMT
- java.lang.Object
-
- com.biglybt.core.diskmanager.cache.impl.CacheFileWithoutCacheMT
-
-
Field Summary
Fields Modifier and Type Field Description private FMFile
base_file
private long
bytes_read
private long
bytes_written
private FMFile[]
files
private int[]
files_use_count
private CacheFileManagerImpl
manager
private static int
max_clone_depth
private static int
MAX_CLONES
private boolean
moving
private static int
num_clones
private TOTorrentFile
torrent_file
-
Fields inherited from interface com.biglybt.core.diskmanager.cache.CacheFile
CF_READ, CF_WRITE, CP_FLUSH, CP_NONE, CP_READ_CACHE, CT_COMPACT, CT_LINEAR, CT_PIECE_REORDER, CT_PIECE_REORDER_COMPACT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CacheFileWithoutCacheMT(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
flushes the cache and discards entriesvoid
close()
long
compareLength(long compare_to)
void
delete()
boolean
exists()
void
flushCache()
flushes the cache to disk but retains entriesvoid
flushCache(long offset, int length)
int
getAccessMode()
protected FMFile
getFile()
long
getLastModified()
long
getLength()
long
getSessionBytesRead()
long
getSessionBytesWritten()
int
getStorageType()
TOTorrentFile
getTorrentFile()
boolean
isOpen()
void
moveFile(java.io.File new_file, FileUtil.ProgressListener pl)
void
read(DirectByteBuffer[] buffers, long position, short policy)
void
read(DirectByteBuffer buffer, long position, short policy)
protected void
releaseFile(FMFile file)
void
renameFile(java.lang.String new_file)
void
setAccessMode(int mode)
void
setLength(long length)
void
setPieceComplete(int piece_number, DirectByteBuffer piece_data)
void
setStorageType(int type, boolean force)
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
-
MAX_CLONES
private static final int MAX_CLONES
- See Also:
- Constant Field Values
-
num_clones
private static int num_clones
-
max_clone_depth
private static int max_clone_depth
-
manager
private final CacheFileManagerImpl manager
-
base_file
private final FMFile base_file
-
files
private FMFile[] files
-
files_use_count
private int[] files_use_count
-
torrent_file
private final TOTorrentFile torrent_file
-
moving
private boolean moving
-
bytes_written
private long bytes_written
-
bytes_read
private long bytes_read
-
-
Constructor Detail
-
CacheFileWithoutCacheMT
protected CacheFileWithoutCacheMT(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
-
-
Method Detail
-
getTorrentFile
public TOTorrentFile getTorrentFile()
- Specified by:
getTorrentFile
in interfaceCacheFile
-
moveFile
public void moveFile(java.io.File new_file, FileUtil.ProgressListener pl) throws CacheFileManagerException
- Specified by:
moveFile
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
renameFile
public void renameFile(java.lang.String new_file) throws CacheFileManagerException
- Specified by:
renameFile
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setAccessMode
public void setAccessMode(int mode) throws CacheFileManagerException
- Specified by:
setAccessMode
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getAccessMode
public int getAccessMode()
- Specified by:
getAccessMode
in interfaceCacheFile
-
setStorageType
public void setStorageType(int type, boolean force) throws CacheFileManagerException
- Specified by:
setStorageType
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getStorageType
public int getStorageType()
- Specified by:
getStorageType
in interfaceCacheFile
-
getLength
public long getLength() throws CacheFileManagerException
- Specified by:
getLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
compareLength
public long compareLength(long compare_to) throws CacheFileManagerException
- Specified by:
compareLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setLength
public void setLength(long length) throws CacheFileManagerException
- Specified by:
setLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setPieceComplete
public void setPieceComplete(int piece_number, DirectByteBuffer piece_data) throws CacheFileManagerException
- Specified by:
setPieceComplete
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getFile
protected FMFile getFile() throws CacheFileManagerException
- Throws:
CacheFileManagerException
-
releaseFile
protected void releaseFile(FMFile file)
-
read
public void read(DirectByteBuffer[] buffers, long position, short policy) throws CacheFileManagerException
- Specified by:
read
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
read
public void read(DirectByteBuffer buffer, long position, short policy) throws CacheFileManagerException
- Specified by:
read
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
write
public void write(DirectByteBuffer buffer, long position) throws CacheFileManagerException
- Specified by:
write
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
write
public void write(DirectByteBuffer[] buffers, long position) throws CacheFileManagerException
- Specified by:
write
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
writeAndHandoverBuffer
public void writeAndHandoverBuffer(DirectByteBuffer buffer, long position) throws CacheFileManagerException
Description copied from interface:CacheFile
writes the block to the cache and gives control of the buffer to the cache.- Specified by:
writeAndHandoverBuffer
in interfaceCacheFile
- Throws:
CacheFileManagerException
- write failed and buffer *not* taken - i.e. caller must de-allocate
-
writeAndHandoverBuffers
public void writeAndHandoverBuffers(DirectByteBuffer[] buffers, long position) throws CacheFileManagerException
- Specified by:
writeAndHandoverBuffers
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
flushCache
public void flushCache() throws CacheFileManagerException
Description copied from interface:CacheFile
flushes the cache to disk but retains entries- Specified by:
flushCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
flushCache
public void flushCache(long offset, int length) throws CacheFileManagerException
- Specified by:
flushCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
clearCache
public void clearCache() throws CacheFileManagerException
Description copied from interface:CacheFile
flushes the cache and discards entries- Specified by:
clearCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
close
public void close() throws CacheFileManagerException
- Specified by:
close
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getSessionBytesRead
public long getSessionBytesRead()
- Specified by:
getSessionBytesRead
in interfaceCacheFile
-
getSessionBytesWritten
public long getSessionBytesWritten()
- Specified by:
getSessionBytesWritten
in interfaceCacheFile
-
getLastModified
public long getLastModified()
- Specified by:
getLastModified
in interfaceCacheFile
-
delete
public void delete() throws CacheFileManagerException
- Specified by:
delete
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
-