Complements DataPoint with attributes common for Indexing Service URLs. More...
#include <DataPointIndex.h>
Public Member Functions | |
virtual const URL & | CurrentLocation () const |
virtual const std::string & | CurrentLocationMetadata () const |
virtual DataPoint * | CurrentLocationHandle () const |
virtual DataStatus | CompareLocationMetadata () const |
virtual bool | NextLocation () |
virtual bool | LocationValid () const |
virtual bool | HaveLocations () const |
virtual bool | LastLocation () |
virtual DataStatus | RemoveLocation () |
virtual DataStatus | RemoveLocations (const DataPoint &p) |
virtual DataStatus | ClearLocations () |
virtual DataStatus | AddLocation (const URL &url, const std::string &meta) |
virtual void | SortLocations (const std::string &pattern, const URLMap &url_map) |
virtual bool | IsIndex () const |
virtual bool | IsStageable () const |
virtual bool | AcceptsMeta () const |
virtual bool | ProvidesMeta () const |
virtual void | SetMeta (const DataPoint &p) |
virtual void | SetCheckSum (const std::string &val) |
virtual void | SetSize (const unsigned long long int val) |
virtual bool | Registered () const |
virtual void | SetTries (const int n) |
virtual long long int | BufSize () const |
virtual int | BufNum () const |
virtual bool | Local () const |
virtual DataStatus | PrepareReading (unsigned int timeout, unsigned int &wait_time) |
virtual DataStatus | PrepareWriting (unsigned int timeout, unsigned int &wait_time) |
virtual DataStatus | StartReading (DataBuffer &buffer) |
virtual DataStatus | StartWriting (DataBuffer &buffer, DataCallback *space_cb=NULL) |
virtual DataStatus | StopReading () |
virtual DataStatus | StopWriting () |
virtual DataStatus | FinishReading (bool error=false) |
virtual DataStatus | FinishWriting (bool error=false) |
virtual std::vector< URL > | TransferLocations () const |
virtual DataStatus | Check () |
virtual DataStatus | Remove () |
virtual void | ReadOutOfOrder (bool v) |
virtual bool | WriteOutOfOrder () |
virtual void | SetAdditionalChecks (bool v) |
virtual bool | GetAdditionalChecks () const |
virtual void | SetSecure (bool v) |
virtual bool | GetSecure () const |
virtual DataPointAccessLatency | GetAccessLatency () const |
virtual void | Passive (bool v) |
virtual void | Range (unsigned long long int start=0, unsigned long long int end=0) |
virtual int | AddCheckSumObject (CheckSum *cksum) |
virtual const CheckSum * | GetCheckSumObject (int index) const |
Complements DataPoint with attributes common for Indexing Service URLs.
It should never be used directly. Instead inherit from it to provide a class for specific a Indexing Service.
virtual int Arc::DataPointIndex::AddCheckSumObject | ( | CheckSum * | cksum | ) | [virtual] |
Add a checksum object which will compute checksum during transmission.
cksum | object which will compute checksum. Should not be destroyed till DataPointer itself. |
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::AddLocation | ( | const URL & | url, | |
const std::string & | meta | |||
) | [virtual] |
Add URL to list.
url | Location URL to add. | |
meta | Location meta information. |
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::Check | ( | ) | [virtual] |
Query the DataPoint to check if object is accessible.
If possible this method will also try to provide meta information about the object. It returns positive response if object's content can be retrieved.
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::CompareLocationMetadata | ( | ) | const [virtual] |
Compare metadata of DataPoint and current location.
Returns inconsistency error or error encountered during operation, or success
Implements Arc::DataPoint.
virtual const std::string& Arc::DataPointIndex::CurrentLocationMetadata | ( | ) | const [virtual] |
Returns meta information used to create current URL.
Usage differs between different indexing services.
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::FinishReading | ( | bool | error = false |
) | [virtual] |
Finish reading from the URL.
Must be called after transfer of physical file has completed and if PrepareReading() was called, to free resources, release requests that were made during preparation etc.
error | If true then action is taken depending on the error. |
Reimplemented from Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::FinishWriting | ( | bool | error = false |
) | [virtual] |
Finish writing to the URL.
Must be called after transfer of physical file has completed and if PrepareWriting() was called, to free resources, release requests that were made during preparation etc.
error | If true then action is taken depending on the error. |
Reimplemented from Arc::DataPoint.
virtual bool Arc::DataPointIndex::NextLocation | ( | ) | [virtual] |
Switch to next location in list of URLs.
At last location switch to first if number of allowed retries is not exceeded. Returns false if no retries left.
Implements Arc::DataPoint.
virtual void Arc::DataPointIndex::Passive | ( | bool | v | ) | [virtual] |
Request passive transfers for FTP-like protocols.
true | to request. |
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::PrepareReading | ( | unsigned int | timeout, | |
unsigned int & | wait_time | |||
) | [virtual] |
Prepare DataPoint for reading.
This method should be implemented by protocols which require preparation or staging of physical files for reading. It can act synchronously or asynchronously (if protocol supports it). In the first case the method will block until the file is prepared or the specified timeout has passed. In the second case the method can return with a ReadPrepareWait status before the file is prepared. The caller should then wait some time (a hint from the remote service may be given in wait_time) and call PrepareReading() again to poll for the preparation status, until the file is prepared. In this case it is also up to the caller to decide when the request has taken too long and if so cancel it by calling FinishReading(). When file preparation has finished, the physical file(s) to read from can be found from TransferLocations().
timeout | If non-zero, this method will block until either the file has been prepared successfully or the timeout has passed. A zero value means that the caller would like to call and poll for status. | |
wait_time | If timeout is zero (caller would like asynchronous operation) and ReadPrepareWait is returned, a hint for how long to wait before a subsequent call may be given in wait_time. |
Reimplemented from Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::PrepareWriting | ( | unsigned int | timeout, | |
unsigned int & | wait_time | |||
) | [virtual] |
Prepare DataPoint for writing.
This method should be implemented by protocols which require preparation of physical files for writing. It can act synchronously or asynchronously (if protocol supports it). In the first case the method will block until the file is prepared or the specified timeout has passed. In the second case the method can return with a WritePrepareWait status before the file is prepared. The caller should then wait some time (a hint from the remote service may be given in wait_time) and call PrepareWriting() again to poll for the preparation status, until the file is prepared. In this case it is also up to the caller to decide when the request has taken too long and if so cancel or abort it by calling FinishWriting(true). When file preparation has finished, the physical file(s) to write to can be found from TransferLocations().
timeout | If non-zero, this method will block until either the file has been prepared successfully or the timeout has passed. A zero value means that the caller would like to call and poll for status. | |
wait_time | If timeout is zero (caller would like asynchronous operation) and WritePrepareWait is returned, a hint for how long to wait before a subsequent call may be given in wait_time. |
Reimplemented from Arc::DataPoint.
virtual bool Arc::DataPointIndex::ProvidesMeta | ( | ) | const [virtual] |
If endpoint can provide at least some meta information directly.
Implements Arc::DataPoint.
virtual void Arc::DataPointIndex::Range | ( | unsigned long long int | start = 0 , |
|
unsigned long long int | end = 0 | |||
) | [virtual] |
virtual void Arc::DataPointIndex::ReadOutOfOrder | ( | bool | v | ) | [virtual] |
Allow/disallow DataPoint to produce scattered data during reading* operation.
v | true if allowed (default is false). |
Implements Arc::DataPoint.
virtual bool Arc::DataPointIndex::Registered | ( | ) | const [virtual] |
Check if file is registered in Indexing Service.
Proper value is obtainable only after Resolve.
Implements Arc::DataPoint.
virtual void Arc::DataPointIndex::SetAdditionalChecks | ( | bool | v | ) | [virtual] |
Allow/disallow additional checks.
Check for existence of remote file (and probably other checks too) before initiating reading and writing operations.
v | true if allowed (default is true). |
Implements Arc::DataPoint.
virtual void Arc::DataPointIndex::SetMeta | ( | const DataPoint & | p | ) | [virtual] |
Copy meta information from another object.
Already defined values are not overwritten.
p | object from which information is taken. |
Reimplemented from Arc::DataPoint.
virtual void Arc::DataPointIndex::SetSecure | ( | bool | v | ) | [virtual] |
Allow/disallow heavy security during data transfer.
v | true if allowed (default depends on protocol). |
Implements Arc::DataPoint.
virtual void Arc::DataPointIndex::SortLocations | ( | const std::string & | pattern, | |
const URLMap & | url_map | |||
) | [virtual] |
Sort locations according to the specified pattern.
pattern | a set of strings, separated by |, to match against. |
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::StartReading | ( | DataBuffer & | buffer | ) | [virtual] |
Start reading data from URL.
Separate thread to transfer data will be created. No other operation can be performed while reading is in progress.
buffer | operation will use this buffer to put information into. Should not be destroyed before StopReading() was called and returned. |
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::StartWriting | ( | DataBuffer & | buffer, | |
DataCallback * | space_cb = NULL | |||
) | [virtual] |
Start writing data to URL.
Separate thread to transfer data will be created. No other operation can be performed while writing is in progress.
buffer | operation will use this buffer to get information from. Should not be destroyed before stop_writing was called and returned. | |
space_cb | callback which is called if there is not enough space to store data. May not implemented for all protocols. |
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::StopReading | ( | ) | [virtual] |
Stop reading.
Must be called after corresponding start_reading method, either after all data is transferred or to cancel transfer. Use buffer object to find out when data is transferred. Must return failure if any happened during transfer.
Implements Arc::DataPoint.
virtual DataStatus Arc::DataPointIndex::StopWriting | ( | ) | [virtual] |
Stop writing.
Must be called after corresponding start_writing method, either after all data is transferred or to cancel transfer. Use buffer object to find out when data is transferred. Must return failure if any happened during transfer.
Implements Arc::DataPoint.
virtual std::vector<URL> Arc::DataPointIndex::TransferLocations | ( | ) | const [virtual] |
Returns physical file(s) to read/write, if different from CurrentLocation().
To be used with protocols which re-direct to different URLs such as Transport URLs (TURLs). The list is initially filled by PrepareReading and PrepareWriting. If this list is non-empty then real transfer should use a URL from this list. It is up to the caller to choose the best URL and instantiate new DataPoint for handling it. For consistency protocols which do not require redirections return original URL. For protocols which need redirection calling StartReading and StartWriting will use first URL in the list.
Reimplemented from Arc::DataPoint.
virtual bool Arc::DataPointIndex::WriteOutOfOrder | ( | ) | [virtual] |
Returns true if URL can accept scattered data for *writing* operation.
Implements Arc::DataPoint.