DP3
NodeDesc.h
Go to the documentation of this file.
1 // NodeDesc.h: Description of a node in a cluster
2 //
3 // Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
9 
10 #ifndef DP3_COMMON_NODEDESC_H_
11 #define DP3_COMMON_NODEDESC_H_
12 
13 #include <iosfwd>
14 #include <string>
15 #include <vector>
16 
17 #include "ParameterSet.h"
18 
19 namespace dp3 {
20 namespace common {
21 
24 
30 
31 class NodeDesc {
32  public:
35 
38  NodeDesc() : itsType(Any) {}
39 
41  explicit NodeDesc(const ParameterSet&);
42 
44  void setName(const std::string& name) { itsName = name; }
45 
47  void setType(NodeType type) { itsType = type; }
48 
51  void addFileSys(const std::string& fsName, const std::string& mountPoint);
52 
54  void write(std::ostream& os, const std::string& prefix) const;
55 
57  const std::string& getName() const { return itsName; }
58 
60  NodeType getType() const { return itsType; }
61 
63  const std::vector<std::string>& getFileSys() const { return itsFileSys; }
64 
66  const std::vector<std::string>& getMountPoints() const { return itsMounts; }
67 
72  std::string findFileSys(const std::string& fileName) const;
73 
74  private:
75  std::string itsName;
76  NodeType itsType;
77  std::vector<std::string> itsFileSys;
78  std::vector<std::string> itsMounts;
79 };
80 
81 } // namespace common
82 } // namespace dp3
83 
84 #endif
Description of a node in a cluster.
Definition: NodeDesc.h:31
NodeDesc()
Definition: NodeDesc.h:38
void write(std::ostream &os, const std::string &prefix) const
Write it in parset format.
const std::string & getName() const
Get the name.
Definition: NodeDesc.h:57
NodeType
Define the node types.
Definition: NodeDesc.h:34
@ Any
Definition: NodeDesc.h:34
@ Storage
Definition: NodeDesc.h:34
@ Head
Definition: NodeDesc.h:34
@ Compute
Definition: NodeDesc.h:34
void setType(NodeType type)
Set node type.
Definition: NodeDesc.h:47
std::string findFileSys(const std::string &fileName) const
NodeType getType() const
Get the type.
Definition: NodeDesc.h:60
NodeDesc(const ParameterSet &)
Construct from the given parameterset.
void setName(const std::string &name)
Set node name.
Definition: NodeDesc.h:44
const std::vector< std::string > & getFileSys() const
Get the file systems it has access to.
Definition: NodeDesc.h:63
const std::vector< std::string > & getMountPoints() const
Get the mount points of the file systems.
Definition: NodeDesc.h:66
void addFileSys(const std::string &fsName, const std::string &mountPoint)
Implements a map of Key-Value pairs.
Definition: ParameterSet.h:31
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53