ewmscp  ..
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
copyRequest::fileInWork Class Reference

This class holds info aboput a file that is "in work" in some way. More...

#include <fileInWork.h>

Inheritance diagram for copyRequest::fileInWork:
[legend]
Collaboration diagram for copyRequest::fileInWork:
[legend]

Classes

class  eraser
 class to get copyRequest out of the fileInWork list. More...
 
class  inserter
 create a new fileInWork instance in the map. More...
 
class  lockuser
 this class handles the mutex protection of the filesInWork map More...
 
class  typeChanger
 

Public Types

enum  slotTypes {
  slotTypes::none, slotTypes::copy, slotTypes::move, slotTypes::unlink,
  slotTypes::nTypes
}
 

Public Member Functions

slotTypes getLatestRequestType () const
 
 fileInWork (clock_type::time_point earliest)
 
 ~fileInWork ()
 
void setWaitTime (clock_type::duration aWaitTime)
 
void updateExecTime (clock_type::time_point start)
 
clock_type::time_point getEarliestprocessTime () const
 

Static Public Member Functions

static void waitForAllInstancesGone ()
 

Static Public Attributes

static std::map< std::string, fileInWorkfilesInWork
 maps file names to filesInWork objects More...
 
static std::mutex filesInWorkMutex
 protects the filesInWork map More...
 
static std::condition_variable cv
 needed for signaling that no file is in work anymore More...
 

Private Attributes

clock_type::time_point earliestProcessTime
 process at earliest at this time More...
 
clock_type::duration waitTime
 delay that gets added to now() to calculate earliestProcessTime More...
 
slotTypes queuedRequestType
 

Detailed Description

This class holds info aboput a file that is "in work" in some way.

It inherits from std::list and the list part holds the copyRequests that will be processed some time in the future, after the current request (which is not held by this class) is done.

Definition at line 21 of file fileInWork.h.

Member Enumeration Documentation

◆ slotTypes

Enumerator
none 
copy 
move 
unlink 
nTypes 

Definition at line 23 of file fileInWork.h.

23 { none, copy, move, unlink, nTypes };

Constructor & Destructor Documentation

◆ fileInWork()

copyRequest::fileInWork::fileInWork ( clock_type::time_point  earliest)
inline

Definition at line 55 of file fileInWork.h.

55  :
56  earliestProcessTime(earliest),
57  waitTime(clock_type::duration::zero()),
59  }

References copyRequest::none.

◆ ~fileInWork()

copyRequest::fileInWork::~fileInWork ( )
inline

Definition at line 60 of file fileInWork.h.

60  {
61  cv.notify_all();
62  }

References cv.

Member Function Documentation

◆ getEarliestprocessTime()

clock_type::time_point copyRequest::fileInWork::getEarliestprocessTime ( ) const
inline

Definition at line 69 of file fileInWork.h.

69  {
70  return earliestProcessTime;
71  }

References earliestProcessTime.

◆ getLatestRequestType()

fileInWork::slotTypes copyRequest::fileInWork::getLatestRequestType ( ) const

Definition at line 41 of file fileInWork.cpp.

41  {
42  if (this->empty()) {
43  return queuedRequestType;
44  } else {
45  return this->back()->getSlotType();
46  }
47  }

References queuedRequestType.

Referenced by followRequestProvider::enqueueOrAppend().

Here is the caller graph for this function:

◆ setWaitTime()

void copyRequest::fileInWork::setWaitTime ( clock_type::duration  aWaitTime)
inline

Definition at line 63 of file fileInWork.h.

63  {
64  waitTime = aWaitTime;
65  }

References waitTime.

Referenced by followRequestProvider::enqueueOrAppend().

Here is the caller graph for this function:

◆ updateExecTime()

void copyRequest::fileInWork::updateExecTime ( clock_type::time_point  start)
inline

Definition at line 66 of file fileInWork.h.

66  {
68  }

References earliestProcessTime, throttle::start, and waitTime.

◆ waitForAllInstancesGone()

void copyRequest::fileInWork::waitForAllInstancesGone ( )
static

Definition at line 32 of file fileInWork.cpp.

32  {
33  std::unique_lock<decltype(filesInWorkMutex)> lock(filesInWorkMutex);
34 
35  timerInst(wait);
36  while (! filesInWork.empty()) {
37  cv.wait(lock);
38  }
39  }

References timerInst.

Member Data Documentation

◆ cv

std::condition_variable copyRequest::fileInWork::cv
static

needed for signaling that no file is in work anymore

Definition at line 32 of file fileInWork.h.

Referenced by ~fileInWork().

◆ earliestProcessTime

clock_type::time_point copyRequest::fileInWork::earliestProcessTime
private

process at earliest at this time

Definition at line 26 of file fileInWork.h.

Referenced by getEarliestprocessTime(), and updateExecTime().

◆ filesInWork

std::map<std::string, fileInWork> copyRequest::fileInWork::filesInWork
static

maps file names to filesInWork objects

Definition at line 30 of file fileInWork.h.

Referenced by copyRequest::base::adviseDelay(), copyRequest::fileInWork::eraser::getNext(), and copyRequest::fileInWork::inserter::inserter().

◆ filesInWorkMutex

std::mutex copyRequest::fileInWork::filesInWorkMutex
static

protects the filesInWork map

Definition at line 31 of file fileInWork.h.

◆ queuedRequestType

slotTypes copyRequest::fileInWork::queuedRequestType
private

Definition at line 28 of file fileInWork.h.

Referenced by getLatestRequestType().

◆ waitTime

clock_type::duration copyRequest::fileInWork::waitTime
private

delay that gets added to now() to calculate earliestProcessTime

Definition at line 27 of file fileInWork.h.

Referenced by setWaitTime(), and updateExecTime().


The documentation for this class was generated from the following files:
copyRequest::fileInWork::filesInWork
static std::map< std::string, fileInWork > filesInWork
maps file names to filesInWork objects
Definition: fileInWork.h:30
copyRequest::fileInWork::slotTypes::none
@ none
copyRequest::backupModeType::none
@ none
copyRequest::fileInWork::earliestProcessTime
clock_type::time_point earliestProcessTime
process at earliest at this time
Definition: fileInWork.h:26
throttle::start
static auto start
Definition: throttle.h:10
copyRequest::fileInWork::cv
static std::condition_variable cv
needed for signaling that no file is in work anymore
Definition: fileInWork.h:32
copyRequest::fileInWork::queuedRequestType
slotTypes queuedRequestType
Definition: fileInWork.h:28
timerInst
#define timerInst(subfunc)
Definition: timer.h:157
copyRequest::fileInWork::filesInWorkMutex
static std::mutex filesInWorkMutex
protects the filesInWork map
Definition: fileInWork.h:31
copyRequest::fileInWork::waitTime
clock_type::duration waitTime
delay that gets added to now() to calculate earliestProcessTime
Definition: fileInWork.h:27