Class CacheFileWithoutCacheMT
java.lang.Object
com.biglybt.core.diskmanager.cache.impl.CacheFileWithoutCacheMT
- All Implemented Interfaces:
CacheFile
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FMFile
private long
private long
private FMFile[]
private int[]
private final CacheFileManagerImpl
private static int
private static final int
private boolean
private static int
private final TOTorrentFile
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
ConstructorsModifierConstructorDescriptionprotected
CacheFileWithoutCacheMT
(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file) -
Method Summary
Modifier and TypeMethodDescriptionvoid
flushes the cache and discards entriesvoid
close()
long
compareLength
(long compare_to) void
delete()
boolean
exists()
void
flushes the cache to disk but retains entriesvoid
flushCache
(long offset, int length) int
protected FMFile
getFile()
long
long
long
long
int
boolean
isOpen()
void
moveFile
(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
(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 Details
-
MAX_CLONES
private static final int MAX_CLONES- See Also:
-
num_clones
private static int num_clones -
max_clone_depth
private static int max_clone_depth -
manager
-
base_file
-
files
-
files_use_count
private int[] files_use_count -
torrent_file
-
moving
private boolean moving -
bytes_written
private long bytes_written -
bytes_read
private long bytes_read
-
-
Constructor Details
-
CacheFileWithoutCacheMT
protected CacheFileWithoutCacheMT(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
-
-
Method Details
-
getTorrentFile
- Specified by:
getTorrentFile
in interfaceCacheFile
-
exists
public boolean exists() -
moveFile
- Specified by:
moveFile
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
renameFile
- Specified by:
renameFile
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setAccessMode
- Specified by:
setAccessMode
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getAccessMode
public int getAccessMode()- Specified by:
getAccessMode
in interfaceCacheFile
-
setStorageType
- Specified by:
setStorageType
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
getStorageType
public int getStorageType()- Specified by:
getStorageType
in interfaceCacheFile
-
getLength
- Specified by:
getLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
compareLength
- Specified by:
compareLength
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
setLength
- 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
- Throws:
CacheFileManagerException
-
releaseFile
-
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
- Specified by:
write
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
write
- 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
Description copied from interface:CacheFile
flushes the cache to disk but retains entries- Specified by:
flushCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
flushCache
- Specified by:
flushCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
clearCache
Description copied from interface:CacheFile
flushes the cache and discards entries- Specified by:
clearCache
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
close
- Specified by:
close
in interfaceCacheFile
- Throws:
CacheFileManagerException
-
isOpen
public boolean isOpen() -
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
- Specified by:
delete
in interfaceCacheFile
- Throws:
CacheFileManagerException
-