Dumping of cache-like components.
Classes | |
| struct | Config |
| class | DumpableEntity |
| class | Dumper |
| Manages dumps of a cache-like component. More... | |
| struct | DynamicConfig |
| class | EncryptedOperationsFactory |
| class | EncryptedReader |
| class | EncryptedWriter |
| class | Error |
| class | FileOperationsFactory |
| class | FileReader |
| A handle to a dump file. File operations block the thread. More... | |
| class | FileWriter |
| A handle to a dump file. File operations block the thread. More... | |
| struct | IsDumpedAggregate |
| class | MockReader |
| A Reader that reads from a string buffer (used in tests). More... | |
| class | MockWriter |
| A Writer that appends to a string buffer (used in tests). More... | |
| class | OperationsFactory |
| Abstract dump Reader/Writer factory. More... | |
| class | Reader |
| A general interface for binary data input. More... | |
| struct | To |
| A marker type used in ADL-found Read. More... | |
| class | Writer |
| A general interface for binary data output. More... | |
Typedefs | |
| using | ConfigPatch = ::dynamic_config::userver_dumps::ConfigPatch |
| using | TimePoint = std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> |
| using | SecretKey = utils::NonLoggable<class SecretKeyTag, std::string> |
Enumerations | |
| enum class | UpdateType { kModified , kAlreadyUpToDate } |
Functions | |
| template<typename T> requires (impl::IsDumpableAggregate<T>()) | |
| void | Write (Writer &writer, const T &value) |
| Aggregates dumping support. | |
| template<typename T> requires (impl::IsDumpableAggregate<T>()) | |
| T | Read (Reader &reader, To< T >) |
| Aggregates deserialization from dump support. | |
| std::string | ReadEntire (Reader &reader) |
| Reads the rest of the data from reader. | |
| void | Write (Writer &writer, std::string_view value) |
| Write-only std::string_view support. | |
| void | Write (Writer &writer, const std::string &value) |
| std::string serialization support | |
| std::string | Read (Reader &reader, To< std::string >) |
| std::string deserialization support | |
| void | Write (Writer &writer, const char *value) |
| Allows writing string literals. | |
| template<meta::kIsInteger T> | |
| void | Write (Writer &writer, T value) |
| Integral types serialization support. | |
| template<meta::kIsInteger T> | |
| T | Read (Reader &reader, To< T >) |
| Integral types deserialization support. | |
| template<std::floating_point T> | |
| void | Write (Writer &writer, T value) |
| Floating-point serialization support. | |
| template<std::floating_point T> | |
| T | Read (Reader &reader, To< T >) |
| Floating-point deserialization support. | |
| void | Write (Writer &writer, bool value) |
| bool serialization support | |
| bool | Read (Reader &reader, To< bool >) |
| bool deserialization support | |
| template<typename T> requires std::is_enum_v<T> | |
| void | Write (Writer &writer, T value) |
| enum serialization support | |
| template<typename T> requires std::is_enum_v<T> | |
| T | Read (Reader &reader, To< T >) |
| enum deserialization support | |
| template<typename Rep, typename Period> | |
| void | Write (Writer &writer, std::chrono::duration< Rep, Period > value) |
| std::chrono::duration serialization support | |
| template<typename Rep, typename Period> | |
| std::chrono::duration< Rep, Period > | Read (Reader &reader, To< std::chrono::duration< Rep, Period > >) |
| std::chrono::duration deserialization support | |
| template<typename Duration> | |
| void | Write (Writer &writer, std::chrono::time_point< std::chrono::system_clock, Duration > value) |
| std::chrono::time_point serialization support | |
| template<typename Duration> | |
| auto | Read (Reader &reader, To< std::chrono::time_point< std::chrono::system_clock, Duration > >) |
| std::chrono::time_point deserialization support | |
| void | Write (Writer &writer, const boost::uuids::uuid &value) |
| boost::uuids::uuid serialization support | |
| boost::uuids::uuid | Read (Reader &reader, To< boost::uuids::uuid >) |
| boost::uuids::uuid deserialization support | |
| template<int Prec, typename RoundPolicy> | |
| void | Write (Writer &writer, const decimal64::Decimal< Prec, RoundPolicy > &dec) |
| decimal64::Decimal serialization support | |
| template<int Prec, typename RoundPolicy> | |
| auto | Read (Reader &reader, dump::To< decimal64::Decimal< Prec, RoundPolicy > >) |
| decimal64::Decimal deserialization support | |
| void | Write (Writer &writer, const formats::json::Value &value) |
| formats::json::Value serialization support | |
| formats::json::Value | Read (Reader &reader, To< formats::json::Value >) |
| formats::json::Value deserialization support | |
| template<typename T> requires (IsContainer<T> && kIsWritable<meta::RangeValueType<T>>) | |
| void | Write (Writer &writer, const T &value) |
| Container serialization support. | |
| template<typename T> requires (IsContainer<T> && kIsReadable<meta::RangeValueType<T>>) | |
| T | Read (Reader &reader, To< T >) |
| Container deserialization support. | |
| template<typename T, typename U> requires (kIsWritable<T> && kIsWritable<U>) | |
| void | Write (Writer &writer, const std::pair< T, U > &value) |
| Pair serialization support (for maps). | |
| template<typename T, typename U> requires (kIsReadable<T> && kIsReadable<U>) | |
| std::pair< T, U > | Read (Reader &reader, To< std::pair< T, U > >) |
| Pair deserialization support (for maps). | |
| template<typename T> requires kIsWritable<T> | |
| void | Write (Writer &writer, const std::optional< T > &value) |
| std::optional serialization support | |
| template<typename T> requires kIsReadable<T> | |
| std::optional< T > | Read (Reader &reader, To< std::optional< T > >) |
| std::optional deserialization support | |
| template<typename... Args> requires (true && ... && kIsWritable<Args>) | |
| void | Write (Writer &writer, const std::variant< Args... > &value) |
| std::variant serialization support | |
| template<typename... Args> requires (true && ... && (std::is_move_constructible_v<Args> && kIsReadable<Args>)) | |
| std::variant< Args... > | Read (Reader &reader, To< std::variant< Args... > >) |
| std::variant deserialization support | |
| template<typename T> requires kIsReadable<T> | |
| T | Read (Reader &reader, To< const T >) |
| template<typename Tag, typename T, utils::StrongTypedefOps Ops> requires kIsWritable<T> | |
| void | Write (Writer &writer, const utils::StrongTypedef< Tag, T, Ops > &object) |
| utils::StrongTypedef serialization support | |
| template<typename Tag, typename T, utils::StrongTypedefOps Ops> requires kIsReadable<T> | |
| utils::StrongTypedef< Tag, T, Ops > | Read (Reader &reader, To< utils::StrongTypedef< Tag, T, Ops > >) |
| utils::StrongTypedef deserialization support | |
| template<typename T> requires kIsWritable<T> | |
| void | Write (Writer &writer, const std::unique_ptr< T > &ptr) |
| std::unique_ptr serialization support | |
| template<typename T> requires kIsReadable<T> | |
| std::unique_ptr< T > | Read (Reader &reader, To< std::unique_ptr< T > >) |
| std::unique_ptr deserialization support | |
| template<typename T> requires kIsWritable<T> | |
| void | Write (Writer &writer, const std::shared_ptr< T > &ptr) |
| std::shared_ptr serialization support | |
| template<typename T> requires kIsReadable<T> | |
| std::shared_ptr< T > | Read (Reader &reader, To< std::shared_ptr< T > >) |
| std::shared_ptr deserialization support | |
| template<typename L, typename R, typename... Args> requires (kIsWritable<impl::BoostBimapLeftKey<L, R, Args...>> && kIsWritable<impl::BoostBimapRightKey<L, R, Args...>>) | |
| void | Write (Writer &writer, const boost::bimap< L, R, Args... > &map) |
| boost::bimap serialization support | |
| template<typename L, typename R, typename... Args> requires (kIsReadable<impl::BoostBimapLeftKey<L, R, Args...>> && kIsReadable<impl::BoostBimapRightKey<L, R, Args...>>) | |
| boost::bimap< L, R, Args... > | Read (Reader &reader, To< boost::bimap< L, R, Args... > >) |
| boost::bimap deserialization support | |
| template<typename T, typename Index, typename Alloc> requires kIsWritable<T> | |
| void | Write (Writer &writer, const boost::multi_index_container< T, Index, Alloc > &container) |
| boost::multi_index_container serialization support | |
| template<typename T, typename Index, typename Alloc> requires kIsReadable<T> | |
| boost::multi_index_container< T, Index, Alloc > | Read (Reader &reader, To< boost::multi_index_container< T, Index, Alloc > >) |
| boost::multi_index_container deserialization support | |
| std::unique_ptr< dump::OperationsFactory > | CreateOperationsFactory (const Config &config, const components::ComponentContext &context) |
| std::unique_ptr< dump::OperationsFactory > | CreateDefaultOperationsFactory (const Config &config) |
| void | ThrowDumpUnimplemented (const std::string &name) |
| template<typename T> | |
| void | WriteJson (Writer &writer, const T &contents) |
| Convenience function to use in components::CachingComponentBase::WriteContents override to dump a type in a human readable JSON format. | |
| template<typename T> | |
| std::unique_ptr< const T > | ReadJson (Reader &reader) |
| Convenience function to use in components::CachingComponentBase::ReadContents override to load a dump in a human readable JSON format. | |
| template<typename T> | |
| constexpr bool | CheckDumpable () |
| void | WriteStringViewUnsafe (Writer &writer, std::string_view value) |
| Writes a non-size-prefixed std::string_view. | |
| std::string_view | ReadStringViewUnsafe (Reader &reader) |
| Reads a std::string_view. | |
| std::string_view | ReadStringViewUnsafe (Reader &reader, std::size_t size) |
| Reads a non-size-prefixed std::string_view. | |
| std::string_view | ReadUnsafeAtMost (Reader &reader, std::size_t max_size) |
| Reads a std::string_view. | |
| void | BackUpReadUnsafe (Reader &reader, std::size_t size) |
| Moves the internal cursor back by size bytes so that the next call to ReadUnsafeAtMost returns the same data again. | |
| template<typename T> | |
| std::string | ToBinary (const T &value) |
| Converts to binary using Write(Writer&, const T&). | |
| template<typename T> | |
| std::remove_const_t< T > | FromBinary (std::string data) |
| Converts from binary using Read(Reader&, To<T>). | |
| template<typename T> | |
| void | TestWriteReadCycle (const T &original) |
| template<typename T> requires std::is_base_of_v<google::protobuf::MessageLite, T> | |
| void | Write (Writer &writer, const T &value) |
| Protobuf message dumping support. | |
| template<typename T> requires std::is_base_of_v<google::protobuf::MessageLite, T> | |
| T | Read (Reader &reader, To< T >) |
| Protobuf message dumping support. | |
| template<typename T, typename Alloc> | |
| void | Insert (std::vector< T, Alloc > &cont, T &&elem) |
| template<typename K, typename V, typename Comp, typename Alloc> | |
| void | Insert (std::map< K, V, Comp, Alloc > &cont, std::pair< const K, V > &&elem) |
| template<typename K, typename V, typename Hash, typename Eq, typename Alloc> | |
| void | Insert (std::unordered_map< K, V, Hash, Eq, Alloc > &cont, std::pair< const K, V > &&elem) |
| template<typename T, typename Comp, typename Alloc> | |
| void | Insert (std::set< T, Comp, Alloc > &cont, T &&elem) |
| template<typename T, typename Hash, typename Eq, typename Alloc> | |
| void | Insert (std::unordered_set< T, Hash, Eq, Alloc > &cont, T &&elem) |
Variables | |
| const std::string_view | kDump |
| const std::string_view | kMaxDumpAge |
| const std::string_view | kMinDumpInterval |
| using dump::ConfigPatch = ::dynamic_config::userver_dumps::ConfigPatch |
Definition at line 33 of file config.hpp.
| using dump::SecretKey = utils::NonLoggable<class SecretKeyTag, std::string> |
Definition at line 17 of file operations_encrypted.hpp.
| using dump::TimePoint = std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> |
Definition at line 13 of file helpers.hpp.
|
strong |
| Enumerator | |
|---|---|
| kModified | Some new data has appeared since the last update. Dumper will write it on the next WriteDumpAsync call, or as specified by the config. |
| kAlreadyUpToDate | There is no new data, but we have verified that the old data is up-to-date. Dumper will bump the dump modification time to now. |
Definition at line 48 of file dumper.hpp.
| void dump::BackUpReadUnsafe | ( | Reader & | reader, |
| std::size_t | size ) |
Moves the internal cursor back by size bytes so that the next call to ReadUnsafeAtMost returns the same data again.
| std::remove_const_t< T > dump::FromBinary | ( | std::string | data | ) |
Converts from binary using Read(Reader&, To<T>).
Definition at line 24 of file test_helpers.hpp.
| void dump::Insert | ( | std::map< K, V, Comp, Alloc > & | cont, |
| std::pair< const K, V > && | elem ) |
Definition at line 30 of file meta_containers.hpp.
| void dump::Insert | ( | std::set< T, Comp, Alloc > & | cont, |
| T && | elem ) |
Definition at line 40 of file meta_containers.hpp.
| void dump::Insert | ( | std::unordered_map< K, V, Hash, Eq, Alloc > & | cont, |
| std::pair< const K, V > && | elem ) |
Definition at line 35 of file meta_containers.hpp.
| void dump::Insert | ( | std::unordered_set< T, Hash, Eq, Alloc > & | cont, |
| T && | elem ) |
Definition at line 45 of file meta_containers.hpp.
| void dump::Insert | ( | std::vector< T, Alloc > & | cont, |
| T && | elem ) |
Customization point: insert an element into a container
Definition at line 25 of file meta_containers.hpp.
| auto dump::Read | ( | Reader & | reader, |
| dump::To< decimal64::Decimal< Prec, RoundPolicy > > | ) |
decimal64::Decimal deserialization support
Definition at line 211 of file common.hpp.
| boost::bimap< L, R, Args... > dump::Read | ( | Reader & | reader, |
| To< boost::bimap< L, R, Args... > > | ) |
boost::bimap deserialization support
Definition at line 255 of file common_containers.hpp.
| boost::multi_index_container< T, Index, Alloc > dump::Read | ( | Reader & | reader, |
| To< boost::multi_index_container< T, Index, Alloc > > | ) |
boost::multi_index_container deserialization support
Definition at line 291 of file common_containers.hpp.
Allows reading const T, which is usually encountered as a member of some container
Definition at line 178 of file common_containers.hpp.
| std::chrono::duration< Rep, Period > dump::Read | ( | Reader & | reader, |
| To< std::chrono::duration< Rep, Period > > | ) |
std::chrono::duration deserialization support
Definition at line 169 of file common.hpp.
| auto dump::Read | ( | Reader & | reader, |
| To< std::chrono::time_point< std::chrono::system_clock, Duration > > | ) |
std::chrono::time_point deserialization support
Definition at line 193 of file common.hpp.
| std::optional< T > dump::Read | ( | Reader & | reader, |
| To< std::optional< T > > | ) |
std::optional deserialization support
Definition at line 148 of file common_containers.hpp.
| std::pair< T, U > dump::Read | ( | Reader & | reader, |
| To< std::pair< T, U > > | ) |
Pair deserialization support (for maps).
Definition at line 131 of file common_containers.hpp.
| std::shared_ptr< T > dump::Read | ( | Reader & | reader, |
| To< std::shared_ptr< T > > | ) |
std::shared_ptr deserialization support
Definition at line 233 of file common_containers.hpp.
| std::unique_ptr< T > dump::Read | ( | Reader & | reader, |
| To< std::unique_ptr< T > > | ) |
std::unique_ptr deserialization support
Definition at line 209 of file common_containers.hpp.
| std::variant< Args... > dump::Read | ( | Reader & | reader, |
| To< std::variant< Args... > > | ) |
std::variant deserialization support
Definition at line 166 of file common_containers.hpp.
| T dump::Read | ( | Reader & | reader, |
| To< T > | ) |
Aggregates deserialization from dump support.
To enable dumps and loads for an aggregate, add in the global namespace:
Definition at line 82 of file aggregates.hpp.
enum deserialization support
Definition at line 140 of file common.hpp.
Floating-point deserialization support.
Definition at line 120 of file common.hpp.
| T dump::Read | ( | Reader & | reader, |
| To< T > | ) |
Integral types deserialization support.
Definition at line 98 of file common.hpp.
| T dump::Read | ( | Reader & | reader, |
| To< T > | ) |
Container deserialization support.
Definition at line 108 of file common_containers.hpp.
| T dump::Read | ( | Reader & | reader, |
| To< T > | ) |
Protobuf message dumping support.
Definition at line 36 of file protobuf.hpp.
| utils::StrongTypedef< Tag, T, Ops > dump::Read | ( | Reader & | reader, |
| To< utils::StrongTypedef< Tag, T, Ops > > | ) |
utils::StrongTypedef deserialization support
Definition at line 192 of file common_containers.hpp.
| std::unique_ptr< const T > dump::ReadJson | ( | Reader & | reader | ) |
Convenience function to use in components::CachingComponentBase::ReadContents override to load a dump in a human readable JSON format.
Definition at line 41 of file json_helpers.hpp.
| std::string_view dump::ReadStringViewUnsafe | ( | Reader & | reader | ) |
Reads a std::string_view.
| std::string_view dump::ReadStringViewUnsafe | ( | Reader & | reader, |
| std::size_t | size ) |
Reads a non-size-prefixed std::string_view.
| std::string_view dump::ReadUnsafeAtMost | ( | Reader & | reader, |
| std::size_t | max_size ) |
Reads a std::string_view.
| void dump::TestWriteReadCycle | ( | const T & | original | ) |
Write a value to a cache dump and immediately read it back. If Write and Read are implemented correctly, the result should be equal to the original value.
Definition at line 35 of file test_helpers.hpp.
| std::string dump::ToBinary | ( | const T & | value | ) |
Converts to binary using Write(Writer&, const T&).
Definition at line 16 of file test_helpers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const boost::bimap< L, R, Args... > & | map ) |
boost::bimap serialization support
Definition at line 243 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const boost::multi_index_container< T, Index, Alloc > & | container ) |
boost::multi_index_container serialization support
Definition at line 281 of file common_containers.hpp.
|
inline |
decimal64::Decimal serialization support
Definition at line 205 of file common.hpp.
| void dump::Write | ( | Writer & | writer, |
| const std::optional< T > & | value ) |
std::optional serialization support
Definition at line 138 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const std::pair< T, U > & | value ) |
Pair serialization support (for maps).
Definition at line 123 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const std::shared_ptr< T > & | ptr ) |
std::shared_ptr serialization support
Definition at line 221 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const std::unique_ptr< T > & | ptr ) |
std::unique_ptr serialization support
Definition at line 199 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const std::variant< Args... > & | value ) |
std::variant serialization support
Definition at line 158 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const T & | value ) |
Aggregates dumping support.
To enable dumps and loads for an aggregate, add in the global namespace:
Definition at line 69 of file aggregates.hpp.
| void dump::Write | ( | Writer & | writer, |
| const T & | value ) |
Container serialization support.
Definition at line 97 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| const T & | value ) |
Protobuf message dumping support.
Definition at line 29 of file protobuf.hpp.
| void dump::Write | ( | Writer & | writer, |
| const utils::StrongTypedef< Tag, T, Ops > & | object ) |
utils::StrongTypedef serialization support
Definition at line 185 of file common_containers.hpp.
| void dump::Write | ( | Writer & | writer, |
| std::chrono::duration< Rep, Period > | value ) |
std::chrono::duration serialization support
Definition at line 146 of file common.hpp.
| void dump::Write | ( | Writer & | writer, |
| std::chrono::time_point< std::chrono::system_clock, Duration > | value ) |
std::chrono::time_point serialization support
Definition at line 185 of file common.hpp.
| void dump::Write | ( | Writer & | writer, |
| std::string_view | value ) |
Write-only std::string_view support.
| void dump::Write | ( | Writer & | writer, |
| T | value ) |
enum serialization support
Definition at line 133 of file common.hpp.
| void dump::Write | ( | Writer & | writer, |
| T | value ) |
Floating-point serialization support.
Definition at line 114 of file common.hpp.
| void dump::Write | ( | Writer & | writer, |
| T | value ) |
Integral types serialization support.
Definition at line 88 of file common.hpp.
| void dump::WriteJson | ( | Writer & | writer, |
| const T & | contents ) |
Convenience function to use in components::CachingComponentBase::WriteContents override to dump a type in a human readable JSON format.
Definition at line 28 of file json_helpers.hpp.
| void dump::WriteStringViewUnsafe | ( | Writer & | writer, |
| std::string_view | value ) |
Writes a non-size-prefixed std::string_view.
|
extern |
Definition at line 34 of file dumper.hpp.