Dumping of cache-like components. More...
Classes | |
| struct | Config |
| struct | ConfigPatch |
| 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 |
| An abstract 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 | 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 > | |
| std::enable_if_t< impl::IsDumpableAggregate< T >()> | Write (Writer &writer, const T &value) |
| Aggregates dumping support. | |
| template<typename T > | |
| std::enable_if_t< 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<typename T > | |
| std::enable_if_t< meta::kIsInteger< T > > | Write (Writer &writer, T value) |
| Integral types serialization support. | |
| template<typename T > | |
| std::enable_if_t< meta::kIsInteger< T >, T > | Read (Reader &reader, To< T >) |
| Integral types deserialization support. | |
| template<typename T > | |
| std::enable_if_t< std::is_floating_point_v< T > > | Write (Writer &writer, T value) |
| Floating-point serialization support. | |
| template<typename T > | |
| std::enable_if_t< std::is_floating_point_v< 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 > | |
| std::enable_if_t< std::is_enum_v< T > > | Write (Writer &writer, T value) |
| enum serialization support | |
| template<typename T > | |
| std::enable_if_t< 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 > | |
| std::enable_if_t< kIsContainer< T > &&kIsWritable< meta::RangeValueType< T > > > | Write (Writer &writer, const T &value) |
| Container serialization support. | |
| template<typename T > | |
| std::enable_if_t< kIsContainer< T > &&kIsReadable< meta::RangeValueType< T > >, T > | Read (Reader &reader, To< T >) |
| Container deserialization support. | |
| template<typename T , typename U > | |
| std::enable_if_t< kIsWritable< T > &&kIsWritable< U >, void > | Write (Writer &writer, const std::pair< T, U > &value) |
| Pair serialization support (for maps) | |
| template<typename T , typename U > | |
| std::enable_if_t< kIsReadable< T > &&kIsReadable< U >, std::pair< T, U > > | Read (Reader &reader, To< std::pair< T, U > >) |
| Pair deserialization support (for maps) | |
| template<typename T > | |
| std::enable_if_t< kIsWritable< T > > | Write (Writer &writer, const std::optional< T > &value) |
std::optional serialization support | |
| template<typename T > | |
| std::enable_if_t< kIsReadable< T >, std::optional< T > > | Read (Reader &reader, To< std::optional< T > >) |
std::optional deserialization support | |
| template<typename... Args> | |
| std::enable_if_t<(true &&... &&kIsWritable< Args >)> | Write (Writer &writer, const std::variant< Args... > &value) |
std::variant serialization support | |
| template<typename... Args> | |
| std::enable_if_t<(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 > | |
| std::enable_if_t< kIsReadable< T >, T > | Read (Reader &reader, To< const T >) |
| template<typename Tag , typename T , utils::StrongTypedefOps Ops> | |
| std::enable_if_t< kIsWritable< T > > | Write (Writer &writer, const utils::StrongTypedef< Tag, T, Ops > &object) |
| utils::StrongTypedef serialization support | |
| template<typename Tag , typename T , utils::StrongTypedefOps Ops> | |
| std::enable_if_t< kIsReadable< T >, utils::StrongTypedef< Tag, T, Ops > > | Read (Reader &reader, To< utils::StrongTypedef< Tag, T, Ops > >) |
| utils::StrongTypedef deserialization support | |
| template<typename T > | |
| std::enable_if_t< kIsWritable< T > > | Write (Writer &writer, const std::unique_ptr< T > &ptr) |
std::unique_ptr serialization support | |
| template<typename T > | |
| std::enable_if_t< kIsReadable< T >, std::unique_ptr< T > > | Read (Reader &reader, To< std::unique_ptr< T > >) |
std::unique_ptr deserialization support | |
| template<typename T > | |
| std::enable_if_t< kIsWritable< T > > | Write (Writer &writer, const std::shared_ptr< T > &ptr) |
std::shared_ptr serialization support | |
| template<typename T > | |
| std::enable_if_t< 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 AP1 , typename AP2 , typename AP3 > | |
| std::enable_if_t< kIsReadable< L > &&kIsReadable< R > > | Write (Writer &writer, const boost::bimap< L, R, AP1, AP2, AP3 > &map) |
boost::bimap serialization support | |
| template<typename L , typename R , typename AP1 , typename AP2 , typename AP3 > | |
| std::enable_if_t< kIsWritable< L > &&kIsWritable< R >, boost::bimap< L, R, AP1, AP2, AP3 > > | Read (Reader &reader, To< boost::bimap< L, R, AP1, AP2, AP3 > >) |
boost::bimap deserialization support | |
| template<typename T , typename Index , typename Alloc > | |
| std::enable_if_t< kIsWritable< T > > | 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 > | |
| std::enable_if_t< 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 | |
| ConfigPatch | Parse (const formats::json::Value &value, formats::parse::To< ConfigPatch >) |
| std::unordered_map< std::string, ConfigPatch > | ParseConfigSet (const dynamic_config::DocsMap &docs_map) |
| 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 | |
| template<typename T > | |
| std::string | ToBinary (const T &value) |
Converts to binary using Write(Writer&, const T&) | |
| template<typename 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 , 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 |
| constexpr dynamic_config::Key< ParseConfigSet > | kConfigSet |
| template<typename T > | |
| constexpr bool | kIsWritable |
Check if writer.Write(T) is available. | |
| template<typename T > | |
| constexpr bool | kIsReadable |
Check if reader.Read<T>() is available. | |
| template<typename T > | |
| constexpr bool | kIsDumpable = kIsWritable<T> && kIsReadable<T> |
Check if T is both writable and readable. | |
| template<typename T > | |
| constexpr bool | kIsContainer |
| Check if a range is a container. | |
Dumping of cache-like components.
| using dump::SecretKey = typedef utils::NonLoggable<class SecretKeyTag, std::string> |
Definition at line 14 of file operations_encrypted.hpp.
| using dump::TimePoint = typedef 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. |
| kAlreadyUpToDate | There is no new data, but we have verified that the old data is up-to-date. |
Definition at line 48 of file dumper.hpp.
|
constexpr |
| 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 26 of file meta_containers.hpp.
| void dump::Insert | ( | std::set< T, Comp, Alloc > & | cont, |
| T && | elem | ||
| ) |
Definition at line 37 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 31 of file meta_containers.hpp.
| void dump::Insert | ( | std::unordered_set< T, Hash, Eq, Alloc > & | cont, |
| T && | elem | ||
| ) |
Definition at line 42 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 21 of file meta_containers.hpp.
| auto dump::Read | ( | Reader & | reader, |
| dump::To< decimal64::Decimal< Prec, RoundPolicy > > | |||
| ) |
decimal64::Decimal deserialization support
Definition at line 219 of file common.hpp.
| std::enable_if_t< kIsWritable< L > &&kIsWritable< R >, boost::bimap< L, R, AP1, AP2, AP3 > > dump::Read | ( | Reader & | reader, |
| To< boost::bimap< L, R, AP1, AP2, AP3 > > | |||
| ) |
boost::bimap deserialization support
Definition at line 248 of file common_containers.hpp.
| std::enable_if_t< kIsReadable< T >, 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 276 of file common_containers.hpp.
| std::enable_if_t< kIsReadable< T >, T > dump::Read | ( | Reader & | reader, |
| To< const T > | |||
| ) |
Allows reading const T, which is usually encountered as a member of some container
Definition at line 179 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 171 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
system_clock is supported, because steady_clock can only be used within a single execution Definition at line 198 of file common.hpp.
| std::enable_if_t< kIsReadable< T >, std::optional< T > > dump::Read | ( | Reader & | reader, |
| To< std::optional< T > > | |||
| ) |
std::optional deserialization support
Definition at line 149 of file common_containers.hpp.
| std::enable_if_t< kIsReadable< T > &&kIsReadable< U >, std::pair< T, U > > dump::Read | ( | Reader & | reader, |
| To< std::pair< T, U > > | |||
| ) |
Pair deserialization support (for maps)
Definition at line 134 of file common_containers.hpp.
| std::enable_if_t< kIsReadable< T >, std::shared_ptr< T > > dump::Read | ( | Reader & | reader, |
| To< std::shared_ptr< T > > | |||
| ) |
std::shared_ptr deserialization support
shared_ptr within a single dumped entity point to the same object, they will point to its distinct copies after loading a dump Definition at line 227 of file common_containers.hpp.
| std::enable_if_t< kIsReadable< T >, std::unique_ptr< T > > dump::Read | ( | Reader & | reader, |
| To< std::unique_ptr< T > > | |||
| ) |
std::unique_ptr deserialization support
Definition at line 207 of file common_containers.hpp.
| std::enable_if_t<(true &&... &&(std::is_move_constructible_v< Args > &&kIsReadable< Args >)), std::variant< Args... > > dump::Read | ( | Reader & | reader, |
| To< std::variant< Args... > > | |||
| ) |
std::variant deserialization support
Definition at line 168 of file common_containers.hpp.
| std::enable_if_t< impl::IsDumpableAggregate< T >(), 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 88 of file aggregates.hpp.
| std::enable_if_t< meta::kIsInteger< T >, T > dump::Read | ( | Reader & | reader, |
| To< T > | |||
| ) |
Integral types deserialization support.
Definition at line 103 of file common.hpp.
| std::enable_if_t< std::is_floating_point_v< T >, T > dump::Read | ( | Reader & | reader, |
| To< T > | |||
| ) |
Floating-point deserialization support.
Definition at line 125 of file common.hpp.
| std::enable_if_t< std::is_enum_v< T >, T > dump::Read | ( | Reader & | reader, |
| To< T > | |||
| ) |
enum deserialization support
Definition at line 143 of file common.hpp.
| std::enable_if_t< kIsContainer< T > &&kIsReadable< meta::RangeValueType< T > >, T > dump::Read | ( | Reader & | reader, |
| To< T > | |||
| ) |
Container deserialization support.
Definition at line 112 of file common_containers.hpp.
| std::enable_if_t< kIsReadable< T >, 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
string_view will be invalidated on the next Read operation | std::string_view dump::ReadStringViewUnsafe | ( | Reader & | reader, |
| std::size_t | size | ||
| ) |
Reads a non-size-prefixed std::string_view
string_view will be invalidated on the next Read operation | std::string_view dump::ReadUnsafeAtMost | ( | Reader & | reader, |
| std::size_t | max_size | ||
| ) |
Reads a std::string_view
max_size bytes is returned. On end-of-file, the amount of bytes returned can be less than max_size. string_view will be invalidated on the next Read operation | 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.
| std::enable_if_t< kIsReadable< L > &&kIsReadable< R > > dump::Write | ( | Writer & | writer, |
| const boost::bimap< L, R, AP1, AP2, AP3 > & | map | ||
| ) |
boost::bimap serialization support
Definition at line 235 of file common_containers.hpp.
| std::enable_if_t< kIsWritable< T > > dump::Write | ( | Writer & | writer, |
| const boost::multi_index_container< T, Index, Alloc > & | container | ||
| ) |
boost::multi_index_container serialization support
Definition at line 264 of file common_containers.hpp.
|
inline |
decimal64::Decimal serialization support
Definition at line 212 of file common.hpp.
| std::enable_if_t< kIsWritable< T > > dump::Write | ( | Writer & | writer, |
| const std::optional< T > & | value | ||
| ) |
std::optional serialization support
Definition at line 141 of file common_containers.hpp.
| std::enable_if_t< kIsWritable< T > &&kIsWritable< U >, void > dump::Write | ( | Writer & | writer, |
| const std::pair< T, U > & | value | ||
| ) |
Pair serialization support (for maps)
Definition at line 126 of file common_containers.hpp.
| std::enable_if_t< kIsWritable< T > > dump::Write | ( | Writer & | writer, |
| const std::shared_ptr< T > & | ptr | ||
| ) |
std::shared_ptr serialization support
shared_ptr within a single dumped entity point to the same object, they will point to its distinct copies after loading a dump Definition at line 217 of file common_containers.hpp.
| std::enable_if_t< kIsWritable< T > > dump::Write | ( | Writer & | writer, |
| const std::unique_ptr< T > & | ptr | ||
| ) |
std::unique_ptr serialization support
Definition at line 199 of file common_containers.hpp.
| std::enable_if_t<(true &&... &&kIsWritable< Args >)> dump::Write | ( | Writer & | writer, |
| const std::variant< Args... > & | value | ||
| ) |
std::variant serialization support
Definition at line 157 of file common_containers.hpp.
| std::enable_if_t< impl::IsDumpableAggregate< T >()> 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 71 of file aggregates.hpp.
| std::enable_if_t< kIsContainer< T > &&kIsWritable< meta::RangeValueType< T > > > dump::Write | ( | Writer & | writer, |
| const T & | value | ||
| ) |
Container serialization support.
Definition at line 100 of file common_containers.hpp.
| std::enable_if_t< kIsWritable< T > > 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 149 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
system_clock is supported, because steady_clock can only be used within a single execution Definition at line 189 of file common.hpp.
| void dump::Write | ( | Writer & | writer, |
| std::string_view | value | ||
| ) |
Write-only std::string_view support.
ReadStringViewUnsafe | std::enable_if_t< meta::kIsInteger< T > > dump::Write | ( | Writer & | writer, |
| T | value | ||
| ) |
Integral types serialization support.
Definition at line 93 of file common.hpp.
| std::enable_if_t< std::is_floating_point_v< T > > dump::Write | ( | Writer & | writer, |
| T | value | ||
| ) |
Floating-point serialization support.
Definition at line 119 of file common.hpp.
| std::enable_if_t< std::is_enum_v< T > > dump::Write | ( | Writer & | writer, |
| T | value | ||
| ) |
enum serialization support
Definition at line 137 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
writer.Write(str) should normally be used instead to write strings
|
inlineconstexpr |
Definition at line 66 of file config.hpp.
|
extern |
Definition at line 34 of file dumper.hpp.
|
inlineconstexpr |
Check if a range is a container.
Definition at line 57 of file meta_containers.hpp.
|
inlineconstexpr |
|
inlineconstexpr |