Github   Telegram
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <chrono>
7#include <vector>
8
14
16
17USERVER_NAMESPACE_BEGIN
18
19namespace components {
20
21// clang-format off
22
133
134// clang-format on
135
137 public:
138 static constexpr auto kDefaultMaxReplicationLag = std::chrono::seconds{60};
140 static constexpr size_t kDefaultShardNumber = 0;
143 std::chrono::milliseconds{500}, // network timeout
144 std::chrono::milliseconds{250} // statement timeout
145 };
146
150 ~Postgres() override;
151
154
157
159 size_t GetShardCount() const;
160
162 storages::postgres::DatabasePtr GetDatabase() const { return database_; }
163
166
167 static yaml_config::Schema GetStaticConfigSchema();
168
169 private:
170 void OnConfigUpdate(const dynamic_config::Snapshot& cfg);
171
172 concurrent::AsyncEventSubscriberScope config_subscription_;
173
174 utils::statistics::Entry statistics_holder_;
175
176 std::string name_;
177 std::string db_name_;
178 storages::postgres::ClusterSettings initial_settings_;
179 storages::postgres::DatabasePtr database_;
180};
181
182template <>
183inline constexpr bool kHasValidate<Postgres> = true;
184
185} // namespace components
186
187USERVER_NAMESPACE_END