Kagome
Polkadot Runtime Engine in C++17
|
Namespaces | |
dynamic_variant | |
Impl details for boost::variant initialization by type index at runtime. | |
literals | |
Classes | |
class | Blob |
class | BufferView |
class | MaxSizeException |
class | SizeLimitedContainer |
class | SLBuffer |
Class represents arbitrary (including empty) byte buffer. More... | |
class | spin_lock |
struct | Uri |
class | VariantBuilder |
struct | Wrapper |
Make strongly typed structures from different concepts of the equal types. E.g. block height and round number are both uint64_t, but better to be different types. Or, ID and Signature both vectors. More... | |
Typedefs | |
using | byte_t = uint8_t |
using | Hash64 = Blob< 8 > |
using | Hash128 = Blob< 16 > |
using | Hash256 = Blob< 32 > |
using | Hash512 = Blob< 64 > |
typedef SLBuffer< std::numeric_limits< size_t >::max()> | Buffer |
using | BufferMutRef = std::reference_wrapper< Buffer > |
using | BufferConstRef = std::reference_wrapper< const Buffer > |
using | uint128_t = boost::multiprecision::uint128_t |
using | uint256_t = boost::multiprecision::uint256_t |
template<typename ElementType , size_t MaxSize, typename... Args> | |
using | SLVector = SizeLimitedContainer< std::vector< ElementType, Args... >, MaxSize > |
Enumerations | |
enum | BlobError { BlobError::INCORRECT_LENGTH = 1 } |
enum | UnhexError { UnhexError::NOT_ENOUGH_INPUT = 1, UnhexError::NON_HEX_INPUT, UnhexError::VALUE_OUT_OF_RANGE, UnhexError::MISSING_0X_PREFIX, UnhexError::UNKNOWN } |
error codes for exceptions that may occur during unhexing More... | |
Functions | |
template<size_t N> | |
std::ostream & | operator<< (std::ostream &os, const Blob< N > &blob) |
template<size_t MaxSize> | |
std::ostream & | operator<< (std::ostream &os, const SLBuffer< MaxSize > &buffer) |
std::ostream & | operator<< (std::ostream &os, BufferView view) |
std::optional< size_t > | getFdLimit () |
void | setFdLimit (size_t limit) |
std::string | int_to_hex (uint64_t n, size_t fixed_width=2) noexcept |
Converts an integer to an uppercase hex representation. More... | |
std::string | hex_upper (gsl::span< const uint8_t > bytes) noexcept |
Converts bytes to uppercase hex representation. More... | |
std::string | hex_lower (gsl::span< const uint8_t > bytes) noexcept |
Converts bytes to hex representation. More... | |
std::string | hex_lower_0x (gsl::span< const uint8_t > bytes) noexcept |
Converts bytes to hex representation with prefix 0x. More... | |
outcome::result< std::vector< uint8_t > > | unhex (std::string_view hex) |
Converts hex representation to bytes. More... | |
outcome::result< std::vector< uint8_t > > | unhexWith0x (std::string_view hex) |
Unhex hex-string with 0x in the begining. More... | |
std::string | hex_lower_0x (const uint8_t *data, size_t size) noexcept |
Adapter for ptr+size. More... | |
template<class T , typename = std::enable_if<std::is_unsigned_v<T>>> | |
outcome::result< T > | unhexNumber (std::string_view value) |
unhex hex-string with 0x or without it in the beginning More... | |
template<typename T , typename F , typename R = std::invoke_result_t<F, const T &>> | |
std::optional< R > | map_optional (std::optional< T > const &opt, F const &f) |
template<typename T , typename F , typename R = std::invoke_result_t<F, T &&>> | |
std::optional< R > | map_optional (std::optional< T > &&opt, F const &f) |
template<typename T , typename F , typename R = std::invoke_result_t<F, const T &>> | |
outcome::result< R > | map_result (outcome::result< T > const &res, F const &f) |
template<typename T , typename F , typename R = std::invoke_result_t<F, T &&>> | |
outcome::result< R > | map_result (outcome::result< T > &&res, F const &f) |
template<typename T , typename F , typename R = std::invoke_result_t<F, T const &>> | |
outcome::result< std::optional< R > > | map_result_optional (outcome::result< std::optional< T >> const &res_opt, F const &f) |
template<typename T , typename F , typename R = std::invoke_result_t<F, T &&>> | |
outcome::result< std::optional< R > > | map_result_optional (outcome::result< std::optional< T >> &&res_opt, F const &f) |
std::array< uint8_t, 8 > | uint64_to_le_bytes (uint64_t number) |
uint64_t | le_bytes_to_uint64 (gsl::span< const uint8_t, 8 > bytes) |
std::array< uint8_t, 8 > | uint64_to_be_bytes (uint64_t number) |
uint64_t | be_bytes_to_uint64 (gsl::span< const uint8_t, 8 > bytes) |
std::array< uint8_t, 16 > | uint128_to_le_bytes (const boost::multiprecision::uint128_t &i) |
boost::multiprecision::uint128_t | le_bytes_to_uint128 (gsl::span< const uint8_t, 16 > bytes) |
std::array< uint8_t, 16 > | uint128_to_be_bytes (const boost::multiprecision::uint128_t &i) |
boost::multiprecision::uint128_t | be_bytes_to_uint128 (gsl::span< const uint8_t, 16 > bytes) |
std::array< uint8_t, 32 > | uint256_to_le_bytes (const boost::multiprecision::uint256_t &i) |
boost::multiprecision::uint256_t | le_bytes_to_uint256 (gsl::span< const uint8_t, 32 > bytes) |
std::array< uint8_t, 32 > | uint256_to_be_bytes (const boost::multiprecision::uint256_t &i) |
boost::multiprecision::uint256_t | be_bytes_to_uint256 (gsl::span< const uint8_t, 32 > bytes) |
template<typename T , typename = std::enable_if_t<std::is_enum_v<T>>> | |
void | raise (T t) |
throws outcome::result error as boost exception More... | |
template<typename T , typename = std::enable_if_t<!std::is_enum_v<T>>> | |
void | raise (const T &t) |
throws outcome::result error made of error as boost exception More... | |
template<typename T , typename Tag , typename = std::enable_if<std::is_arithmetic<T>::value>> | |
bool | operator< (const Wrapper< T, Tag > &a, const Wrapper< T, Tag > &b) |
Variables | |
static const Buffer | kEmptyBuffer {} |
Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
typedef SLBuffer<std::numeric_limits<size_t>::max()> kagome::common::Buffer |
Definition at line 244 of file buffer.hpp.
using kagome::common::BufferConstRef = typedef std::reference_wrapper<const Buffer> |
Definition at line 249 of file buffer.hpp.
using kagome::common::BufferMutRef = typedef std::reference_wrapper<Buffer> |
Definition at line 248 of file buffer.hpp.
using kagome::common::byte_t = typedef uint8_t |
using kagome::common::Hash128 = typedef Blob<16> |
using kagome::common::Hash256 = typedef Blob<32> |
using kagome::common::Hash512 = typedef Blob<64> |
using kagome::common::Hash64 = typedef Blob<8> |
using kagome::common::SLVector = typedef SizeLimitedContainer<std::vector<ElementType, Args...>, MaxSize> |
Definition at line 402 of file size_limited_containers.hpp.
using kagome::common::uint128_t = typedef boost::multiprecision::uint128_t |
Definition at line 14 of file mp_utils.hpp.
using kagome::common::uint256_t = typedef boost::multiprecision::uint256_t |
Definition at line 15 of file mp_utils.hpp.
|
strong |
|
strong |
error codes for exceptions that may occur during unhexing
Enumerator | |
---|---|
NOT_ENOUGH_INPUT | |
NON_HEX_INPUT | |
VALUE_OUT_OF_RANGE | |
MISSING_0X_PREFIX | |
UNKNOWN |
Definition at line 20 of file hexutil.hpp.
uint128_t kagome::common::be_bytes_to_uint128 | ( | gsl::span< const uint8_t, 16 > | bytes | ) |
Definition at line 91 of file mp_utils.cpp.
uint256_t kagome::common::be_bytes_to_uint256 | ( | gsl::span< const uint8_t, 32 > | bytes | ) |
Definition at line 111 of file mp_utils.cpp.
uint64_t kagome::common::be_bytes_to_uint64 | ( | gsl::span< const uint8_t, 8 > | bytes | ) |
Definition at line 70 of file mp_utils.cpp.
std::optional< size_t > kagome::common::getFdLimit | ( | ) |
Definition at line 36 of file fd_limit.cpp.
|
noexcept |
Converts bytes to hex representation.
array | bytes |
len | length of bytes |
Definition at line 52 of file hexutil.cpp.
|
noexcept |
Converts bytes to hex representation with prefix 0x.
array | bytes |
Definition at line 58 of file hexutil.cpp.
|
inlinenoexcept |
Adapter for ptr+size.
Definition at line 59 of file hexutil.hpp.
|
noexcept |
Converts bytes to uppercase hex representation.
array | bytes |
len | length of bytes |
Definition at line 46 of file hexutil.cpp.
|
noexcept |
Converts an integer to an uppercase hex representation.
Definition at line 30 of file hexutil.cpp.
uint128_t kagome::common::le_bytes_to_uint128 | ( | gsl::span< const uint8_t, 16 > | bytes | ) |
Definition at line 81 of file mp_utils.cpp.
uint256_t kagome::common::le_bytes_to_uint256 | ( | gsl::span< const uint8_t, 32 > | bytes | ) |
Definition at line 101 of file mp_utils.cpp.
uint64_t kagome::common::le_bytes_to_uint64 | ( | gsl::span< const uint8_t, 8 > | bytes | ) |
Definition at line 58 of file mp_utils.cpp.
std::optional<R> kagome::common::map_optional | ( | std::optional< T > const & | opt, |
F const & | f | ||
) |
Applies
Definition at line 24 of file monadic_utils.hpp.
std::optional<R> kagome::common::map_optional | ( | std::optional< T > && | opt, |
F const & | f | ||
) |
Applies
Definition at line 37 of file monadic_utils.hpp.
outcome::result<R> kagome::common::map_result | ( | outcome::result< T > const & | res, |
F const & | f | ||
) |
Applies
Definition at line 53 of file monadic_utils.hpp.
outcome::result<R> kagome::common::map_result | ( | outcome::result< T > && | res, |
F const & | f | ||
) |
Applies
Definition at line 67 of file monadic_utils.hpp.
outcome::result<std::optional<R> > kagome::common::map_result_optional | ( | outcome::result< std::optional< T >> const & | res_opt, |
F const & | f | ||
) |
Applies
Definition at line 84 of file monadic_utils.hpp.
outcome::result<std::optional<R> > kagome::common::map_result_optional | ( | outcome::result< std::optional< T >> && | res_opt, |
F const & | f | ||
) |
Applies
Definition at line 99 of file monadic_utils.hpp.
bool kagome::common::operator< | ( | const Wrapper< T, Tag > & | a, |
const Wrapper< T, Tag > & | b | ||
) |
Definition at line 50 of file wrapper.hpp.
|
inline |
Definition at line 59 of file buffer_view.hpp.
|
inline |
|
inline |
Definition at line 239 of file buffer.hpp.
void kagome::common::raise | ( | T | t | ) |
throws outcome::result error as boost exception
T | enum error type, only outcome::result enums are allowed |
t | error value |
Definition at line 19 of file outcome_throw.hpp.
void kagome::common::raise | ( | const T & | t | ) |
throws outcome::result error made of error as boost exception
T | outcome error type |
t | outcome error value |
Definition at line 30 of file outcome_throw.hpp.
void kagome::common::setFdLimit | ( | size_t | limit | ) |
Definition at line 44 of file fd_limit.cpp.
std::array< uint8_t, 16 > kagome::common::uint128_to_be_bytes | ( | const boost::multiprecision::uint128_t & | i | ) |
Definition at line 86 of file mp_utils.cpp.
std::array< uint8_t, 16 > kagome::common::uint128_to_le_bytes | ( | const boost::multiprecision::uint128_t & | i | ) |
Definition at line 76 of file mp_utils.cpp.
std::array< uint8_t, 32 > kagome::common::uint256_to_be_bytes | ( | const boost::multiprecision::uint256_t & | i | ) |
Definition at line 106 of file mp_utils.cpp.
std::array< uint8_t, 32 > kagome::common::uint256_to_le_bytes | ( | const boost::multiprecision::uint256_t & | i | ) |
Definition at line 96 of file mp_utils.cpp.
std::array< uint8_t, 8 > kagome::common::uint64_to_be_bytes | ( | uint64_t | number | ) |
Definition at line 64 of file mp_utils.cpp.
std::array< uint8_t, 8 > kagome::common::uint64_to_le_bytes | ( | uint64_t | number | ) |
Definition at line 52 of file mp_utils.cpp.
outcome::result< std::vector< uint8_t > > kagome::common::unhex | ( | std::string_view | hex | ) |
Converts hex representation to bytes.
array | individual chars |
len | length of chars |
Definition at line 70 of file hexutil.cpp.
outcome::result<T> kagome::common::unhexNumber | ( | std::string_view | value | ) |
unhex hex-string with 0x or without it in the beginning
T | unsigned integer value type to decode |
value | source hex string |
Definition at line 91 of file hexutil.hpp.
outcome::result< std::vector< uint8_t > > kagome::common::unhexWith0x | ( | std::string_view | hex | ) |
Unhex hex-string with 0x in the begining.
hex | hex string with 0x in the beginning |
Definition at line 89 of file hexutil.cpp.
|
inlinestatic |
Definition at line 246 of file buffer.hpp.