#include <XrdClXCpSrc.hh>
◆ XCpSrc()
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 |
◆ ~XCpSrc()
virtual XrdCl::XCpSrc::~XCpSrc |
( |
| ) |
|
|
privatevirtual |
Destructor (private).
Use Delelte() method to destroy the object.
◆ Delete()
void XrdCl::XCpSrc::Delete |
( |
| ) |
|
|
inline |
◆ DeleteChunk()
static void XrdCl::XCpSrc::DeleteChunk |
( |
PageInfo *& |
chunk | ) |
|
|
inlinestatic |
◆ DeletePtr()
template<typename T >
static void XrdCl::XCpSrc::DeletePtr |
( |
T *& |
obj | ) |
|
|
inlinestaticprivate |
Delets a pointer and sets it to null.
◆ FilesEqual()
static bool XrdCl::XCpSrc::FilesEqual |
( |
File * |
f1, |
|
|
File * |
f2 |
|
) |
| |
|
inlinestaticprivate |
◆ GetWork()
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
◆ HasData()
bool XrdCl::XCpSrc::HasData |
( |
| ) |
|
|
inline |
◆ Initialize()
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
◆ IsRunning()
bool XrdCl::XCpSrc::IsRunning |
( |
| ) |
|
|
inline |
- Returns
- : true if the thread is running, false otherwise
References pRunning.
◆ ReadChunks()
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
◆ Recover()
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
◆ ReportResponse()
This method is used by ChunkHandler to report the result of a write, to the source object.
- Parameters
-
status | : operation status |
chunk | : the read chunk (if operation failed, should be null) |
handle | : the file object used to read the chunk |
◆ Run()
static void * XrdCl::XCpSrc::Run |
( |
void * |
arg | ) |
|
|
staticprivate |
◆ Self()
XCpSrc * XrdCl::XCpSrc::Self |
( |
| ) |
|
|
inline |
Increments the reference counter.
- Returns
- : myself.
References pMtx, and pRefCount.
◆ Start()
void XrdCl::XCpSrc::Start |
( |
| ) |
|
Creates new thread with XCpSrc::Run as the start routine.
◆ StartDownloading()
void XrdCl::XCpSrc::StartDownloading |
( |
| ) |
|
|
private |
Initializes the object first. Afterwards, starts the download.
◆ Steal()
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 |
◆ Stop()
void XrdCl::XCpSrc::Stop |
( |
| ) |
|
|
inline |
◆ TransferRate()
uint64_t XrdCl::XCpSrc::TransferRate |
( |
| ) |
|
Get the transfer rate for current source
- Returns
- : transfer rate for current source [B/s]
◆ ChunkHandler
friend class ChunkHandler |
|
friend |
◆ pBlkEnd
uint64_t XrdCl::XCpSrc::pBlkEnd |
|
private |
End of the our block.
Referenced by HasData().
◆ pChunkSize
uint32_t XrdCl::XCpSrc::pChunkSize |
|
private |
◆ pCtx
◆ pCurrentOffset
uint64_t XrdCl::XCpSrc::pCurrentOffset |
|
private |
The offset of the next chunk to be transferred.
Referenced by HasData().
◆ pDataTransfered
uint64_t XrdCl::XCpSrc::pDataTransfered |
|
private |
Total number of data transferred from this source.
◆ pFailed
std::map<File*, uint8_t> XrdCl::XCpSrc::pFailed |
|
private |
◆ pFile
File* XrdCl::XCpSrc::pFile |
|
private |
◆ pFileSize
int64_t XrdCl::XCpSrc::pFileSize |
|
private |
◆ pMtx
◆ pOngoing
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().
◆ pParallel
uint8_t XrdCl::XCpSrc::pParallel |
|
private |
Number of parallel chunks
◆ pRecovered
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().
◆ pRefCount
size_t XrdCl::XCpSrc::pRefCount |
|
private |
◆ pReports
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).
◆ pRunning
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().
◆ pStartTime
time_t XrdCl::XCpSrc::pStartTime |
|
private |
The time when we started / restarted chunks
◆ pThread
pthread_t XrdCl::XCpSrc::pThread |
|
private |
◆ pTransferTime
time_t XrdCl::XCpSrc::pTransferTime |
|
private |
The total time we were transferring data, before the restart
◆ pUrl
std::string XrdCl::XCpSrc::pUrl |
|
private |
◆ pUsePgRead
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: