Class CacheFileWithCache
java.lang.Object
com.biglybt.core.diskmanager.cache.impl.CacheFileWithCache
- All Implemented Interfaces:
CacheFile
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprivate longprivate longprotected final TreeSet<CacheEntry> protected static final Comparator<CacheEntry> protected intprotected final FMFileprotected longprotected longprotected longprivate static final LogIDsprotected final CacheFileManagerImplprotected CacheFileManagerExceptionprotected intprotected intprotected longprotected longprotected final Averageprotected intprotected static final intprotected final Averageprotected long[]protected intprotected static final intprotected static final intprotected static final intprivate static final byteprotected final AEMonitorprotected TOTorrentprotected TOTorrentFileprotected static booleanprotected static final booleanFields inherited from interface 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
ConstructorsModifierConstructorDescriptionprotectedCacheFileWithCache(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidflushes the cache and discards entriesvoidclose()longcompareLength(long compare_to) voiddelete()booleanexists()voidflushes the cache to disk but retains entriesprotected voidflushCache(long file_start_position, boolean release_entries, long minumum_to_release) voidflushCache(long file_position, int length) protected voidflushCache(long file_position, long length, boolean release_entries, long minimum_to_release, long oldest_dirty_time, long min_chunk_size) protected voidflushCachePublic(boolean release_entries, long minumum_to_release) protected voidflushCacheSupport(long file_position, long length, boolean release_entries, long minimum_to_release, long oldest_dirty_time, long min_chunk_size) protected voidflushOldDirtyData(long oldest_dirty_time) protected voidflushOldDirtyData(long oldest_dirty_time, long min_chunk_size) intprotected voidgetBytesInCache(boolean[] result, long[] absolute_offsets, long[] lengths) protected FMFilelonglongprotected StringgetName()longlongintbooleanisOpen()voidmoveFile(File new_file, FileUtil.ProgressListener pl) protected voidmultiBlockFlush(List<CacheEntry> multi_block_entries, long multi_block_start, long multi_block_next, boolean release_entries) voidread(DirectByteBuffer[] buffers, long position, short policy) voidread(DirectByteBuffer buffer, long position, short policy) protected voidreadCache(DirectByteBuffer file_buffer, long file_position, boolean recursive, boolean disable_read_cache) voidrenameFile(String new_name) voidsetAccessMode(int mode) voidsetLength(long length) protected voidvoidsetPieceComplete(int piece_number, DirectByteBuffer piece_data) voidsetStorageType(int type, boolean force) protected voidvoidwrite(DirectByteBuffer[] buffers, long position) voidwrite(DirectByteBuffer buffer, long position) voidwriteAndHandoverBuffer(DirectByteBuffer buffer, long position) writes the block to the cache and gives control of the buffer to the cache.voidwriteAndHandoverBuffers(DirectByteBuffer[] buffers, long position) protected voidwriteCache(DirectByteBuffer file_buffer, long file_position, boolean buffer_handed_over)
-
Field Details
-
SS_CACHE
private static final byte SS_CACHE- See Also:
-
LOGID
-
comparator
-
TRACE
protected static boolean TRACE -
TRACE_CACHE_CONTENTS
protected static final boolean TRACE_CACHE_CONTENTS- See Also:
-
READAHEAD_LOW_LIMIT
protected static final int READAHEAD_LOW_LIMIT- See Also:
-
READAHEAD_HIGH_LIMIT
protected static final int READAHEAD_HIGH_LIMIT- See Also:
-
READAHEAD_HISTORY
protected static final int READAHEAD_HISTORY- See Also:
-
manager
-
file
-
access_mode
protected int access_mode -
torrent_file
-
torrent
-
file_offset_in_torrent
protected long file_offset_in_torrent -
read_history
protected long[] read_history -
read_history_next
protected int read_history_next -
cache
-
current_read_ahead_size
protected int current_read_ahead_size -
READ_AHEAD_STATS_WAIT_TICKS
protected static final int READ_AHEAD_STATS_WAIT_TICKS- See Also:
-
read_ahead_stats_wait
protected int read_ahead_stats_wait -
read_ahead_made_average
-
read_ahead_used_average
-
read_ahead_bytes_made
protected long read_ahead_bytes_made -
last_read_ahead_bytes_made
protected long last_read_ahead_bytes_made -
read_ahead_bytes_used
protected long read_ahead_bytes_used -
last_read_ahead_bytes_used
protected long last_read_ahead_bytes_used -
piece_size
protected int piece_size -
piece_offset
protected int piece_offset -
this_mon
-
pending_exception
-
bytes_written
private long bytes_written -
bytes_read
private long bytes_read
-
-
Constructor Details
-
CacheFileWithCache
protected CacheFileWithCache(CacheFileManagerImpl _manager, FMFile _file, TOTorrentFile _torrent_file)
-
-
Method Details
-
getTorrentFile
- Specified by:
getTorrentFilein interfaceCacheFile
-
updateStats
protected void updateStats() -
readCache
protected void readCache(DirectByteBuffer file_buffer, long file_position, boolean recursive, boolean disable_read_cache) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
writeCache
protected void writeCache(DirectByteBuffer file_buffer, long file_position, boolean buffer_handed_over) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushCache
protected void flushCache(long file_position, long length, boolean release_entries, long minimum_to_release, long oldest_dirty_time, long min_chunk_size) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushCacheSupport
protected void flushCacheSupport(long file_position, long length, boolean release_entries, long minimum_to_release, long oldest_dirty_time, long min_chunk_size) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
multiBlockFlush
protected void multiBlockFlush(List<CacheEntry> multi_block_entries, long multi_block_start, long multi_block_next, boolean release_entries) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushCache
protected void flushCache(long file_start_position, boolean release_entries, long minumum_to_release) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushCachePublic
protected void flushCachePublic(boolean release_entries, long minumum_to_release) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushOldDirtyData
protected void flushOldDirtyData(long oldest_dirty_time, long min_chunk_size) throws CacheFileManagerException - Throws:
CacheFileManagerException
-
flushOldDirtyData
- Throws:
CacheFileManagerException
-
getBytesInCache
protected void getBytesInCache(boolean[] result, long[] absolute_offsets, long[] lengths) -
checkPendingException
- Throws:
CacheFileManagerException
-
setPendingException
-
getName
-
getFMFile
-
exists
-
moveFile
- Specified by:
moveFilein interfaceCacheFile- Throws:
CacheFileManagerException
-
renameFile
- Specified by:
renameFilein interfaceCacheFile- Throws:
CacheFileManagerException
-
setAccessMode
- Specified by:
setAccessModein interfaceCacheFile- Throws:
CacheFileManagerException
-
getAccessMode
public int getAccessMode()- Specified by:
getAccessModein interfaceCacheFile
-
setStorageType
- Specified by:
setStorageTypein interfaceCacheFile- Throws:
CacheFileManagerException
-
getStorageType
public int getStorageType()- Specified by:
getStorageTypein interfaceCacheFile
-
getLength
- Specified by:
getLengthin interfaceCacheFile- Throws:
CacheFileManagerException
-
compareLength
- Specified by:
compareLengthin interfaceCacheFile- Throws:
CacheFileManagerException
-
setLength
- Specified by:
setLengthin interfaceCacheFile- Throws:
CacheFileManagerException
-
setPieceComplete
public void setPieceComplete(int piece_number, DirectByteBuffer piece_data) throws CacheFileManagerException - Specified by:
setPieceCompletein interfaceCacheFile- Throws:
CacheFileManagerException
-
read
public void read(DirectByteBuffer[] buffers, long position, short policy) throws CacheFileManagerException - Specified by:
readin interfaceCacheFile- Throws:
CacheFileManagerException
-
read
public void read(DirectByteBuffer buffer, long position, short policy) throws CacheFileManagerException - Specified by:
readin interfaceCacheFile- Throws:
CacheFileManagerException
-
write
- Specified by:
writein interfaceCacheFile- Throws:
CacheFileManagerException
-
write
- Specified by:
writein interfaceCacheFile- Throws:
CacheFileManagerException
-
writeAndHandoverBuffer
public void writeAndHandoverBuffer(DirectByteBuffer buffer, long position) throws CacheFileManagerException Description copied from interface:CacheFilewrites the block to the cache and gives control of the buffer to the cache.- Specified by:
writeAndHandoverBufferin interfaceCacheFile- Parameters:
buffer-position-- 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:
writeAndHandoverBuffersin interfaceCacheFile- Throws:
CacheFileManagerException
-
flushCache
Description copied from interface:CacheFileflushes the cache to disk but retains entries- Specified by:
flushCachein interfaceCacheFile- Throws:
CacheFileManagerException
-
flushCache
- Specified by:
flushCachein interfaceCacheFile- Throws:
CacheFileManagerException
-
clearCache
Description copied from interface:CacheFileflushes the cache and discards entries- Specified by:
clearCachein interfaceCacheFile- Throws:
CacheFileManagerException
-
close
- Specified by:
closein interfaceCacheFile- Throws:
CacheFileManagerException
-
isOpen
-
getSessionBytesRead
public long getSessionBytesRead()- Specified by:
getSessionBytesReadin interfaceCacheFile
-
getSessionBytesWritten
public long getSessionBytesWritten()- Specified by:
getSessionBytesWrittenin interfaceCacheFile
-
getLastModified
public long getLastModified()- Specified by:
getLastModifiedin interfaceCacheFile
-
delete
- Specified by:
deletein interfaceCacheFile- Throws:
CacheFileManagerException
-