-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathConfig.hpp
More file actions
95 lines (79 loc) · 2.52 KB
/
Copy pathConfig.hpp
File metadata and controls
95 lines (79 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef CONFIG_HPP
#define CONFIG_HPP
#pragma once
// Core local private includes
#include "AuthenticationManager.hpp"
#include "SchemaAPIConfig.hpp"
// DataFed Common public includes
#include "common/DynaLog.hpp"
#include "common/ICredentials.hpp"
#include "common/envelope.pb.h"
// Standard includes
#include <map>
#include <memory>
#include <mutex>
#include <stdint.h>
#include <string>
#include <unordered_map>
namespace SDMS {
namespace Core {
class Config {
public:
static Config &getInstance() {
static Config inst;
return inst;
}
// glob_xfr_url("https://transfer.api.globusonline.org/v0.10/"),
private:
Config()
: glob_oauth_url("https://auth.globus.org/v2/oauth2/"),
glob_xfr_url("https://transfer.api.globus.org/v0.10/"), port(7512),
timeout(5), num_client_worker_threads(4), num_task_worker_threads(10),
task_purge_age(14 * 24 * 3600), task_purge_period(6 * 3600),
task_retry_time_fail(3600),
task_retry_time_init(30), // Double every retry until max backoff
task_retry_backoff_max(4), repo_chunk_size(100), repo_timeout(60000),
note_purge_age(7 * 24 * 3600), note_purge_period(6 * 3600),
metrics_period(300), metrics_purge_period(3600),
metrics_purge_age(24 * 3600) {}
std::map<std::string, RepoData> m_repos;
bool m_trigger_repo_refresh = true; // Default on startup
mutable std::mutex m_repos_mtx;
public:
void loadRepositoryConfig(AuthenticationManager &auth_manager,
LogContext log_context);
void triggerRepoCacheRefresh();
bool repoCacheInvalid();
std::map<std::string, RepoData> getRepos() const;
std::string cred_dir;
std::string db_url;
std::string db_user;
std::string db_pass;
std::string glob_oauth_url;
std::string glob_xfr_url;
std::string client_id;
std::string client_secret;
uint32_t port;
uint32_t timeout;
uint32_t num_client_worker_threads;
uint32_t num_task_worker_threads;
uint32_t task_purge_age;
uint32_t task_purge_period;
uint32_t task_retry_time_fail;
uint32_t task_retry_time_init;
uint32_t task_retry_backoff_max;
uint32_t repo_chunk_size;
uint32_t repo_timeout;
uint32_t note_purge_age;
uint32_t note_purge_period;
uint32_t metrics_period;
uint32_t metrics_purge_period;
uint32_t metrics_purge_age;
std::unordered_map<std::string, SchemaAPIConfig> schemas;
// MsgComm::SecurityContext sec_ctx;
std::unique_ptr<ICredentials> sec_ctx;
/// Map of client key to DataFed ID
};
} // namespace Core
} // namespace SDMS
#endif