|
libktorrent
2.1.1
|
Manages the temporary data. More...
#include <cache.h>

Public Member Functions | |
| Cache (Torrent &tor, const QString &tmpdir, const QString &datadir) | |
| virtual void | changeOutputPath (const QString &outputpath)=0 |
| virtual void | changeTmpDir (const QString &ndir) |
| void | checkMemoryUsage () |
| void | clearPieces (Chunk *c) |
| virtual void | close ()=0 |
| virtual void | create ()=0 |
| virtual Job * | deleteDataFiles ()=0 |
| virtual Uint64 | diskUsage ()=0 |
| virtual void | downloadStatusChanged (TorrentFile *, bool) |
| Does nothing, can be overridden to be alerted of download status changes of a TorrentFile. | |
| QString | getDataDir () const |
| Get the datadir. | |
| virtual bool | getMountPoints (QSet< QString > &mps)=0 |
| virtual QString | getOutputPath () const =0 |
| bool | hasExistingFiles () const |
| See if the download has existing files. | |
| virtual bool | hasMissingFiles (QStringList &sl)=0 |
| bool | isStorageMounted (QStringList &missing) |
| Is the storage mounted ? | |
| virtual void | loadFileMap ()=0 |
| void | loadMountPoints () |
| virtual PieceData::Ptr | loadPiece (Chunk *c, Uint32 off, Uint32 length)=0 |
| virtual Job * | moveDataFiles (const QMap< TorrentFileInterface *, QString > &files) |
| virtual Job * | moveDataFiles (const QString &ndir)=0 |
| virtual void | moveDataFilesFinished (const QMap< TorrentFileInterface *, QString > &files, Job *job) |
| virtual void | moveDataFilesFinished (Job *job)=0 |
| virtual void | open ()=0 |
| virtual PieceData::Ptr | preparePiece (Chunk *c, Uint32 off, Uint32 length)=0 |
| virtual void | preparePreallocation (PreallocationThread *prealloc)=0 |
| virtual void | saveFileMap ()=0 |
| virtual void | savePiece (PieceData::Ptr piece)=0 |
Static Public Member Functions | |
| static bool | mappedModeAllowed () |
| static bool | preallocateFully () |
| static bool | preallocationEnabled () |
| static void | setPreallocateFully (bool on) |
| static void | setPreallocationEnabled (bool on) |
Protected Types | |
| typedef QMultiMap< Chunk *, PieceData::Ptr > | PieceCache |
Protected Member Functions | |
| void | cleanupPieceCache () |
| void | clearPieceCache () |
| PieceData::Ptr | findPiece (Chunk *c, Uint32 off, Uint32 len, bool read_only) |
| void | insertPiece (Chunk *c, PieceData::Ptr p) |
| void | saveMountPoints (const QSet< QString > &mp) |
Protected Attributes | |
| QString | datadir |
| Uint32 | mmap_failures |
| QSet< QString > | mount_points |
| PieceCache | piece_cache |
| bool | preexisting_files |
| QString | tmpdir |
| Torrent & | tor |
|
pure virtual |
Changes output path. All data files should already been moved. This just modifies the datadir variable.
| outputpath | New output path |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
virtual |
Changes the tmp dir. All data files should already been moved. This just modifies the tmpdir variable.
| ndir | The new tmpdir |
Reimplemented in bt::MultiFileCache, and bt::SingleFileCache.
| void bt::Cache::checkMemoryUsage | ( | ) |
Check memory usage and free all PieceData objects which are no longer needed.
| void bt::Cache::clearPieces | ( | Chunk * | c | ) |
Clear all pieces of a chunk
| c | The chunk |
|
pure virtual |
Close the cache file(s).
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Create all the data files to store the data.
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Delete all data files, in case of multi file torrents empty directories should also be deleted.
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Get the number of bytes all the files of this torrent are currently using on disk.
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Determine the mount points of all the files in this torrent
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Get the actual output path.
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Test all files and see if they are not missing. If so put them in a list
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Load the file map of a torrent. If it doesn't exist, it needs to be created.
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
| void bt::Cache::loadMountPoints | ( | ) |
Load the mount points of this torrent
|
pure virtual |
Load a piece into memory. If something goes wrong, an Error should be thrown.
| c | The Chunk |
| off | The offset of the piece |
| length | The length of the piece |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
static |
See if we are allowed to use mmap, when loading chunks. This will return false if we are close to system limits.
|
virtual |
Move some files to a new location
| files | Map of files to move and their new location |
Reimplemented in bt::MultiFileCache.
|
pure virtual |
Move the data files to a new directory.
| ndir | The directory |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
virtual |
The job doing moveDataFiles (with the map parameter) has finished
| files | The files map with all the moves |
| job | The job doing the move |
Reimplemented in bt::MultiFileCache.
|
pure virtual |
A move of a bunch of data files has finished
| job | The job doing the move |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Open the cache file(s)
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
inlinestatic |
|
inlinestatic |
|
pure virtual |
Prepare a piece for writing. If something goes wrong, an Error should be thrown.
| c | The Chunk |
| off | The offset of the piece |
| length | The length of the piece |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Prepare disksapce preallocation
| prealloc | The thread going to do the preallocation |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Save the file map of a torrent
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
pure virtual |
Save a piece to disk, will only actually save in buffered mode
| piece | The piece |
Implemented in bt::MultiFileCache, and bt::SingleFileCache.
|
inlinestatic |
|
inlinestatic |
1.8.18