CatalogueFactory.hpp 1.96 KB
Newer Older
Steven Murray's avatar
Steven Murray committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * 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 "catalogue/Catalogue.hpp"
22
#include "rdbms/Login.hpp"
Steven Murray's avatar
Steven Murray committed
23
24
25
26
27
28
29
30

#include <memory>
#include <mutex>

namespace cta {
namespace catalogue {

/**
31
 * Factory for creating CTA catalogue objects.  This class is a singleton.
Steven Murray's avatar
Steven Murray committed
32
33
34
35
36
37
38
39
40
41
42
43
 */
class CatalogueFactory {
public:

  /**
   * Prevent objects of this class from being instantiated.
   */
  CatalogueFactory() = delete;

  /**
   * Creates a CTA catalogue object using the specified database login details.
   *
44
45
   * @param login The database connection details.
   * @param nbConns The maximum number of concurrent connections to the
46
47
48
49
50
   * underlying relational database for all operations accept listing archive
   * files which can be relatively long operations.
   * @param nbArchiveFileListingConns The maximum number of concurrent
   * connections to the underlying relational database for the sole purpose of
   * listing archive files.
Steven Murray's avatar
Steven Murray committed
51
52
53
   * @return The newly created CTA catalogue object.  Please note that it is the
   * responsibility of the caller to delete the returned CTA catalogue object.
   */
54
55
  static std::unique_ptr<Catalogue> create(const rdbms::Login &login, const uint64_t nbConns,
    const uint64_t nbArchiveFileListingConns = 5);
Steven Murray's avatar
Steven Murray committed
56
57
58
59
60

}; // class CatalogueFactory

} // namespace catalogue
} // namespace cta