kget
bt::Cache Class Reference
#include <cache.h>

Detailed Description
Manages the temporary data
Interface for a class which manages downloaded data. Subclasses should implement the load and save methods.
Definition at line 47 of file 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) |
| virtual void | close ()=0 |
| virtual void | create ()=0 |
| virtual void | deleteDataFiles ()=0 |
| virtual Uint64 | diskUsage ()=0 |
| virtual void | downloadStatusChanged (TorrentFile *, bool) |
| QString | getDataDir () const |
| virtual QString | getOutputPath () const =0 |
| bool | hasExistingFiles () const |
| virtual bool | hasMissingFiles (QStringList &sl)=0 |
| virtual void | load (Chunk *c)=0 |
| virtual void | loadFileMap ()=0 |
| virtual KJob * | moveDataFiles (const QMap< TorrentFileInterface *, QString > &files) |
| virtual KJob * | moveDataFiles (const QString &ndir)=0 |
| virtual void | moveDataFilesFinished (const QMap< TorrentFileInterface *, QString > &files, KJob *job) |
| virtual void | moveDataFilesFinished (KJob *job)=0 |
| virtual void | open ()=0 |
| virtual void | preallocateDiskSpace (PreallocationThread *prealloc)=0 |
| virtual bool | prep (Chunk *c)=0 |
| virtual void | save (Chunk *c)=0 |
| virtual void | saveFileMap ()=0 |
| virtual | ~Cache () |
Static Public Member Functions | |
| static bool | mappedModeAllowed () |
| static bool | preallocateFully () |
| static bool | preallocationEnabled () |
| static void | setPreallocateFully (bool on) |
| static void | setPreallocationEnabled (bool on) |
| static void | setUseFSSpecificPreallocMethod (bool on) |
| static bool | useFSSpecificPreallocMethod () |
Protected Attributes | |
| QString | datadir |
| Uint32 | mmap_failures |
| bool | preexisting_files |
| QString | tmpdir |
| Torrent & | tor |
Constructor & Destructor Documentation
Member Function Documentation
| virtual void bt::Cache::changeOutputPath | ( | const QString & | outputpath | ) | [pure virtual] |
Changes output path.
All data files should already been moved. This just modifies the datadir variable.
- Parameters:
-
outputpath New output path
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| void bt::Cache::changeTmpDir | ( | const QString & | ndir | ) | [virtual] |
Changes the tmp dir.
All data files should already been moved. This just modifies the tmpdir variable.
- Parameters:
-
ndir The new tmpdir
Reimplemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::close | ( | ) | [pure virtual] |
| virtual void bt::Cache::create | ( | ) | [pure virtual] |
Create all the data files to store the data.
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::deleteDataFiles | ( | ) | [pure virtual] |
Delete all data files, in case of multi file torrents empty directories should also be deleted.
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual Uint64 bt::Cache::diskUsage | ( | ) | [pure virtual] |
Get the number of bytes all the files of this torrent are currently using on disk.
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::downloadStatusChanged | ( | TorrentFile * | , | |
| bool | ||||
| ) | [inline, virtual] |
Does nothing, can be overridden to be alerted of download status changes of a TorrentFile.
Reimplemented in BTCache.
| QString bt::Cache::getDataDir | ( | ) | const [inline] |
| virtual QString bt::Cache::getOutputPath | ( | ) | const [pure virtual] |
Get the actual output path.
- Returns:
- The output path
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| bool bt::Cache::hasExistingFiles | ( | ) | const [inline] |
| virtual bool bt::Cache::hasMissingFiles | ( | QStringList & | sl | ) | [pure virtual] |
Test all files and see if they are not missing.
If so put them in a list
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::load | ( | Chunk * | c | ) | [pure virtual] |
Load a chunk into memory.
If something goes wrong, an Error should be thrown.
- Parameters:
-
c The Chunk
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::loadFileMap | ( | ) | [pure virtual] |
Load the file map of a torrent.
If it doesn't exist, it needs to be created.
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| bool bt::Cache::mappedModeAllowed | ( | ) | [static] |
| KJob * bt::Cache::moveDataFiles | ( | const QMap< TorrentFileInterface *, QString > & | files | ) | [virtual] |
Move some files to a new location.
- Parameters:
-
files Map of files to move and their new location
- Returns:
- KJob The job doing the move
Reimplemented in bt::MultiFileCache.
Move the data files to a new directory.
- Parameters:
-
ndir The directory
- Returns:
- The job doing the move
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| void bt::Cache::moveDataFilesFinished | ( | const QMap< TorrentFileInterface *, QString > & | files, | |
| KJob * | job | |||
| ) | [virtual] |
The job doing moveDataFiles (with the map parameter) has finished.
- Parameters:
-
files The files map with all the moves job The job doing the move
Reimplemented in bt::MultiFileCache.
| virtual void bt::Cache::moveDataFilesFinished | ( | KJob * | job | ) | [pure virtual] |
A move of a bunch of data files has finished.
- Parameters:
-
job The job doing the move
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::open | ( | ) | [pure virtual] |
| virtual void bt::Cache::preallocateDiskSpace | ( | PreallocationThread * | prealloc | ) | [pure virtual] |
Preallocate diskspace for all files.
- Parameters:
-
prealloc The thread doing the preallocation
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| static bool bt::Cache::preallocateFully | ( | ) | [inline, static] |
| static bool bt::Cache::preallocationEnabled | ( | ) | [inline, static] |
| virtual bool bt::Cache::prep | ( | Chunk * | c | ) | [pure virtual] |
Prepare a chunk for downloading.
- Parameters:
-
c The Chunk
- Returns:
- true if ok, false otherwise
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::save | ( | Chunk * | c | ) | [pure virtual] |
Save a chunk to disk.
If something goes wrong, an Error should be thrown.
- Parameters:
-
c The Chunk
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| virtual void bt::Cache::saveFileMap | ( | ) | [pure virtual] |
Save the file map of a torrent.
Implemented in BTCache, bt::MultiFileCache, and bt::SingleFileCache.
| static void bt::Cache::setPreallocateFully | ( | bool | on | ) | [inline, static] |
| static void bt::Cache::setPreallocationEnabled | ( | bool | on | ) | [inline, static] |
| static void bt::Cache::setUseFSSpecificPreallocMethod | ( | bool | on | ) | [inline, static] |
| static bool bt::Cache::useFSSpecificPreallocMethod | ( | ) | [inline, static] |
Member Data Documentation
QString bt::Cache::datadir [protected] |
Uint32 bt::Cache::mmap_failures [protected] |
bool bt::Cache::preexisting_files [protected] |
QString bt::Cache::tmpdir [protected] |
Torrent& bt::Cache::tor [protected] |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference