ewmscp  ..
Functions
Collaboration diagram for follow mode for Beegfs:

Functions

void followBeeGfsRequestProvider::processSources (const std::vector< std::string > &sources) override
 

Detailed Description

The BeeGfsRequestProvider uses the BeeGFS FileEventReceiver to get file events from a BeeGFS mete data server.

Function Documentation

◆ processSources()

void followBeeGfsRequestProvider::processSources ( const std::vector< std::string > &  sources)
overridevirtual

Implements requestProvider.

Definition at line 14 of file followBeeGfsRequestProvider.cpp.

14  {
15  for (auto& source : sources) {
16  BeeGFS::FileEventReceiver receiver(source);
17  while (true) {
18  const auto data = receiver.read();
19  if (data.first == BeeGFS::FileEventReceiver::ReadErrorCode::Success) {
20  auto& event = data.second;
21  if (event.type == BeeGFS::FileEventType::CLOSE_WRITE) {
22  std::string path(beegfsroot);
23  path += "/";
24  path += event.path;
25  std::string dstPath;
26  auto mapEntry = getDstPath(path, dstPath);
27  handleOther(path, dstPath, mapEntry, copyRequest::clock_type::now(), false);
28  } else if (event.type == BeeGFS::FileEventType::RENAME) {
29  std::string path(beegfsroot);
30  path += "/";
31  path += event.path;
32  std::string fromPath;
33  auto mapEntryF = getDstPath(path, fromPath);
34  std::string target(beegfsroot);
35  target += "/";
36  target += event.targetPath;
37  std::string dstPath;
38  auto mapEntryD = getDstPath(target, dstPath);
39  handleMove(target, dstPath, fromPath, path, mapEntryD, copyRequest::clock_type::now());
40  } else if (event.type == BeeGFS::FileEventType::UNLINK ||
41  event.type == BeeGFS::FileEventType::RMDIR) {
42  std::string path(beegfsroot);
43  path += "/";
44  path += event.path;
45  std::string dstPath;
46  auto mapEntry = getDstPath(path, dstPath);
47  handleOther(path, dstPath, mapEntry, copyRequest::clock_type::now(), true);
48  } else if (event.type == BeeGFS::FileEventType::SYMLINK) {
49  std::string path(beegfsroot);
50  path += "/";
51  path += event.targetPath;
52  std::string dstPath;
53  auto mapEntry = getDstPath(path, dstPath);
54  handleOther(path, dstPath, mapEntry, copyRequest::clock_type::now(), false);
55  }
56  } else {
57  }
58  }
59  }
60 }

References followBeeGfsRequestProvider::beegfsroot, requestProvider::getDstPath(), followRequestProvider::handleMove(), and followRequestProvider::handleOther().

Here is the call graph for this function:
followRequestProvider::handleMove
virtual void handleMove(const std::string &srcPath, const std::string &dstPath, const std::string &fromPath, const std::string &origPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp)
Definition: followRequestProvider.cpp:31
followBeeGfsRequestProvider::beegfsroot
static options::single< std::string > beegfsroot
Definition: followBeeGfsRequestProvider.h:10
requestProvider::getDstPath
virtual const singleMap & getDstPath(const std::string &source, std::string &destination, bool baseNameOnly=false)
get detstination papth for a given source path
Definition: requestProvider.cpp:30
followRequestProvider::handleOther
virtual void handleOther(const std::string &srcPath, const std::string &dstPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp, bool requestForRemoval)
Definition: followRequestProvider.cpp:41