#include <fso_cachefile.h>
◆ CacheFile() [1/2]
CacheFile::CacheFile |
( |
int |
i, |
|
|
int |
recoverable = 1 , |
|
|
int |
partial = 0 |
|
) |
| |
Constructor
- Parameters
-
i | CacheFile index |
recoverable | set cachefile to be recoverable from RVM |
partial | set cachefile to be partially cached |
◆ CacheFile() [2/2]
◆ ~CacheFile()
CacheFile::~CacheFile |
( |
| ) |
|
◆ Close()
int CacheFile::Close |
( |
int |
fd | ) |
|
Close the container file
- Parameters
-
fd | file descriptor of the opened file |
- Returns
- zero on success or -1 on error
◆ ConsecutiveValidData()
uint64_t CacheFile::ConsecutiveValidData |
( |
void |
| ) |
|
Get the amount of consecutive valid data starting from beginning of the file
- Returns
- amount of valid data of the cache file in bytes
◆ Copy() [1/2]
int CacheFile::Copy |
( |
CacheFile * |
destination | ) |
|
Copy the container file and metadata to another object
- Parameters
-
destination | destination cache file object |
- Returns
- zero on success or -1 on error
◆ Copy() [2/2]
int CacheFile::Copy |
( |
char * |
destname, |
|
|
int |
recovering = 0 |
|
) |
| |
Copy the container file (only) to a specified location
- Parameters
-
destname | destination cache file location |
recovering | flag if the cache file is being recovered |
- Returns
- zero on success or -1 on error
◆ CopySegment()
int64_t CacheFile::CopySegment |
( |
CacheFile * |
from, |
|
|
CacheFile * |
to, |
|
|
uint64_t |
pos, |
|
|
int64_t |
count |
|
) |
| |
|
staticprotected |
Copy the segment of a cache file to another
- Parameters
-
from | source cache file pointer |
to | destination cache file pointer |
pos | offset within the file |
count | amount of bytes to be copied |
- Returns
- amount of bytes copied
◆ Create()
void CacheFile::Create |
( |
int |
newlength = 0 | ) |
|
Create and initialize a new cachefile (container file will be also created)
- Parameters
-
newlength | length of the container file in bytes |
◆ DecRef()
int CacheFile::DecRef |
( |
| ) |
|
Decrements reference counter
- Returns
- reference counter value (unlinks if it becomes 0)
◆ FClose()
int CacheFile::FClose |
( |
FILE * |
f | ) |
|
Close the container file
- Parameters
-
f | FILE structure fo the opened file |
- Returns
- zero on success or errno otherwise
◆ FOpen()
FILE * CacheFile::FOpen |
( |
const char * |
mode | ) |
|
Open the container file (with fopen sys call)
- Parameters
-
mode | opening mode (only "r" and "w" supported) |
- Returns
- FILE structure of successfully opened file or NULL otherwise
◆ GetHoles()
Get the holes of the file within a range
- Parameters
-
start | start of the search range |
len | length of the search range |
- Returns
- holes list
◆ GetValidChunks()
CacheChunkList * CacheFile::GetValidChunks |
( |
uint64_t |
start, |
|
|
int64_t |
len |
|
) |
| |
Get the valid data of the file within a range
- Parameters
-
start | start of the search range |
len | length of the search range |
- Returns
- valid ranges chunks list
◆ IncRef()
void CacheFile::IncRef |
( |
| ) |
|
|
inline |
Increment reference counter. Creation already does an implicit IncRef()
◆ IsComplete()
int CacheFile::IsComplete |
( |
| ) |
|
|
inline |
Check if file is fully cached
- Returns
- zero if file isn't fully cached or not zero otherwise
◆ IsPartial()
bool CacheFile::IsPartial |
( |
| ) |
|
|
inline |
Check if file is partially cached
- Returns
- true if file partially cached or false otherwise
◆ Length()
uint64_t CacheFile::Length |
( |
| ) |
|
|
inline |
Get the length of the cache file
- Returns
- length of the cache file in bytes
◆ Name()
char * CacheFile::Name |
( |
void |
| ) |
|
|
inline |
Get the name of the container file
- Returns
- name of the container file
◆ Open()
int CacheFile::Open |
( |
int |
flags | ) |
|
Open the container file (with open sys call)
- Parameters
-
- Returns
- file descriptor of the file if opened successfully (Venus fails if container file couldn't be opened)
◆ print() [1/3]
void CacheFile::print |
( |
void |
| ) |
|
|
inline |
Print the metadata to the standard output
◆ print() [2/3]
void CacheFile::print |
( |
FILE * |
fp | ) |
|
|
inline |
Print the metadata to the specified file
- Parameters
-
fp | FILE structure of the output file |
◆ print() [3/3]
void CacheFile::print |
( |
int |
fdes | ) |
|
Print the metadata to the specified file
- Parameters
-
fdes | file descriptor of the output file |
◆ Reset()
void CacheFile::Reset |
( |
| ) |
|
Reset the container file to zero length and no data
◆ SetLength()
void CacheFile::SetLength |
( |
uint64_t |
newlen | ) |
|
Set the cache file length without truncating the container file
- Parameters
-
newlen | new cache file metadata size |
◆ SetPartial()
void CacheFile::SetPartial |
( |
bool |
is_partial | ) |
|
Set the cache file to be partially cached
- Parameters
-
is_partial | partial cache enable status |
◆ SetValidData() [1/2]
void CacheFile::SetValidData |
( |
uint64_t |
len | ) |
|
Set cache file's valid data (consecutive from beginning of the file)
- Parameters
-
◆ SetValidData() [2/2]
void CacheFile::SetValidData |
( |
uint64_t |
start, |
|
|
int64_t |
len |
|
) |
| |
Set cache file's valid data (within a range)
- Parameters
-
start | start of the valid data's range |
len | length of the valid data's range |
◆ Stat()
void CacheFile::Stat |
( |
struct stat * |
tstat | ) |
|
Get container file's stat
- Parameters
-
stat | output stat structure |
◆ Truncate()
void CacheFile::Truncate |
( |
uint64_t |
newlen | ) |
|
Truncate file to a new size
- Parameters
-
newlen | size to which the file will be truncated to |
◆ Utimes()
void CacheFile::Utimes |
( |
const struct timeval |
times[2] | ) |
|
Change container file's last access and modification times
- Parameters
-
times | time array of last access time and modification time, respectively. |
◆ Validate()
void CacheFile::Validate |
( |
| ) |
|
Validate the container file (Resets the container file if invalid)
◆ ValidData()
uint64_t CacheFile::ValidData |
( |
| ) |
|
|
inline |
Get the amount of valid data of the cache file
- Returns
- amount of valid data of the cache file in bytes
◆ SegmentedCacheFile
◆ name
Container file path ("xx/xx/xx/xx")
The documentation for this class was generated from the following files: