ARC SDK
Public Types | Public Member Functions
Arc::DataStatus Class Reference

Status code returned by many DataPoint methods. More...

#include <arc/data/DataStatus.h>

Public Types

enum  DataStatusType {
  Success, ReadAcquireError, WriteAcquireError, ReadResolveError,
  WriteResolveError, ReadStartError, WriteStartError, ReadError,
  WriteError, TransferError, ReadStopError, WriteStopError,
  PreRegisterError, PostRegisterError, UnregisterError, CacheError,
  CredentialsExpiredError, DeleteError, NoLocationError, LocationAlreadyExistsError,
  NotSupportedForDirectDataPointsError, UnimplementedError, IsReadingError, IsWritingError,
  CheckError, ListError, ListNonDirError, StatError,
  StatNotPresentError, NotInitializedError, SystemError, StageError,
  InconsistentMetadataError, ReadPrepareError, ReadPrepareWait, WritePrepareError,
  WritePrepareWait, ReadFinishError, WriteFinishError, CreateDirectoryError,
  RenameError, SuccessCached, SuccessCancelled, GenericError,
  UnknownError, ReadAcquireErrorRetryable = DataStatusRetryableBase+ReadAcquireError, WriteAcquireErrorRetryable = DataStatusRetryableBase+WriteAcquireError, ReadResolveErrorRetryable = DataStatusRetryableBase+ReadResolveError,
  WriteResolveErrorRetryable = DataStatusRetryableBase+WriteResolveError, ReadStartErrorRetryable = DataStatusRetryableBase+ReadStartError, WriteStartErrorRetryable = DataStatusRetryableBase+WriteStartError, ReadErrorRetryable = DataStatusRetryableBase+ReadError,
  WriteErrorRetryable = DataStatusRetryableBase+WriteError, TransferErrorRetryable = DataStatusRetryableBase+TransferError, ReadStopErrorRetryable = DataStatusRetryableBase+ReadStopError, WriteStopErrorRetryable = DataStatusRetryableBase+WriteStopError,
  PreRegisterErrorRetryable = DataStatusRetryableBase+PreRegisterError, PostRegisterErrorRetryable = DataStatusRetryableBase+PostRegisterError, UnregisterErrorRetryable = DataStatusRetryableBase+UnregisterError, CacheErrorRetryable = DataStatusRetryableBase+CacheError,
  DeleteErrorRetryable = DataStatusRetryableBase+DeleteError, CheckErrorRetryable = DataStatusRetryableBase+CheckError, ListErrorRetryable = DataStatusRetryableBase+ListError, StatErrorRetryable = DataStatusRetryableBase+StatError,
  StageErrorRetryable = DataStatusRetryableBase+StageError, ReadPrepareErrorRetryable = DataStatusRetryableBase+ReadPrepareError, WritePrepareErrorRetryable = DataStatusRetryableBase+WritePrepareError, ReadFinishErrorRetryable = DataStatusRetryableBase+ReadFinishError,
  WriteFinishErrorRetryable = DataStatusRetryableBase+WriteFinishError, CreateDirectoryErrorRetryable = DataStatusRetryableBase+CreateDirectoryError, RenameErrorRetryable = DataStatusRetryableBase+RenameError, GenericErrorRetryable = DataStatusRetryableBase+GenericError
}
 Status codes. More...
 

Public Member Functions

 DataStatus (const DataStatusType &status, std::string desc="")
 Constructor to use when errno-like information is not available. More...
 
 DataStatus (const DataStatusType &status, int error_no, const std::string &desc="")
 Construct a new DataStatus with errno and optional text description. More...
 
 DataStatus ()
 Construct a new DataStatus with fields initialised to success states. More...
 
bool operator== (const DataStatusType &s)
 Returns true if this status type matches s. More...
 
bool operator== (const DataStatus &s)
 Returns true if this status type matches the status type of s. More...
 
bool operator!= (const DataStatusType &s)
 Returns true if this status type does not match s. More...
 
bool operator!= (const DataStatus &s)
 Returns true if this status type does not match the status type of s. More...
 
DataStatus operator= (const DataStatusType &s)
 Assignment operator. More...
 
bool operator! () const
 Returns true if status type is not a success value. More...
 
 operator bool () const
 Returns true if status type is a success value. More...
 
bool Passed () const
 Returns true if no error occurred. More...
 
bool Retryable () const
 Returns true if the error was temporary and could be retried. More...
 
void SetErrno (int error_no)
 Set the error number. More...
 
int GetErrno () const
 Get the error number. More...
 
std::string GetStrErrno () const
 Get text description of the error number. More...
 
void SetDesc (const std::string &d)
 Set a detailed description of the status, removing trailing new line if present. More...
 
std::string GetDesc () const
 Get a detailed description of the status. More...
 
 operator std::string (void) const
 Returns a human-friendly readable string with all error information. More...
 

Detailed Description

Status code returned by many DataPoint methods.

A class to be used for return types of all major data handling methods. It describes the outcome of the method and contains three fields: DataStatusType describes in which operation the error occurred, Errno describes why the error occurred and desc gives more detail if available. Errno is an integer corresponding to error codes defined in errno.h plus additional ARC-specific error codes defined here.

For those DataPoints which natively support errno, it is safe to use code like

DataStatus s = someMethod();
if (!s) {
logger.msg(ERROR, "someMethod failed: %s", StrError(errno));
}

since logger.msg() does not call any system calls that modify errno.

Member Enumeration Documentation

Status codes.

These codes describe in which operation an error occurred. Retryable error codes are deprecated - the corresponding non-retryable error code should be used with errno set to a retryable value.

Enumerator
Success 

Operation completed successfully.

ReadAcquireError 

Source is bad URL or can't be used due to some reason.

WriteAcquireError 

Destination is bad URL or can't be used due to some reason.

ReadResolveError 

Resolving of index service URL for source failed.

WriteResolveError 

Resolving of index service URL for destination failed.

ReadStartError 

Can't read from source.

WriteStartError 

Can't write to destination.

ReadError 

Failed while reading from source.

WriteError 

Failed while writing to destination.

TransferError 

Failed while transfering data (mostly timeout)

ReadStopError 

Failed while finishing reading from source.

WriteStopError 

Failed while finishing writing to destination.

PreRegisterError 

First stage of registration of index service URL failed.

PostRegisterError 

Last stage of registration of index service URL failed.

UnregisterError 

Unregistration of index service URL failed.

CacheError 

Error in caching procedure.

CredentialsExpiredError 

Error due to provided credentials are expired.

DeleteError 

Error deleting location or URL.

NoLocationError 

No valid location available.

LocationAlreadyExistsError 

No valid location available.

NotSupportedForDirectDataPointsError 

Operation has no sense for this kind of URL.

UnimplementedError 

Feature is unimplemented.

IsReadingError 

DataPoint is already reading.

IsWritingError 

DataPoint is already writing.

CheckError 

Access check failed.

ListError 

Directory listing failed.

ListNonDirError 
Deprecated:
ListError with errno set to ENOTDIR should be used instead
StatError 

File/dir stating failed.

StatNotPresentError 
Deprecated:
StatError with errno set to ENOENT should be used instead
NotInitializedError 

Object initialization failed.

SystemError 

Error in OS.

StageError 

Staging error.

InconsistentMetadataError 

Inconsistent metadata.

ReadPrepareError 

Can't prepare source.

ReadPrepareWait 

Wait for source to be prepared.

WritePrepareError 

Can't prepare destination.

WritePrepareWait 

Wait for destination to be prepared.

ReadFinishError 

Can't finish source.

WriteFinishError 

Can't finish destination.

CreateDirectoryError 

Can't create directory.

RenameError 

Can't rename URL.

SuccessCached 

Data was already cached.

SuccessCancelled 

Operation was cancelled successfully.

GenericError 

General error which doesn't fit any other error.

UnknownError 

Undefined.

ReadAcquireErrorRetryable 
Deprecated:
WriteAcquireErrorRetryable 
Deprecated:
ReadResolveErrorRetryable 
Deprecated:
WriteResolveErrorRetryable 
Deprecated:
ReadStartErrorRetryable 
Deprecated:
WriteStartErrorRetryable 
Deprecated:
ReadErrorRetryable 
Deprecated:
WriteErrorRetryable 
Deprecated:
TransferErrorRetryable 
Deprecated:
ReadStopErrorRetryable 
Deprecated:
WriteStopErrorRetryable 
Deprecated:
PreRegisterErrorRetryable 
Deprecated:
PostRegisterErrorRetryable 
Deprecated:
UnregisterErrorRetryable 
Deprecated:
CacheErrorRetryable 
Deprecated:
DeleteErrorRetryable 
Deprecated:
CheckErrorRetryable 
Deprecated:
ListErrorRetryable 
Deprecated:
StatErrorRetryable 
Deprecated:
StageErrorRetryable 
Deprecated:
ReadPrepareErrorRetryable 
Deprecated:
WritePrepareErrorRetryable 
Deprecated:
ReadFinishErrorRetryable 
Deprecated:
WriteFinishErrorRetryable 
Deprecated:
CreateDirectoryErrorRetryable 
Deprecated:
RenameErrorRetryable 
Deprecated:
GenericErrorRetryable 
Deprecated:

Constructor & Destructor Documentation

Arc::DataStatus::DataStatus ( const DataStatusType status,
std::string  desc = "" 
)
inline

Constructor to use when errno-like information is not available.

Parameters
statuserror location
descerror description
Arc::DataStatus::DataStatus ( const DataStatusType status,
int  error_no,
const std::string &  desc = "" 
)
inline

Construct a new DataStatus with errno and optional text description.

If the status is an error condition then error_no must be set to a non-zero value.

Parameters
statuserror location
error_noerrno
descerror description
Arc::DataStatus::DataStatus ( )
inline

Construct a new DataStatus with fields initialised to success states.

Member Function Documentation

std::string Arc::DataStatus::GetDesc ( ) const
inline

Get a detailed description of the status.

int Arc::DataStatus::GetErrno ( ) const
inline

Get the error number.

std::string Arc::DataStatus::GetStrErrno ( ) const

Get text description of the error number.

Arc::DataStatus::operator bool ( void  ) const
inline

Returns true if status type is a success value.

Arc::DataStatus::operator std::string ( void  ) const

Returns a human-friendly readable string with all error information.

bool Arc::DataStatus::operator! ( void  ) const
inline

Returns true if status type is not a success value.

Python interface deviation
Method is unavailable in Python interface
Java interface deviation
Method is unavailable in Java interface
bool Arc::DataStatus::operator!= ( const DataStatusType s)
inline

Returns true if this status type does not match s.

bool Arc::DataStatus::operator!= ( const DataStatus s)
inline

Returns true if this status type does not match the status type of s.

DataStatus Arc::DataStatus::operator= ( const DataStatusType s)
inline

Assignment operator.

Sets status type to s and errno to EARCOTHER if s is an error state.

Python interface deviation
Method is unavailable in Python interface
Java interface deviation
Method is unavailable in Java interface
bool Arc::DataStatus::operator== ( const DataStatusType s)
inline

Returns true if this status type matches s.

bool Arc::DataStatus::operator== ( const DataStatus s)
inline

Returns true if this status type matches the status type of s.

bool Arc::DataStatus::Passed ( ) const
inline

Returns true if no error occurred.

bool Arc::DataStatus::Retryable ( ) const

Returns true if the error was temporary and could be retried.

Retryable error numbers are EAGAIN, EBUSY, ETIMEDOUT, EARCSVCTMP, EARCTRANSFERTIMEOUT, EARCCHECKSUM and EARCOTHER.

void Arc::DataStatus::SetDesc ( const std::string &  d)
inline

Set a detailed description of the status, removing trailing new line if present.

void Arc::DataStatus::SetErrno ( int  error_no)
inline

Set the error number.


The documentation for this class was generated from the following file: