#include <cachefile.h>
|
enum | Mode { READ,
WRITE,
RW
} |
|
typedef QSharedPointer< CacheFile > | Ptr |
|
|
void | changePath (const QString &npath) |
| Change the path of the file.
|
|
void | close () |
|
Uint64 | diskUsage () |
| Get the number of bytes this cache file is taking up.
|
|
void * | map (MMappeable *thing, Uint64 off, Uint32 size, Mode mode) |
|
void | open (const QString &path, Uint64 size) |
|
void | preallocate (PreallocationThread *prealloc) |
|
void | read (Uint8 *buf, Uint32 size, Uint64 off) |
|
void | unmap (void *ptr, Uint32 size) |
|
void | write (const Uint8 *buf, Uint32 size, Uint64 off) |
|
- Author
- Joris Guisson joris.nosp@m..gui.nosp@m.sson@.nosp@m.gmai.nosp@m.l.com
Used by Single and MultiFileCache to write to disk.
Definition at line 54 of file cachefile.h.
◆ close()
void bt::CacheFile::close |
( |
| ) |
|
Close the file, everything will be unmapped.
- Parameters
-
to_be_reopened | Indicates if the close is temporarely (i.e. it will be reopened) |
◆ map()
void* bt::CacheFile::map |
( |
MMappeable * |
thing, |
|
|
Uint64 |
off, |
|
|
Uint32 |
size, |
|
|
Mode |
mode |
|
) |
| |
Map a part of the file into memory, will expand the file if it is to small, but will not go past the limit set in open.
- Parameters
-
thing | The thing that wishes to map the mmapping |
off | Offset into the file |
size | Size of the region to map |
mode | How the region will be mapped |
- Returns
- A ptr to the mmaped region, or 0 if something goes wrong
◆ open()
void bt::CacheFile::open |
( |
const QString & |
path, |
|
|
Uint64 |
size |
|
) |
| |
Open the file.
- Parameters
-
path | Path of the file |
size | Max size of the file |
- Exceptions
-
Error | when something goes wrong |
◆ preallocate()
◆ read()
void bt::CacheFile::read |
( |
Uint8 * |
buf, |
|
|
Uint32 |
size, |
|
|
Uint64 |
off |
|
) |
| |
Read from the file.
- Parameters
-
buf | Buffer to store data |
size | Size to read |
off | Offset to read from in file |
◆ unmap()
void bt::CacheFile::unmap |
( |
void * |
ptr, |
|
|
Uint32 |
size |
|
) |
| |
Unmap a previously mapped region.
- Parameters
-
ptr | Ptr to the region |
size | Size of the region |
◆ write()
void bt::CacheFile::write |
( |
const Uint8 * |
buf, |
|
|
Uint32 |
size, |
|
|
Uint64 |
off |
|
) |
| |
Write to the file.
- Parameters
-
buf | Buffer to write |
size | Size to read |
off | Offset to read from in file |
The documentation for this class was generated from the following file: