#include <XrdClXCpSrc.hh>
XrdCl::XCpSrc::XCpSrc |
( |
uint32_t |
chunkSize, |
|
|
uint8_t |
parallel, |
|
|
int64_t |
fileSize, |
|
|
XCpCtx * |
ctx |
|
) |
| |
Constructor.
- Parameters
-
chunkSize | : default chunk size |
parallel | : number of parallel chunks |
fileSize | : file size if available (e.g. in metalink file), should be set to -1 if not available, in this case a stat will be performed during initialization |
ctx | : Extreme Copy context |
virtual XrdCl::XCpSrc::~XCpSrc |
( |
| ) |
|
|
privatevirtual |
Destructor (private).
Use Delelte() method to destroy the object.
void XrdCl::XCpSrc::Delete |
( |
| ) |
|
|
inline |
static void XrdCl::XCpSrc::DeleteChunk |
( |
PageInfo *& |
chunk | ) |
|
|
inlinestatic |
template<typename T >
static void XrdCl::XCpSrc::DeletePtr |
( |
T *& |
obj | ) |
|
|
inlinestaticprivate |
Delets a pointer and sets it to null.
static bool XrdCl::XCpSrc::FilesEqual |
( |
File * |
f1, |
|
|
File * |
f2 |
|
) |
| |
|
inlinestaticprivate |
Get more work. First try to get a new block. If there are no blocks remaining, try stealing from others.
- Returns
- : error if didn't got any data to transfer
bool XrdCl::XCpSrc::HasData |
( |
| ) |
|
|
inline |
Initializes the object:
- Opens a file (retries with another URL, in case of failure)
- Stats the file if necessary
- Gets the first block (offset and size) for download
- Returns
- : error in case the object could not be initialized
bool XrdCl::XCpSrc::IsRunning |
( |
| ) |
|
|
inline |
- Returns
- : true if the thread is running, false otherwise
References pRunning.
Asynchronously reads consecutive chunks.
- Returns
- : operation status:
- suContinue : I still have work to do
- suPartial : I only have ongoing transfers, but the block has been consumed
- suDone : We are done, the block has been consumed, there are no ongoing transfers, and there are no new data
Tries to open the file at the next available URL. Moves all ongoing chunk to recovered.
- Returns
- : error if run out of URLs to try, success otherwise
This method is used by ChunkHandler to report the result of a write, to the source object.
- Parameters
-
stats | : operation status |
chunk | : the read chunk (if operation failed, should be null) |
handle | : the file object used to read the chunk |
static void* XrdCl::XCpSrc::Run |
( |
void * |
arg | ) |
|
|
staticprivate |
XCpSrc* XrdCl::XCpSrc::Self |
( |
| ) |
|
|
inline |
Increments the reference counter.
- Returns
- : myself.
References pMtx, and pRefCount.
void XrdCl::XCpSrc::Start |
( |
| ) |
|
Creates new thread with XCpSrc::Run as the start routine.
void XrdCl::XCpSrc::StartDownloading |
( |
| ) |
|
|
private |
Initializes the object first. Afterwards, starts the download.
void XrdCl::XCpSrc::Steal |
( |
XCpSrc * |
src | ) |
|
|
private |
Steal work from given source.
- if it is a failed source we can have everything
- otherwise, if the source has a block of size greater than 0, steal respective fraction of the block
- otherwise, if the source has recovered chunks, steal respective fraction of those chunks
- otherwise, steal respective fraction of ongoing chunks, if we are a faster source
- Parameters
-
src | : the source from whom we are stealing |
void XrdCl::XCpSrc::Stop |
( |
| ) |
|
|
inline |
uint64_t XrdCl::XCpSrc::TransferRate |
( |
| ) |
|
Get the transfer rate for current source
- Returns
- : transfer rate for current source [B/s]
friend class ChunkHandler |
|
friend |
uint64_t XrdCl::XCpSrc::pBlkEnd |
|
private |
End of the our block.
Referenced by HasData().
uint32_t XrdCl::XCpSrc::pChunkSize |
|
private |
uint64_t XrdCl::XCpSrc::pCurrentOffset |
|
private |
The offset of the next chunk to be transferred.
Referenced by HasData().
uint64_t XrdCl::XCpSrc::pDataTransfered |
|
private |
Total number of data transferred from this source.
std::map<File*, uint8_t> XrdCl::XCpSrc::pFailed |
|
private |
File* XrdCl::XCpSrc::pFile |
|
private |
int64_t XrdCl::XCpSrc::pFileSize |
|
private |
std::map<uint64_t, uint64_t> XrdCl::XCpSrc::pOngoing |
|
private |
A map of ongoing transfers (the offset is the key, the chunk size is the value).
Referenced by HasData().
uint8_t XrdCl::XCpSrc::pParallel |
|
private |
Number of parallel chunks
std::map<uint64_t, uint64_t> XrdCl::XCpSrc::pRecovered |
|
private |
A map of stolen chunks (again the offset is the key, the chunk size is the value).
Referenced by HasData().
size_t XrdCl::XCpSrc::pRefCount |
|
private |
Sync queue with reports (statuses) from async reads that have been issued. An error appears only once per URL (independently of how many concurrent async reads are allowed).
bool XrdCl::XCpSrc::pRunning |
|
private |
A flag, true means the source is running, false means the source has been stopped, or failed.
Referenced by IsRunning(), and Stop().
time_t XrdCl::XCpSrc::pStartTime |
|
private |
The time when we started / restarted chunks
pthread_t XrdCl::XCpSrc::pThread |
|
private |
time_t XrdCl::XCpSrc::pTransferTime |
|
private |
The total time we were transferring data, before the restart
std::string XrdCl::XCpSrc::pUrl |
|
private |
bool XrdCl::XCpSrc::pUsePgRead |
|
private |
The total time we were transferring data, before the restart
The documentation for this class was generated from the following file: