treqs::Reading Class Reference

Represents the reading status. Involves a File and a Tape. More...

#include <Reading.h>

Collaboration diagram for treqs::Reading:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Reading ()
 Constructor.
 Reading (FilePositionOnTape *fp, FileStatus fs, int tries, int maxtries, long qid)
 ~Reading ()
 Destructor.
int getErrorCode () const
 Getter for member.
treqs::FileStatus getFileState () const
 Getter for member.
treqs::FilePositionOnTapegetMetaData () const
 Getter for member.
int getNbTries () const
 Getter for member.
int getMaxTries () const
 Getter for member.
time_t getStartTime () const
 Getter for member.
time_t getEndTime () const
 Getter for member.
std::string getErrorMessage () const
 Getter for member.
void setErrorCode (int ErrorCode)
 Setter for member.
void setFileState (treqs::FileStatus FileState)
void setMetaData (treqs::FilePositionOnTape *MetaData)
 Setter for member.
void setNbTries (int NbTries)
 Setter for member.
void setMaxTries (int MaxTries)
 Setter for member.
void setErrorMessage (std::string)
 Setter for member.
int stage () throw (HPSSResourceError)
 Effectively do the staging.
bool operator< (const Reading &r)
 Comparison between too objects.
void prepareCleanup ()
 Tells the related FilePositionOnTape instance to unregister.

Private Member Functions

void sendUpdate ()
 Notifies ReadingDAO.

Private Attributes

treqs::FileStatus FileState
 Status of the last reading operation.
treqs::FilePositionOnTapeMetaData
 Reference to the file metadata.
int ErrorCode
 Error code of the last reading attempt.
std::string ErrorMessage
 Error message of the last reading attemplt.
int NbTries
 Number of reading tries.
int MaxTries
 Max number of retries.
time_t StartTime
 When the file started to be staged.
time_t EndTime
 When the staging finished.
long QueueId
 Just remember your queue Id.

Static Private Attributes

static log4cxx::LoggerPtr logger
 The logger of this class.

Detailed Description

Represents the reading status. Involves a File and a Tape.


Constructor & Destructor Documentation

treqs::Reading::Reading (  ) 

Constructor.

treqs::Reading::Reading ( FilePositionOnTape fp,
FileStatus  fs,
int  tries,
int  maxtries,
long  qid 
)

This constructor sets all the initial parameters and updates the DAO

Parameters:
fp reference to a FilePositionOnTape instance
fs the status (usualy FS_SUBMITTED)
tries the number of tries already attempted
maxtries the max tries allowed
qid the id of the queue I belong to
Returns:

Here is the call graph for this function:

treqs::Reading::~Reading (  ) 

Destructor.


Member Function Documentation

time_t treqs::Reading::getEndTime (  )  const

Getter for member.

int treqs::Reading::getErrorCode (  )  const

Getter for member.

std::string treqs::Reading::getErrorMessage (  )  const

Getter for member.

treqs::FileStatus treqs::Reading::getFileState (  )  const

Getter for member.

int treqs::Reading::getMaxTries (  )  const

Getter for member.

treqs::FilePositionOnTape * treqs::Reading::getMetaData (  )  const

Getter for member.

Here is the caller graph for this function:

int treqs::Reading::getNbTries (  )  const

Getter for member.

time_t treqs::Reading::getStartTime (  )  const

Getter for member.

bool treqs::Reading::operator< ( const Reading r  ) 

Comparison between too objects.

This operator sets a comparison criteria : The position on tape of the file referenced by the object.

Parameters:
r Object to be compared with
Returns:
True if this instance is "smaller" than the other.

Here is the call graph for this function:

void treqs::Reading::prepareCleanup (  ) 

Tells the related FilePositionOnTape instance to unregister.

Before destroying a Reading instance, the Queue will call this method.

Here is the call graph for this function:

void treqs::Reading::sendUpdate (  )  [private]

Notifies ReadingDAO.

void treqs::Reading::setErrorCode ( int  ErrorCode  ) 

Setter for member.

Here is the caller graph for this function:

void treqs::Reading::setErrorMessage ( std::string  s  ) 

Setter for member.

Here is the caller graph for this function:

void treqs::Reading::setFileState ( treqs::FileStatus  FileState  ) 

Sets the status of the last reading operation. This method will not call for the DAO method

Parameters:
FileState the new status

Here is the caller graph for this function:

void treqs::Reading::setMaxTries ( int  MaxTries  ) 

Setter for member.

void treqs::Reading::setMetaData ( treqs::FilePositionOnTape MetaData  ) 

Setter for member.

void treqs::Reading::setNbTries ( int  NbTries  ) 

Setter for member.

int treqs::Reading::stage (  )  throw (HPSSResourceError)

Effectively do the staging.

This method do the following checks :

  • If the status is FS_QUEUED, pass because there is already a stager calling this method
  • If this method has been tried to much time, set as Failed
  • If this Reading has already been done, pass

Then it really calls for staging. If the method traps exception, following actions are taken :

  • HPSSResourceException : Reset the file as FS_SUBMITTED both in real state and on the database. Throw the exception to the caller
  • Other exceptions : Set the Reading status as failed, and set the database status as FS_CREATED so it can be redispatched.
  • Consider Unknown errors as Fatal.
Returns:
0

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

time_t treqs::Reading::EndTime [private]

When the staging finished.

Error code of the last reading attempt.

std::string treqs::Reading::ErrorMessage [private]

Error message of the last reading attemplt.

Status of the last reading operation.

LoggerPtr treqs::Reading::logger [static, private]

The logger of this class.

int treqs::Reading::MaxTries [private]

Max number of retries.

Reference to the file metadata.

int treqs::Reading::NbTries [private]

Number of reading tries.

long treqs::Reading::QueueId [private]

Just remember your queue Id.

time_t treqs::Reading::StartTime [private]

When the file started to be staged.


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

Generated on 4 Mar 2010 for TReqS by  doxygen 1.6.1