ARC SDK
TransferShares.h
1 #ifndef TRANSFERSHARES_H_
2 #define TRANSFERSHARES_H_
3 
4 #include <map>
5 
6 #include "DTR.h"
7 
8 namespace DataStaging {
9 
11 
18 
19  public:
20 
22  enum ShareType {
26  VO,
33  };
34 
35  private:
36 
39  std::map<std::string, int> ReferenceShares;
40 
42  ShareType shareType;
43 
44  public:
45 
47  TransferSharesConf(const std::string& type, const std::map<std::string, int>& ref_shares);
48 
51 
53  void set_share_type(const std::string& type);
54 
56  void set_reference_share(const std::string& RefShare, int Priority);
57 
59  void set_reference_shares(const std::map<std::string, int>& shares);
60 
62  bool is_configured(const std::string& ShareToCheck);
63 
65  int get_basic_priority(const std::string& ShareToCheck);
66 
68  std::string conf() const;
69 
71  std::string extract_share_info(DTR_ptr DTRToExtract);
72  };
73 
74 
76 
89 
90  private:
91 
93  TransferSharesConf conf;
94 
96  std::map<std::string, int> ActiveShares;
97 
99  std::map<std::string, int> ActiveSharesSlots;
100 
101  public:
102 
105 
107  TransferShares(const TransferSharesConf& shares_conf);
108 
111 
113  void set_shares_conf(const TransferSharesConf& share_conf);
114 
116 
121  void calculate_shares(int TotalNumberOfSlots);
122 
124  void increase_transfer_share(const std::string& ShareToIncrease);
126  void decrease_transfer_share(const std::string& ShareToDecrease);
127 
129 
133  void decrease_number_of_slots(const std::string& ShareToDecrease);
134 
136  bool can_start(const std::string& ShareToStart);
137 
139  std::map<std::string, int> active_shares() const;
140 
141  }; // class TransferShares
142 
143 } // namespace DataStaging
144 
145 #endif /* TRANSFERSHARES_H_ */
Shares are defined per VOMS role of the user&#39;s proxy.
Definition: TransferShares.h:30
ShareType
The criterion for assigning a share to a DTR.
Definition: TransferShares.h:22
void increase_transfer_share(const std::string &ShareToIncrease)
Increase by one the active count for the given share. Called when a new DTR enters the queue...
TransferShares is used to implement fair-sharing and priorities.
Definition: TransferShares.h:88
TransferSharesConf()
Construct a new TransferSharesConf with no defined shares or policy.
TransferSharesConf describes the configuration of TransferShares.
Definition: TransferShares.h:17
void set_share_type(const std::string &type)
Set the share type.
Shares are defined per VOMS group of the user&#39;s proxy.
Definition: TransferShares.h:28
std::string conf() const
Return human-readable configuration of shares.
void set_reference_share(const std::string &RefShare, int Priority)
Add a reference share.
No share criterion - all DTRs will be assigned to a single share.
Definition: TransferShares.h:32
bool is_configured(const std::string &ShareToCheck)
Returns true if the given share is a reference share.
~TransferShares()
Empty destructor.
Definition: TransferShares.h:110
DataStaging contains all components for data transfer scheduling and execution.
Definition: DataDelivery.h:12
void set_reference_shares(const std::map< std::string, int > &shares)
Set reference shares.
Shares are defined per DN of the user&#39;s proxy.
Definition: TransferShares.h:24
int get_basic_priority(const std::string &ShareToCheck)
Get the priority of this share.
std::string extract_share_info(DTR_ptr DTRToExtract)
Get the name of the share the DTR should be assigned to and the proxy type.
void decrease_number_of_slots(const std::string &ShareToDecrease)
Decrease by one the number of slots available to the given share.
void set_shares_conf(const TransferSharesConf &share_conf)
Set a new configuration, if a new reference share gets added for example.
bool can_start(const std::string &ShareToStart)
Returns true if there is a slot available for the given share.
void decrease_transfer_share(const std::string &ShareToDecrease)
Decrease by one the active count for the given share. Called when a completed DTR leaves the queue...
Shares are defined per VOMS VO of the user&#39;s proxy.
Definition: TransferShares.h:26
void calculate_shares(int TotalNumberOfSlots)
Calculate how many slots to assign to each active share.
TransferShares()
Create a new TransferShares with default configuration.
Definition: TransferShares.h:104
std::map< std::string, int > active_shares() const
Returns the map of active shares.