RootEntry.hpp 2.3 KB
Newer Older
1
/*
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 * 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/>.
 */

19
20
21
22
#pragma once

#include "objectstore/cta.pb.h"

23
#include "Backend.hpp"
24
25
#include "ObjectOps.hpp"

26
27
namespace cta { namespace objectstore {

28
29
class Agent;
  
30
class RootEntry: public ObjectOps<serializers::RootEntry> {
31
public:
32
33
  // construtor
  RootEntry(Backend & os);
34
35
36
  
  class NotAllocatedEx: public cta::exception::Exception {
  public:
37
    NotAllocatedEx(const std::string & w): cta::exception::Exception(w) {}
38
39
  };
  
40
41
42
  // In memory initialiser
  void initialize();
  
43
  // Get the name of the agent register (or exception if not available)
44
  std::string getAgentRegister();
45
46
  
  // Get the name of a (possibly freshly created) agent register
47
  std::string allocateOrGetAgentRegister(Agent & agent);
48
49
  
  // Get the name of the JobPool (or exception if not available)
50
  std::string getJobPool();
51
52
  
  // Get the name of a (possibly freshly created) job pool
53
  std::string allocateOrGetJobPool(Agent & agent);
54
  
55
56
57
58
59
60
  // Get the name of the AdminUsersList (or exception if not available)
  std::string getAdminUsersList();
  
  // Get the name of a (possibly freshly created) AdminUsersList
  std::string allocateOrGetAdminUsersList(Agent & agent);
  
61
62
63
64
65
66
67
68
69
70
71
72
73
74
private:
  void addIntendedAgentRegistry(const std::string & name);
  
  void deleteFromIntendedAgentRegistry(const std::string & name);
  
  void setAgentRegister(const std::string & name);
  
  void addIntendedJobPool(const std::string & name);
  
  void deleteFromIntendedJobPool(const std::string & name);
  
  void setJobPool(const std::string & name);
  
public:
75
  // Dump the root entry
76
  std::string dump ();
77
78
79
80
81

  private:
    static const std::string s_rootEntryName;
};

82
83
}}

84