FileServiceProxy.cc
Go to the documentation of this file.
3 
5  std::vector<std::string>&& fileNames,
6  size_t const attempts,
7  double const waitBetweenAttempts)
8  : currentItem_{attempts}
9  , attemptsPerPhase_{attempts}
10  , waitBetweenAttempts_{waitBetweenAttempts}
11 {
12  ci_->configure(std::move(fileNames));
13 }
14 
16 {
17  if (!currentItem_.uri.empty()) {
20  } else {
22  }
23  }
24 }
25 
26 void
28 {
30  // File is complete.
32  }
34 }
35 
38 {
39  double wait = 0.0;
40  switch (currentItem_.uriStatus) {
42  [[fallthrough]];
44  wait = waitBetweenAttempts_;
45  [[fallthrough]];
49  << "Unable to obtain URI from CatalogInterface service after "
50  << attemptsPerPhase_ << " attempts.\n";
51  }
53  ci_->getNextFileURI(currentItem_.uri, wait));
54  return obtainURI_();
57  return obtainFileFromURI_();
58  break;
60  return std::string(); // Done.
61  default:
63  << "CatalogInterface service returned failure code "
65  << static_cast<int>(currentItem_.uriStatus) << ").\n";
66  }
67 }
68 
71 {
73  switch (currentItem_.ftStatus) {
75  sleep(waitBetweenAttempts_);
76  [[fallthrough]];
80  << "Unable to obtain URI " << currentItem_.uri
81  << " from FileTransfer service after " << attemptsPerPhase_
82  << " attempts.\n";
83  }
85  ft_->translateToLocalFilename(currentItem_.uri, currentItem_.pfn));
86  return obtainFileFromURI_();
89  return currentItem_.pfn; // Done.
90  default:
92  << "FileTransfer service returned failure code "
94  << static_cast<int>(currentItem_.ftStatus) << ") for URI "
95  << currentItem_.uri << ".\n";
96  }
97 }
void wait(std::chrono::milliseconds dur)
std::string string
Definition: nybbler.cc:12
FileServiceProxy(std::vector< std::string > &&fileNames, size_t attempts=5, double waitBetweenAttempts=5.0)
def move(depos, offset)
Definition: depos.py:107
ServiceHandle< FileTransfer > ft_
std::string translateFileTransferStatus(FileTransferStatus stat)
std::string translateFileDeliveryStatus(FileDeliveryStatus stat)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
struct art::detail::FileServiceProxy::FileEntity currentItem_
ServiceHandle< CatalogInterface > ci_