Skip to content

Commit 95ac2cd

Browse files
committed
cc dynamic_config: rm legacy Snapshot::Get
* Removed legacy `dynamic_config::Snapshot::Get` method, use `operator[]` instead. commit_hash:ae91207cf6be7b7235db672918d323aac7e6a143
1 parent d3be494 commit 95ac2cd

2 files changed

Lines changed: 0 additions & 35 deletions

File tree

core/include/userver/dynamic_config/snapshot.hpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,6 @@ class Snapshot final {
151151
template <typename VariableType>
152152
const VariableType& operator[](const Key<VariableType>&) &&;
153153

154-
/// @cond
155-
// No longer supported, use `config[key]` instead
156-
template <typename T>
157-
const T& Get() const& USERVER_IMPL_LIFETIME_BOUND;
158-
159-
// No longer supported, use `config[key]` instead
160-
template <typename T>
161-
const T& Get() &&;
162-
/// @endcond
163-
164154
private:
165155
// for the constructor
166156
friend class Source;
@@ -292,16 +282,6 @@ const VariableType& Snapshot::operator[](const Key<VariableType>&) && {
292282
static_assert(!sizeof(VariableType), "keep the Snapshot before using, please");
293283
}
294284

295-
template <typename T>
296-
const T& Snapshot::Get() const& USERVER_IMPL_LIFETIME_BOUND {
297-
return (*this)[T::kDeprecatedKey];
298-
}
299-
300-
template <typename T>
301-
const T& Snapshot::Get() && {
302-
static_assert(!sizeof(T), "keep the Snapshot before using, please");
303-
}
304-
305285
} // namespace dynamic_config
306286

307287
USERVER_NAMESPACE_END

core/src/dynamic_config/config_test.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,6 @@ UTEST_F(DynamicConfigTest, VariableSnapshotPtr) {
120120

121121
UTEST_F(DynamicConfigTest, Copy) { EXPECT_EQ(source_.GetCopy(kIntConfig), 5); }
122122

123-
struct OldConfig final {
124-
static const dynamic_config::Key<OldConfig> kDeprecatedKey;
125-
126-
int foo{42};
127-
};
128-
129-
const dynamic_config::Key<OldConfig> OldConfig::kDeprecatedKey{dynamic_config::ConstantConfig{}, OldConfig{}};
130-
131-
UTEST(DynamicConfig, TheOldWay) {
132-
const dynamic_config::StorageMock storage{{OldConfig::kDeprecatedKey, {}}};
133-
134-
const auto config = storage.GetSource().GetSnapshot();
135-
EXPECT_EQ(config.Get<OldConfig>().foo, 42);
136-
}
137-
138123
class DummyClient final {
139124
public:
140125
explicit DummyClient(dynamic_config::Source config)

0 commit comments

Comments
 (0)