DiskReporterFactory.hpp 1.91 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * The CERN Tape Archive (CTA) project
 * Copyright (C) 2015  CERN
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "DiskReporter.hpp"
#include "common/utils/Regex.hpp"
23
#include "common/threading/Mutex.hpp"
24
25

#include <string>
26
#include <future>
27

28
namespace cta { namespace disk {
29
30
31

class DiskReporterFactory {
public:
32
  DiskReporter * createDiskReporter(const std::string URL);
33
34
35
36
37
38
39
private:
  // The typical call to give report to EOS will be:
  // xrdfs localhost query opaquefile "/eos/wfe/passwd?mgm.pcmd=event&mgm.fid=112&mgm.logid=cta&mgm.event=migrated&mgm.workflow=default&mgm.path=/eos/wfe/passwd&mgm.ruid=0&mgm.rgid=0"
  // which will be encoded as eosQuery://eosserver.cern.ch/eos/wfe/passwd?mgm.pcmd=event&mgm.fid=112&mgm.logid=cta&mgm.event=migrated&mgm.workflow=default&mgm.path=/eos/wfe/passwd&mgm.ruid=0&mgm.rgid=0"
  // which itself will be translated into (roughly) :
  // XrdCl::FileSystem(XrdCl::URL("eoserver.cern.ch")).Query("/eos/wfe/passwd?mgm.pcmd=event&mgm.fid=112&mgm.logid=cta&mgm.event=migrated&mgm.workflow=default&mgm.path=/eos/wfe/passwd&mgm.ruid=0&mgm.rgid=0");
  cta::utils::Regex m_EosUrlRegex{"^eosQuery://([^/]+)(/.*)$"};
40
  cta::utils::Regex m_NullRegex{"^$|^null:"};
41
42
  /// This mutex ensures we do not use the regexes in parallel.
  cta::threading::Mutex m_mutex;
43
44
};
}} // namespace cta::disk