userver: dump Namespace Reference
Loading...
Searching...
No Matches
dump Namespace Reference

Detailed Description

Dumping of cache-like components.

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 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... Args>
std::enable_if_t< kIsWritable< impl::BoostBimapLeftKey< L, R, Args... > > &&kIsWritable< impl::BoostBimapRightKey< L, R, Args... > > > Write (Writer &writer, const boost::bimap< L, R, Args... > &map)
 boost::bimap serialization support
 
template<typename L , typename R , typename... Args>
std::enable_if_t< 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 >
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::unique_ptr< dump::OperationsFactoryCreateOperationsFactory (const Config &config, const components::ComponentContext &context)
 
std::unique_ptr< dump::OperationsFactoryCreateDefaultOperationsFactory (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 >
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

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
 
const std::string_view kDump
 
const std::string_view kMaxDumpAge
 
const std::string_view kMinDumpInterval
 
const dynamic_config::Key< std::unordered_map< std::string, ConfigPatch > > kConfigSet
 
template<typename T >
constexpr bool kIsWritable = std::is_same_v<meta::DetectedType<impl::WritableResult, T>, void>
 Check if writer.Write(T) is available.
 
template<typename T >
constexpr bool kIsReadable = std::is_same_v<meta::DetectedType<impl::ReadableResult, T>, std::remove_const_t<T>>
 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.
 

Typedef Documentation

◆ SecretKey

using dump::SecretKey = utils::NonLoggable<class SecretKeyTag, std::string>

Definition at line 14 of file operations_encrypted.hpp.

◆ TimePoint

using dump::TimePoint = std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>

Definition at line 13 of file helpers.hpp.

Enumeration Type Documentation

◆ UpdateType

enum class dump::UpdateType
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.

Function Documentation

◆ CheckDumpable()

template<typename T >
constexpr bool dump::CheckDumpable ( )
constexpr

Definition at line 38 of file meta.hpp.

◆ FromBinary()

template<typename T >
T dump::FromBinary ( std::string data)

Converts from binary using Read(Reader&, To<T>)

Definition at line 24 of file test_helpers.hpp.

◆ Insert() [1/5]

template<typename K , typename V , typename Comp , typename Alloc >
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.

◆ Insert() [2/5]

template<typename T , typename Comp , typename Alloc >
void dump::Insert ( std::set< T, Comp, Alloc > & cont,
T && elem )

Definition at line 36 of file meta_containers.hpp.

◆ Insert() [3/5]

template<typename K , typename V , typename Hash , typename Eq , typename Alloc >
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.

◆ Insert() [4/5]

template<typename T , typename Hash , typename Eq , typename Alloc >
void dump::Insert ( std::unordered_set< T, Hash, Eq, Alloc > & cont,
T && elem )

Definition at line 41 of file meta_containers.hpp.

◆ Insert() [5/5]

template<typename T , typename Alloc >
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.

◆ Read() [1/16]

template<int Prec, typename RoundPolicy >
auto dump::Read ( Reader & reader,
dump::To< decimal64::Decimal< Prec, RoundPolicy > >  )

decimal64::Decimal deserialization support

Definition at line 208 of file common.hpp.

◆ Read() [2/16]

template<typename L , typename R , typename... Args>
std::enable_if_t< kIsReadable< impl::BoostBimapLeftKey< L, R, Args... > > &&kIsReadable< impl::BoostBimapRightKey< L, R, Args... > >, boost::bimap< L, R, Args... > > dump::Read ( Reader & reader,
To< boost::bimap< L, R, Args... > >  )

boost::bimap deserialization support

Definition at line 233 of file common_containers.hpp.

◆ Read() [3/16]

template<typename T , typename Index , typename Alloc >
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 268 of file common_containers.hpp.

◆ Read() [4/16]

template<typename T >
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 166 of file common_containers.hpp.

◆ Read() [5/16]

template<typename Rep , typename Period >
std::chrono::duration< Rep, Period > dump::Read ( Reader & reader,
To< std::chrono::duration< Rep, Period > >  )

std::chrono::duration deserialization support

Definition at line 166 of file common.hpp.

◆ Read() [6/16]

template<typename Duration >
auto dump::Read ( Reader & reader,
To< std::chrono::time_point< std::chrono::system_clock, Duration > >  )

std::chrono::time_point deserialization support

Note
Only system_clock is supported, because steady_clock can only be used within a single execution

Definition at line 190 of file common.hpp.

◆ Read() [7/16]

template<typename T >
std::enable_if_t< kIsReadable< T >, std::optional< T > > dump::Read ( Reader & reader,
To< std::optional< T > >  )

std::optional deserialization support

Definition at line 140 of file common_containers.hpp.

◆ Read() [8/16]

template<typename T , typename U >
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 127 of file common_containers.hpp.

◆ Read() [9/16]

template<typename T >
std::enable_if_t< kIsReadable< T >, std::shared_ptr< T > > dump::Read ( Reader & reader,
To< std::shared_ptr< T > >  )

std::shared_ptr deserialization support

Warning
If two or more 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 210 of file common_containers.hpp.

◆ Read() [10/16]

template<typename T >
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 192 of file common_containers.hpp.

◆ Read() [11/16]

template<typename T >
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:

template <>
struct dump::IsDumpedAggregate<MyStruct>;
Warning
Don't forget to increment format-version if data layout changes

Definition at line 86 of file aggregates.hpp.

◆ Read() [12/16]

template<typename T >
std::enable_if_t< meta::kIsInteger< T >, T > dump::Read ( Reader & reader,
To< T >  )

Integral types deserialization support.

Definition at line 97 of file common.hpp.

◆ Read() [13/16]

template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > dump::Read ( Reader & reader,
To< T >  )

Floating-point deserialization support.

Definition at line 119 of file common.hpp.

◆ Read() [14/16]

template<typename T >
std::enable_if_t< std::is_enum_v< T >, T > dump::Read ( Reader & reader,
To< T >  )

enum deserialization support

Definition at line 137 of file common.hpp.

◆ Read() [15/16]

template<typename T >
std::enable_if_t< kIsContainer< T > &&kIsReadable< meta::RangeValueType< T > >, T > dump::Read ( Reader & reader,
To< T >  )

Container deserialization support.

Definition at line 106 of file common_containers.hpp.

◆ Read() [16/16]

template<typename Tag , typename T , utils::StrongTypedefOps Ops>
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 179 of file common_containers.hpp.

◆ ReadJson()

template<typename T >
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.

See also
Local cache dumps

Definition at line 41 of file json_helpers.hpp.

◆ ReadStringViewUnsafe() [1/2]

std::string_view dump::ReadStringViewUnsafe ( Reader & reader)

Reads a std::string_view

Warning
The string_view will be invalidated on the next Read operation

◆ ReadStringViewUnsafe() [2/2]

std::string_view dump::ReadStringViewUnsafe ( Reader & reader,
std::size_t size )

Reads a non-size-prefixed std::string_view

Note
The caller must somehow know the string size in advance
Warning
The string_view will be invalidated on the next Read operation

◆ ReadUnsafeAtMost()

std::string_view dump::ReadUnsafeAtMost ( Reader & reader,
std::size_t max_size )

Reads a std::string_view

Note
Normally, exactly max_size bytes is returned. On end-of-file, the amount of bytes returned can be less than max_size.
Warning
The string_view will be invalidated on the next Read operation

◆ TestWriteReadCycle()

template<typename T >
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.

◆ ToBinary()

template<typename T >
std::string dump::ToBinary ( const T & value)

Converts to binary using Write(Writer&, const T&)

Definition at line 16 of file test_helpers.hpp.

◆ Write() [1/16]

template<typename L , typename R , typename... Args>
std::enable_if_t< kIsWritable< impl::BoostBimapLeftKey< L, R, Args... > > &&kIsWritable< impl::BoostBimapRightKey< L, R, Args... > > > dump::Write ( Writer & writer,
const boost::bimap< L, R, Args... > & map )

boost::bimap serialization support

Definition at line 219 of file common_containers.hpp.

◆ Write() [2/16]

template<typename T , typename Index , typename Alloc >
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 258 of file common_containers.hpp.

◆ Write() [3/16]

template<int Prec, typename RoundPolicy >
void dump::Write ( Writer & writer,
const decimal64::Decimal< Prec, RoundPolicy > & dec )
inline

decimal64::Decimal serialization support

Definition at line 202 of file common.hpp.

◆ Write() [4/16]

template<typename T >
std::enable_if_t< kIsWritable< T > > dump::Write ( Writer & writer,
const std::optional< T > & value )

std::optional serialization support

Definition at line 133 of file common_containers.hpp.

◆ Write() [5/16]

template<typename T , typename U >
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 120 of file common_containers.hpp.

◆ Write() [6/16]

template<typename T >
std::enable_if_t< kIsWritable< T > > dump::Write ( Writer & writer,
const std::shared_ptr< T > & ptr )

std::shared_ptr serialization support

Warning
If two or more 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 201 of file common_containers.hpp.

◆ Write() [7/16]

template<typename T >
std::enable_if_t< kIsWritable< T > > dump::Write ( Writer & writer,
const std::unique_ptr< T > & ptr )

std::unique_ptr serialization support

Definition at line 185 of file common_containers.hpp.

◆ Write() [8/16]

template<typename T >
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:

template <>
struct dump::IsDumpedAggregate<MyStruct>;
Warning
Don't forget to increment format-version if data layout changes

Definition at line 71 of file aggregates.hpp.

◆ Write() [9/16]

template<typename T >
std::enable_if_t< kIsContainer< T > &&kIsWritable< meta::RangeValueType< T > > > dump::Write ( Writer & writer,
const T & value )

Container serialization support.

Definition at line 96 of file common_containers.hpp.

◆ Write() [10/16]

template<typename Tag , typename T , utils::StrongTypedefOps Ops>
std::enable_if_t< kIsWritable< T > > dump::Write ( Writer & writer,
const utils::StrongTypedef< Tag, T, Ops > & object )

utils::StrongTypedef serialization support

Definition at line 172 of file common_containers.hpp.

◆ Write() [11/16]

template<typename Rep , typename Period >
void dump::Write ( Writer & writer,
std::chrono::duration< Rep, Period > value )

std::chrono::duration serialization support

Definition at line 143 of file common.hpp.

◆ Write() [12/16]

template<typename Duration >
void dump::Write ( Writer & writer,
std::chrono::time_point< std::chrono::system_clock, Duration > value )

std::chrono::time_point serialization support

Note
Only system_clock is supported, because steady_clock can only be used within a single execution

Definition at line 182 of file common.hpp.

◆ Write() [13/16]

void dump::Write ( Writer & writer,
std::string_view value )

Write-only std::string_view support.

See also
ReadStringViewUnsafe

◆ Write() [14/16]

template<typename T >
std::enable_if_t< meta::kIsInteger< T > > dump::Write ( Writer & writer,
T value )

Integral types serialization support.

Definition at line 87 of file common.hpp.

◆ Write() [15/16]

template<typename T >
std::enable_if_t< std::is_floating_point_v< T > > dump::Write ( Writer & writer,
T value )

Floating-point serialization support.

Definition at line 113 of file common.hpp.

◆ Write() [16/16]

template<typename T >
std::enable_if_t< std::is_enum_v< T > > dump::Write ( Writer & writer,
T value )

enum serialization support

Definition at line 131 of file common.hpp.

◆ WriteJson()

template<typename T >
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.

See also
Local cache dumps

Definition at line 28 of file json_helpers.hpp.

◆ WriteStringViewUnsafe()

void dump::WriteStringViewUnsafe ( Writer & writer,
std::string_view value )

Writes a non-size-prefixed std::string_view

Note
writer.Write(str) should normally be used instead to write strings

Variable Documentation

◆ kDump

const std::string_view dump::kDump
extern

Definition at line 34 of file dumper.hpp.

◆ kIsContainer

template<typename T >
constexpr bool dump::kIsContainer
inlineconstexpr
Initial value:
= meta::kIsRange<T> && std::is_default_constructible_v<T> && meta::kIsSizable<T> &&

Check if a range is a container.

Definition at line 55 of file meta_containers.hpp.

◆ kIsDumpable

template<typename T >
constexpr bool dump::kIsDumpable = kIsWritable<T> && kIsReadable<T>
inlineconstexpr

Check if T is both writable and readable.

Definition at line 35 of file meta.hpp.

◆ kIsReadable

template<typename T >
constexpr bool dump::kIsReadable = std::is_same_v<meta::DetectedType<impl::ReadableResult, T>, std::remove_const_t<T>>
inlineconstexpr

Check if reader.Read<T>() is available.

Definition at line 31 of file meta.hpp.

◆ kIsWritable

template<typename T >
constexpr bool dump::kIsWritable = std::is_same_v<meta::DetectedType<impl::WritableResult, T>, void>
inlineconstexpr

Check if writer.Write(T) is available.

Definition at line 27 of file meta.hpp.

◆ Read

template<typename... Args>
std::enable_if_t<(true &&... &&(std::is_move_constructible_v< Args > &&kIsReadable< Args >)), std::variant< Args... > dump::Read) (Reader &reader, To< std::variant< Args... > >) ( Reader & reader,
To< std::variant< Args... > >  )

std::variant deserialization support

Definition at line 155 of file common_containers.hpp.

◆ Write

template<typename... Args>
std::enable_if_t<(true &&... &&kIsWritable< Args >) dump::Write) (Writer &writer, const std::variant< Args... > &value) ( Writer & writer,
const std::variant< Args... > & value )

std::variant serialization support

Definition at line 147 of file common_containers.hpp.